1 | local library = {flags = {}, windows = {}, open = true} |
2 | |
3 | --Services |
4 | local runService = game:GetService"RunService" |
5 | local tweenService = game:GetService"TweenService" |
6 | local textService = game:GetService"TextService" |
7 | local inputService = game:GetService"UserInputService" |
8 | |
9 | --Locals |
10 | local dragging, dragInput, dragStart, startPos, dragObject |
11 | |
12 | local blacklistedKeys = { --add or remove keys if you find the need to |
13 | Enum.KeyCode.Unknown,Enum.KeyCode.W,Enum.KeyCode.A,Enum.KeyCode.S,Enum.KeyCode.D,Enum.KeyCode.Slash,Enum.KeyCode.Tab,Enum.KeyCode.Backspace,Enum.KeyCode.Escape |
14 | } |
15 | local whitelistedMouseinputs = { --add or remove mouse inputs if you find the need to |
16 | Enum.UserInputType.MouseButton1,Enum.UserInputType.MouseButton2,Enum.UserInputType.MouseButton3,Enum.UserInputType.Touch |
17 | } |
18 | |
19 | --Functions |
20 | local function round(num, places) |
21 | local power = 10^places |
22 | return math.round(num * power) / power |
23 | end |
24 | |
25 | local function keyCheck(x,x1) |
26 | for _,v in next, x1 do |
27 | if v == x then |
28 | return true |
29 | end |
30 | end |
31 | end |
32 | |
33 | local function update(input) |
34 | local delta = input.Position - dragStart |
35 | local yPos = (startPos.Y.Offset + delta.Y) < -36 and -36 or startPos.Y.Offset + delta.Y |
36 | dragObject:TweenPosition(UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, yPos), "Out", "Quint", 0.1, true) |
37 | end |
38 | |
39 | --From: https://devforum.roblox.com/t/how-to-create-a-simple-rainbow-effect-using-tweenService/221849/2 |
40 | local chromaColor |
41 | local rainbowTime = 5 |
42 | spawn(function() |
43 | while wait() do |
44 | chromaColor = Color3.fromHSV(tick() % rainbowTime / rainbowTime, 1, 1) |
45 | end |
46 | end) |
47 | |
48 | function library:Create(class, properties) |
49 | properties = typeof(properties) == "table" and properties or {} |
50 | local inst = Instance.new(class) |
51 | for property, value in next, properties do |
52 | inst[property] = value |
53 | end |
54 | return inst |
55 | end |
56 | |
57 | function library:Draw(class, properties) |
58 | local properties = type(properties) == 'table' and properties or {}; |
59 | |
60 | local object = Drawing.new(class) |
61 | for p, v in next, properties do |
62 | object[p] = v; |
63 | end |
64 | return object |
65 | end |
66 | |
67 | local function createOptionHolder(holderTitle, parent, parentTable, subHolder) |
68 | local size = subHolder and 34 or 40 |
69 | parentTable.main = library:Create("ImageButton", { |
70 | LayoutOrder = subHolder and parentTable.position or 0, |
71 | Position = UDim2.new(0, 20 + (250 * (parentTable.position or 0)), 0, 20), |
72 | Size = UDim2.new(0, 230, 0, size), |
73 | BackgroundTransparency = 1, |
74 | Image = "rbxassetid://3570695787", |
75 | ImageColor3 = Color3.fromRGB(20, 20, 20), |
76 | ScaleType = Enum.ScaleType.Slice, |
77 | SliceCenter = Rect.new(100, 100, 100, 100), |
78 | SliceScale = 0.04, |
79 | ClipsDescendants = true, |
80 | Parent = parent |
81 | }) |
82 | |
83 | local round |
84 | if not subHolder then |
85 | round = library:Create("ImageLabel", { |
86 | Size = UDim2.new(1, 0, 0, size), |
87 | BackgroundTransparency = 1, |
88 | Image = "rbxassetid://3570695787", |
89 | ImageColor3 = parentTable.open and (subHolder and Color3.fromRGB(16, 16, 16) or Color3.fromRGB(10, 10, 10)) or (subHolder and Color3.fromRGB(10, 10, 10) or Color3.fromRGB(6, 6, 6)), |
90 | ScaleType = Enum.ScaleType.Slice, |
91 | SliceCenter = Rect.new(100, 100, 100, 100), |
92 | SliceScale = 0.04, |
93 | Parent = parentTable.main |
94 | }) |
95 | end |
96 | |
97 | local title = library:Create("TextLabel", { |
98 | Size = UDim2.new(1, 0, 0, size), |
99 | BackgroundTransparency = subHolder and 0 or 1, |
100 | BackgroundColor3 = Color3.fromRGB(10, 10, 10), |
101 | BorderSizePixel = 0, |
102 | Text = holderTitle, |
103 | TextSize = subHolder and 16 or 17, |
104 | Font = Enum.Font.PatrickHand, |
105 | TextColor3 = Color3.fromRGB(255, 255, 255), |
106 | Parent = parentTable.main |
107 | }) |
108 | |
109 | local closeHolder = library:Create("Frame", { |
110 | Position = UDim2.new(1, 0, 0, 0), |
111 | Size = UDim2.new(-1, 0, 1, 0), |
112 | SizeConstraint = Enum.SizeConstraint.RelativeYY, |
113 | BackgroundTransparency = 1, |
114 | Parent = title |
115 | }) |
116 | |
117 | local close = library:Create("ImageLabel", { |
118 | AnchorPoint = Vector2.new(0.5, 0.5), |
119 | Position = UDim2.new(0.5, 0, 0.5, 0), |
120 | Size = UDim2.new(1, -size - 10, 1, -size - 10), |
121 | Rotation = parentTable.open and 90 or 180, |
122 | BackgroundTransparency = 1, |
123 | Image = "rbxassetid://4918373417", |
124 | ImageColor3 = parentTable.open and Color3.fromRGB(50, 50, 50) or Color3.fromRGB(30, 30, 30), |
125 | ScaleType = Enum.ScaleType.Fit, |
126 | Parent = closeHolder |
127 | }) |
128 | |
129 | parentTable.content = library:Create("Frame", { |
130 | Position = UDim2.new(0, 0, 0, size), |
131 | Size = UDim2.new(1, 0, 1, -size), |
132 | BackgroundTransparency = 1, |
133 | Parent = parentTable.main |
134 | }) |
135 | |
136 | local layout = library:Create("UIListLayout", { |
137 | SortOrder = Enum.SortOrder.LayoutOrder, |
138 | Parent = parentTable.content |
139 | }) |
140 | |
141 | layout.Changed:connect(function() |
142 | parentTable.content.Size = UDim2.new(1, 0, 0, layout.AbsoluteContentSize.Y) |
143 | parentTable.main.Size = #parentTable.options > 0 and parentTable.open and UDim2.new(0, 230, 0, layout.AbsoluteContentSize.Y + size) or UDim2.new(0, 230, 0, size) |
144 | end) |
145 | |
146 | if not subHolder then |
147 | library:Create("UIPadding", { |
148 | Parent = parentTable.content |
149 | }) |
150 | |
151 | title.InputBegan:connect(function(input) |
152 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
153 | dragObject = parentTable.main |
154 | dragging = true |
155 | dragStart = input.Position |
156 | startPos = dragObject.Position |
157 | end |
158 | end) |
159 | title.InputChanged:connect(function(input) |
160 | if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then |
161 | dragInput = input |
162 | end |
163 | end) |
164 | title.InputEnded:connect(function(input) |
165 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
166 | dragging = false |
167 | end |
168 | end) |
169 | end |
170 | |
171 | closeHolder.InputBegan:connect(function(input) |
172 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
173 | parentTable.open = not parentTable.open |
174 | tweenService:Create(close, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Rotation = parentTable.open and 90 or 180, ImageColor3 = parentTable.open and Color3.fromRGB(50, 50, 50) or Color3.fromRGB(30, 30, 30)}):Play() |
175 | if subHolder then |
176 | tweenService:Create(title, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = parentTable.open and Color3.fromRGB(16, 16, 16) or Color3.fromRGB(10, 10, 10)}):Play() |
177 | else |
178 | tweenService:Create(round, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = parentTable.open and Color3.fromRGB(10, 10, 10) or Color3.fromRGB(6, 6, 6)}):Play() |
179 | end |
180 | parentTable.main:TweenSize(#parentTable.options > 0 and parentTable.open and UDim2.new(0, 230, 0, layout.AbsoluteContentSize.Y + size) or UDim2.new(0, 230, 0, size), "Out", "Quad", 0.2, true) |
181 | end |
182 | end) |
183 | |
184 | function parentTable:SetTitle(newTitle) |
185 | title.Text = tostring(newTitle) |
186 | end |
187 | |
188 | return parentTable |
189 | end |
190 | |
191 | local function createLabel(option, parent) |
192 | local main = library:Create("TextLabel", { |
193 | LayoutOrder = option.position, |
194 | Size = UDim2.new(1, 0, 0, 26), |
195 | BackgroundTransparency = 1, |
196 | Text = " " .. option.text, |
197 | TextSize = 17, |
198 | Font = Enum.Font.Arcade, |
199 | TextColor3 = Color3.fromRGB(255, 255, 255), |
200 | TextXAlignment = Enum.TextXAlignment.Left, |
201 | Parent = parent.content |
202 | }) |
203 | |
204 | setmetatable(option, {__newindex = function(t, i, v) |
205 | if i == "Text" then |
206 | main.Text = " " .. tostring(v) |
207 | end |
208 | end}) |
209 | end |
210 | |
211 | function createToggle(option, parent) |
212 | local main = library:Create("TextLabel", { |
213 | LayoutOrder = option.position, |
214 | Size = UDim2.new(1, 0, 0, 31), |
215 | BackgroundTransparency = 1, |
216 | Text = " " .. option.text, |
217 | TextSize = 17, |
218 | Font = Enum.Font.Arcade, |
219 | TextColor3 = Color3.fromRGB(255, 255, 255), |
220 | TextXAlignment = Enum.TextXAlignment.Left, |
221 | Parent = parent.content |
222 | }) |
223 | |
224 | local tickboxOutline = library:Create("ImageLabel", { |
225 | Position = UDim2.new(1, -6, 0, 4), |
226 | Size = UDim2.new(-1, 10, 1, -10), |
227 | SizeConstraint = Enum.SizeConstraint.RelativeYY, |
228 | BackgroundTransparency = 1, |
229 | Image = "rbxassetid://3570695787", |
230 | ImageColor3 = option.state and Color3.fromRGB(255, 65, 65) or Color3.fromRGB(100, 100, 100), |
231 | ScaleType = Enum.ScaleType.Slice, |
232 | SliceCenter = Rect.new(100, 100, 100, 100), |
233 | SliceScale = 0.02, |
234 | Parent = main |
235 | }) |
236 | |
237 | local tickboxInner = library:Create("ImageLabel", { |
238 | Position = UDim2.new(0, 2, 0, 2), |
239 | Size = UDim2.new(1, -4, 1, -4), |
240 | BackgroundTransparency = 1, |
241 | Image = "rbxassetid://3570695787", |
242 | ImageColor3 = option.state and Color3.fromRGB(255, 65, 65) or Color3.fromRGB(20, 20, 20), |
243 | ScaleType = Enum.ScaleType.Slice, |
244 | SliceCenter = Rect.new(100, 100, 100, 100), |
245 | SliceScale = 0.02, |
246 | Parent = tickboxOutline |
247 | }) |
248 | |
249 | local checkmarkHolder = library:Create("Frame", { |
250 | Position = UDim2.new(0, 4, 0, 4), |
251 | Size = option.state and UDim2.new(1, -8, 1, -8) or UDim2.new(0, 0, 1, -8), |
252 | BackgroundTransparency = 1, |
253 | ClipsDescendants = true, |
254 | Parent = tickboxOutline |
255 | }) |
256 | |
257 | local checkmark = library:Create("ImageLabel", { |
258 | Size = UDim2.new(1, 0, 1, 0), |
259 | SizeConstraint = Enum.SizeConstraint.RelativeYY, |
260 | BackgroundTransparency = 1, |
261 | Image = "rbxassetid://4919148038", |
262 | ImageColor3 = Color3.fromRGB(20, 20, 20), |
263 | Parent = checkmarkHolder |
264 | }) |
265 | |
266 | local inContact |
267 | main.InputBegan:connect(function(input) |
268 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
269 | option:SetState(not option.state) |
270 | end |
271 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then |
272 | inContact = true |
273 | if not option.state then |
274 | tweenService:Create(tickboxOutline, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(140, 140, 140)}):Play() |
275 | end |
276 | end |
277 | end) |
278 | |
279 | main.InputEnded:connect(function(input) |
280 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then |
281 | inContact = true |
282 | if not option.state then |
283 | tweenService:Create(tickboxOutline, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(100, 100, 100)}):Play() |
284 | end |
285 | end |
286 | end) |
287 | |
288 | function option:SetState(state) |
289 | library.flags[self.flag] = state |
290 | self.state = state |
291 | checkmarkHolder:TweenSize(option.state and UDim2.new(1, -8, 1, -8) or UDim2.new(0, 0, 1, -8), "Out", "Quad", 0.2, true) |
292 | tweenService:Create(tickboxInner, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = state and Color3.fromRGB(255, 65, 65) or Color3.fromRGB(20, 20, 20)}):Play() |
293 | if state then |
294 | tweenService:Create(tickboxOutline, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(255, 65, 65)}):Play() |
295 | else |
296 | if inContact then |
297 | tweenService:Create(tickboxOutline, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(140, 140, 140)}):Play() |
298 | else |
299 | tweenService:Create(tickboxOutline, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(100, 100, 100)}):Play() |
300 | end |
301 | end |
302 | self.callback(state) |
303 | end |
304 | |
305 | if option.state then |
306 | delay(1, function() option.callback(true) end) |
307 | end |
308 | |
309 | setmetatable(option, {__newindex = function(t, i, v) |
310 | if i == "Text" then |
311 | main.Text=" "..tostring(v) |
312 | end |
313 | end}) |
314 | end |
315 | |
316 | function createButton(option, parent) |
317 | local main = library:Create("TextLabel", { |
318 | ZIndex = 2, |
319 | LayoutOrder = option.position, |
320 | Size = UDim2.new(1, 0, 0, 34), |
321 | BackgroundTransparency = 1, |
322 | Text = " " .. option.text, |
323 | TextSize = 17, |
324 | Font = Enum.Font.PatrickHand, |
325 | TextColor3 = Color3.fromRGB(255, 255, 255), |
326 | Parent = parent.content |
327 | }) |
328 | |
329 | local round = library:Create("ImageLabel", { |
330 | AnchorPoint = Vector2.new(0.5, 0.5), |
331 | Position = UDim2.new(0.5, 0, 0.5, 0), |
332 | Size = UDim2.new(1, -12, 1, -10), |
333 | BackgroundTransparency = 1, |
334 | Image = "rbxassetid://3570695787", |
335 | ImageColor3 = Color3.fromRGB(40, 40, 40), |
336 | ScaleType = Enum.ScaleType.Slice, |
337 | SliceCenter = Rect.new(100, 100, 100, 100), |
338 | SliceScale = 0.02, |
339 | Parent = main |
340 | }) |
341 | |
342 | local inContact |
343 | local clicking |
344 | main.InputBegan:connect(function(input) |
345 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
346 | library.flags[option.flag] = true |
347 | clicking = true |
348 | tweenService:Create(round, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(255, 65, 65)}):Play() |
349 | option.callback() |
350 | end |
351 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then |
352 | inContact = true |
353 | tweenService:Create(round, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play() |
354 | end |
355 | end) |
356 | |
357 | main.InputEnded:connect(function(input) |
358 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
359 | clicking = false |
360 | if inContact then |
361 | tweenService:Create(round, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play() |
362 | else |
363 | tweenService:Create(round, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(40, 40, 40)}):Play() |
364 | end |
365 | end |
366 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then |
367 | inContact = false |
368 | if not clicking then |
369 | tweenService:Create(round, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(40, 40, 40)}):Play() |
370 | end |
371 | end |
372 | end) |
373 | end |
374 | |
375 | local function createBind(option, parent) |
376 | local binding |
377 | local holding |
378 | local loop |
379 | local text = string.match(option.key, "Mouse") and string.sub(option.key, 1, 5) .. string.sub(option.key, 12, 13) or option.key |
380 | |
381 | local main = library:Create("TextLabel", { |
382 | LayoutOrder = option.position, |
383 | Size = UDim2.new(1, 0, 0, 33), |
384 | BackgroundTransparency = 1, |
385 | Text = " " .. option.text, |
386 | TextSize = 17, |
387 | Font = Enum.Font.PatrickHand, |
388 | TextColor3 = Color3.fromRGB(255, 255, 255), |
389 | TextXAlignment = Enum.TextXAlignment.Left, |
390 | Parent = parent.content |
391 | }) |
392 | |
393 | local round = library:Create("ImageLabel", { |
394 | Position = UDim2.new(1, -6, 0, 4), |
395 | Size = UDim2.new(0, -textService:GetTextSize(text, 16, Enum.Font.Gotham, Vector2.new(9e9, 9e9)).X - 16, 1, -10), |
396 | SizeConstraint = Enum.SizeConstraint.RelativeYY, |
397 | BackgroundTransparency = 1, |
398 | Image = "rbxassetid://3570695787", |
399 | ImageColor3 = Color3.fromRGB(40, 40, 40), |
400 | ScaleType = Enum.ScaleType.Slice, |
401 | SliceCenter = Rect.new(100, 100, 100, 100), |
402 | SliceScale = 0.02, |
403 | Parent = main |
404 | }) |
405 | |
406 | local bindinput = library:Create("TextLabel", { |
407 | Size = UDim2.new(1, 0, 1, 0), |
408 | BackgroundTransparency = 1, |
409 | Text = text, |
410 | TextSize = 16, |
411 | Font = Enum.Font.Gotham, |
412 | TextColor3 = Color3.fromRGB(255, 255, 255), |
413 | Parent = round |
414 | }) |
415 | |
416 | local inContact |
417 | main.InputBegan:connect(function(input) |
418 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then |
419 | inContact = true |
420 | if not binding then |
421 | tweenService:Create(round, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play() |
422 | end |
423 | end |
424 | end) |
425 | |
426 | main.InputEnded:connect(function(input) |
427 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
428 | binding = true |
429 | bindinput.Text = "..." |
430 | tweenService:Create(round, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(255, 65, 65)}):Play() |
431 | end |
432 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then |
433 | inContact = false |
434 | if not binding then |
435 | tweenService:Create(round, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(40, 40, 40)}):Play() |
436 | end |
437 | end |
438 | end) |
439 | |
440 | inputService.InputBegan:connect(function(input) |
441 | if inputService:GetFocusedTextBox() then return end |
442 | if (input.KeyCode.Name == option.key or input.UserInputType.Name == option.key) and not binding then |
443 | if option.hold then |
444 | loop = runService.Heartbeat:connect(function() |
445 | if binding then |
446 | option.callback(true) |
447 | loop:Disconnect() |
448 | loop = nil |
449 | else |
450 | option.callback() |
451 | end |
452 | end) |
453 | else |
454 | option.callback() |
455 | end |
456 | elseif binding then |
457 | local key |
458 | pcall(function() |
459 | if not keyCheck(input.KeyCode, blacklistedKeys) then |
460 | key = input.KeyCode |
461 | end |
462 | end) |
463 | pcall(function() |
464 | if keyCheck(input.UserInputType, whitelistedMouseinputs) and not key then |
465 | key = input.UserInputType |
466 | end |
467 | end) |
468 | key = key or option.key |
469 | option:SetKey(key) |
470 | end |
471 | end) |
472 | |
473 | inputService.InputEnded:connect(function(input) |
474 | if input.KeyCode.Name == option.key or input.UserInputType.Name == option.key or input.UserInputType.Name == "MouseMovement" then |
475 | if loop then |
476 | loop:Disconnect() |
477 | loop = nil |
478 | option.callback(true) |
479 | end |
480 | end |
481 | end) |
482 | |
483 | function option:SetKey(key) |
484 | binding = false |
485 | if loop then |
486 | loop:Disconnect() |
487 | loop = nil |
488 | end |
489 | self.key = key or self.key |
490 | self.key = self.key.Name or self.key |
491 | library.flags[self.flag] = self.key |
492 | if string.match(self.key, "Mouse") then |
493 | bindinput.Text = string.sub(self.key, 1, 5) .. string.sub(self.key, 12, 13) |
494 | else |
495 | bindinput.Text = self.key |
496 | end |
497 | tweenService:Create(round, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = inContact and Color3.fromRGB(60, 60, 60) or Color3.fromRGB(40, 40, 40)}):Play() |
498 | round.Size = UDim2.new(0, -textService:GetTextSize(bindinput.Text, 15, Enum.Font.Gotham, Vector2.new(9e9, 9e9)).X - 16, 1, -10) |
499 | end |
500 | end |
501 | |
502 | local function createSlider(option, parent) |
503 | local main = library:Create("Frame", { |
504 | LayoutOrder = option.position, |
505 | Size = UDim2.new(1, 0, 0, 50), |
506 | BackgroundTransparency = 1, |
507 | Parent = parent.content |
508 | }) |
509 | |
510 | local title = library:Create("TextLabel", { |
511 | Position = UDim2.new(0, 0, 0, 4), |
512 | Size = UDim2.new(1, 0, 0, 20), |
513 | BackgroundTransparency = 1, |
514 | Text = " " .. option.text, |
515 | TextSize = 17, |
516 | Font = Enum.Font.PatrickHand, |
517 | TextColor3 = Color3.fromRGB(255, 255, 255), |
518 | TextXAlignment = Enum.TextXAlignment.Left, |
519 | Parent = main |
520 | }) |
521 | |
522 | local slider = library:Create("ImageLabel", { |
523 | Position = UDim2.new(0, 10, 0, 34), |
524 | Size = UDim2.new(1, -20, 0, 5), |
525 | BackgroundTransparency = 1, |
526 | Image = "rbxassetid://3570695787", |
527 | ImageColor3 = Color3.fromRGB(30, 30, 30), |
528 | ScaleType = Enum.ScaleType.Slice, |
529 | SliceCenter = Rect.new(100, 100, 100, 100), |
530 | SliceScale = 0.02, |
531 | Parent = main |
532 | }) |
533 | |
534 | local fill = library:Create("ImageLabel", { |
535 | BackgroundTransparency = 1, |
536 | Image = "rbxassetid://3570695787", |
537 | ImageColor3 = Color3.fromRGB(60, 60, 60), |
538 | ScaleType = Enum.ScaleType.Slice, |
539 | SliceCenter = Rect.new(100, 100, 100, 100), |
540 | SliceScale = 0.02, |
541 | Parent = slider |
542 | }) |
543 | |
544 | local circle = library:Create("ImageLabel", { |
545 | AnchorPoint = Vector2.new(0.5, 0.5), |
546 | Position = UDim2.new((option.value - option.min) / (option.max - option.min), 0, 0.5, 0), |
547 | SizeConstraint = Enum.SizeConstraint.RelativeYY, |
548 | BackgroundTransparency = 1, |
549 | Image = "rbxassetid://3570695787", |
550 | ImageColor3 = Color3.fromRGB(60, 60, 60), |
551 | ScaleType = Enum.ScaleType.Slice, |
552 | SliceCenter = Rect.new(100, 100, 100, 100), |
553 | SliceScale = 1, |
554 | Parent = slider |
555 | }) |
556 | |
557 | local valueRound = library:Create("ImageLabel", { |
558 | Position = UDim2.new(1, -6, 0, 4), |
559 | Size = UDim2.new(0, -60, 0, 18), |
560 | BackgroundTransparency = 1, |
561 | Image = "rbxassetid://3570695787", |
562 | ImageColor3 = Color3.fromRGB(40, 40, 40), |
563 | ScaleType = Enum.ScaleType.Slice, |
564 | SliceCenter = Rect.new(100, 100, 100, 100), |
565 | SliceScale = 0.02, |
566 | Parent = main |
567 | }) |
568 | |
569 | local inputvalue = library:Create("TextBox", { |
570 | Size = UDim2.new(1, 0, 1, 0), |
571 | BackgroundTransparency = 1, |
572 | Text = option.value, |
573 | TextColor3 = Color3.fromRGB(235, 235, 235), |
574 | TextSize = 15, |
575 | TextWrapped = true, |
576 | Font = Enum.Font.PatrickHand, |
577 | Parent = valueRound |
578 | }) |
579 | |
580 | if option.min >= 0 then |
581 | fill.Size = UDim2.new((option.value - option.min) / (option.max - option.min), 0, 1, 0) |
582 | else |
583 | fill.Position = UDim2.new((0 - option.min) / (option.max - option.min), 0, 0, 0) |
584 | fill.Size = UDim2.new(option.value / (option.max - option.min), 0, 1, 0) |
585 | end |
586 | |
587 | local sliding |
588 | local inContact |
589 | main.InputBegan:connect(function(input) |
590 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
591 | tweenService:Create(fill, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(255, 65, 65)}):Play() |
592 | tweenService:Create(circle, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = UDim2.new(3.5, 0, 3.5, 0), ImageColor3 = Color3.fromRGB(255, 65, 65)}):Play() |
593 | sliding = true |
594 | option:SetValue(option.min + ((input.Position.X - slider.AbsolutePosition.X) / slider.AbsoluteSize.X) * (option.max - option.min)) |
595 | end |
596 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then |
597 | inContact = true |
598 | if not sliding then |
599 | tweenService:Create(fill, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(100, 100, 100)}):Play() |
600 | tweenService:Create(circle, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = UDim2.new(2.8, 0, 2.8, 0), ImageColor3 = Color3.fromRGB(100, 100, 100)}):Play() |
601 | end |
602 | end |
603 | end) |
604 | |
605 | inputService.InputChanged:connect(function(input) |
606 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) and sliding then |
607 | option:SetValue(option.min + ((input.Position.X - slider.AbsolutePosition.X) / slider.AbsoluteSize.X) * (option.max - option.min)) |
608 | end |
609 | end) |
610 | |
611 | main.InputEnded:connect(function(input) |
612 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
613 | sliding = false |
614 | if inContact then |
615 | tweenService:Create(fill, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(100, 100, 100)}):Play() |
616 | tweenService:Create(circle, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = UDim2.new(2.8, 0, 2.8, 0), ImageColor3 = Color3.fromRGB(100, 100, 100)}):Play() |
617 | else |
618 | tweenService:Create(fill, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play() |
619 | tweenService:Create(circle, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = UDim2.new(0, 0, 0, 0), ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play() |
620 | end |
621 | end |
622 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then |
623 | inContact = false |
624 | inputvalue:ReleaseFocus() |
625 | if not sliding then |
626 | tweenService:Create(fill, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play() |
627 | tweenService:Create(circle, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = UDim2.new(0, 0, 0, 0), ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play() |
628 | end |
629 | end |
630 | end) |
631 | |
632 | inputvalue.FocusLost:connect(function() |
633 | tweenService:Create(circle, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = UDim2.new(0, 0, 0, 0), ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play() |
634 | option:SetValue(tonumber(inputvalue.Text) or option.value) |
635 | end) |
636 | |
637 | function option:SetValue(value) |
638 | value = round(value, option.places) |
639 | value = math.clamp(value, self.min, self.max) |
640 | |
641 | circle:TweenPosition(UDim2.new((value - self.min) / (self.max - self.min), 0, 0.5, 0), "Out", "Quad", 0.1, true) |
642 | if self.min >= 0 then |
643 | fill:TweenSize(UDim2.new((value - self.min) / (self.max - self.min), 0, 1, 0), "Out", "Quad", 0.1, true) |
644 | else |
645 | fill:TweenPosition(UDim2.new((0 - self.min) / (self.max - self.min), 0, 0, 0), "Out", "Quad", 0.1, true) |
646 | fill:TweenSize(UDim2.new(value / (self.max - self.min), 0, 1, 0), "Out", "Quad", 0.1, true) |
647 | end |
648 | |
649 | library.flags[self.flag] = value |
650 | self.value = value |
651 | inputvalue.Text = value |
652 | self.callback(value) |
653 | end |
654 | end |
655 | |
656 | local function createList(option, parent, holder) |
657 | local valueCount = 0 |
658 | |
659 | local main = library:Create("Frame", { |
660 | LayoutOrder = option.position, |
661 | Size = UDim2.new(1, 0, 0, 52), |
662 | BackgroundTransparency = 1, |
663 | Parent = parent.content |
664 | }) |
665 | |
666 | local round = library:Create("ImageLabel", { |
667 | Position = UDim2.new(0, 6, 0, 4), |
668 | Size = UDim2.new(1, -12, 1, -10), |
669 | BackgroundTransparency = 1, |
670 | Image = "rbxassetid://3570695787", |
671 | ImageColor3 = Color3.fromRGB(40, 40, 40), |
672 | ScaleType = Enum.ScaleType.Slice, |
673 | SliceCenter = Rect.new(100, 100, 100, 100), |
674 | SliceScale = 0.02, |
675 | Parent = main |
676 | }) |
677 | |
678 | local title = library:Create("TextLabel", { |
679 | Position = UDim2.new(0, 12, 0, 8), |
680 | Size = UDim2.new(1, -24, 0, 14), |
681 | BackgroundTransparency = 1, |
682 | Text = option.text, |
683 | TextSize = 14, |
684 | Font = Enum.Font.PatrickHand, |
685 | TextColor3 = Color3.fromRGB(140, 140, 140), |
686 | TextXAlignment = Enum.TextXAlignment.Left, |
687 | Parent = main |
688 | }) |
689 | |
690 | local listvalue = library:Create("TextLabel", { |
691 | Position = UDim2.new(0, 12, 0, 20), |
692 | Size = UDim2.new(1, -24, 0, 24), |
693 | BackgroundTransparency = 1, |
694 | Text = option.value, |
695 | TextSize = 18, |
696 | Font = Enum.Font.PatrickHand, |
697 | TextColor3 = Color3.fromRGB(255, 255, 255), |
698 | TextXAlignment = Enum.TextXAlignment.Left, |
699 | Parent = main |
700 | }) |
701 | |
702 | library:Create("ImageLabel", { |
703 | Position = UDim2.new(1, -16, 0, 16), |
704 | Size = UDim2.new(-1, 32, 1, -32), |
705 | SizeConstraint = Enum.SizeConstraint.RelativeYY, |
706 | Rotation = 90, |
707 | BackgroundTransparency = 1, |
708 | Image = "rbxassetid://4918373417", |
709 | ImageColor3 = Color3.fromRGB(140, 140, 140), |
710 | ScaleType = Enum.ScaleType.Fit, |
711 | Parent = round |
712 | }) |
713 | |
714 | option.mainHolder = library:Create("ImageButton", { |
715 | ZIndex = 3, |
716 | Size = UDim2.new(0, 240, 0, 52), |
717 | BackgroundTransparency = 1, |
718 | Image = "rbxassetid://3570695787", |
719 | ImageTransparency = 1, |
720 | ImageColor3 = Color3.fromRGB(30, 30, 30), |
721 | ScaleType = Enum.ScaleType.Slice, |
722 | SliceCenter = Rect.new(100, 100, 100, 100), |
723 | SliceScale = 0.02, |
724 | Visible = false, |
725 | Parent = library.base |
726 | }) |
727 | |
728 | local content = library:Create("ScrollingFrame", { |
729 | ZIndex = 3, |
730 | Size = UDim2.new(1, 0, 1, 0), |
731 | BackgroundTransparency = 1, |
732 | BorderSizePixel = 0, |
733 | ScrollBarImageColor3 = Color3.fromRGB(), |
734 | ScrollBarThickness = 0, |
735 | ScrollingDirection = Enum.ScrollingDirection.Y, |
736 | Parent = option.mainHolder |
737 | }) |
738 | |
739 | library:Create("UIPadding", { |
740 | PaddingTop = UDim.new(0, 6), |
741 | Parent = content |
742 | }) |
743 | |
744 | local layout = library:Create("UIListLayout", { |
745 | Parent = content |
746 | }) |
747 | |
748 | layout.Changed:connect(function() |
749 | option.mainHolder.Size = UDim2.new(0, 240, 0, (valueCount > 4 and (4 * 40) or layout.AbsoluteContentSize.Y) + 12) |
750 | content.CanvasSize = UDim2.new(0, 0, 0, layout.AbsoluteContentSize.Y + 12) |
751 | end) |
752 | |
753 | local inContact |
754 | round.InputBegan:connect(function(input) |
755 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
756 | if library.activePopup then |
757 | library.activePopup:Close() |
758 | end |
759 | local position = main.AbsolutePosition |
760 | option.mainHolder.Position = UDim2.new(0, position.X - 5, 0, position.Y - 10) |
761 | option.open = true |
762 | option.mainHolder.Visible = true |
763 | library.activePopup = option |
764 | content.ScrollBarThickness = 6 |
765 | tweenService:Create(option.mainHolder, TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {ImageTransparency = 0, Position = UDim2.new(0, position.X - 5, 0, position.Y - 4)}):Play() |
766 | tweenService:Create(option.mainHolder, TweenInfo.new(0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0.1), {Position = UDim2.new(0, position.X - 5, 0, position.Y + 1)}):Play() |
767 | for _,label in next, content:GetChildren() do |
768 | if label:IsA"TextLabel" then |
769 | tweenService:Create(label, TweenInfo.new(0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 0, TextTransparency = 0}):Play() |
770 | end |
771 | end |
772 | end |
773 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then |
774 | inContact = true |
775 | if not option.open then |
776 | tweenService:Create(round, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play() |
777 | end |
778 | end |
779 | end) |
780 | |
781 | round.InputEnded:connect(function(input) |
782 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then |
783 | inContact = false |
784 | if not option.open then |
785 | tweenService:Create(round, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(40, 40, 40)}):Play() |
786 | end |
787 | end |
788 | end) |
789 | |
790 | local TAB_CONST = string.rep(' ', 4) |
791 | function option:AddValue(value) |
792 | valueCount = valueCount + 1 |
793 | local label = library:Create("TextLabel", { |
794 | ZIndex = 3, |
795 | Size = UDim2.new(1, 0, 0, 40), |
796 | BackgroundColor3 = Color3.fromRGB(30, 30, 30), |
797 | BorderSizePixel = 0, |
798 | Text = TAB_CONST .. value, |
799 | TextSize = 14, |
800 | TextTransparency = self.open and 0 or 1, |
801 | Font = Enum.Font.Gotham, |
802 | TextColor3 = Color3.fromRGB(255, 255, 255), |
803 | TextXAlignment = Enum.TextXAlignment.Left, |
804 | Parent = content |
805 | }) |
806 | |
807 | local inContact |
808 | local clicking |
809 | label.InputBegan:connect(function(input) |
810 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
811 | clicking = true |
812 | tweenService:Create(label, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(10, 10, 10)}):Play() |
813 | self:SetValue(value) |
814 | end |
815 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then |
816 | inContact = true |
817 | if not clicking then |
818 | tweenService:Create(label, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(20, 20, 20)}):Play() |
819 | end |
820 | end |
821 | end) |
822 | |
823 | label.InputEnded:connect(function(input) |
824 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
825 | clicking = false |
826 | tweenService:Create(label, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = inContact and Color3.fromRGB(20, 20, 20) or Color3.fromRGB(30, 30, 30)}):Play() |
827 | end |
828 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then |
829 | inContact = false |
830 | if not clicking then |
831 | tweenService:Create(label, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(30, 30, 30)}):Play() |
832 | end |
833 | end |
834 | end) |
835 | |
836 | if not table.find(option.values, value) then |
837 | table.insert(option.values, value) |
838 | end |
839 | end |
840 | |
841 | if not table.find(option.values, option.value) then |
842 | option:AddValue(option.value) |
843 | end |
844 | |
845 | for _, value in next, option.values do |
846 | option:AddValue(tostring(value)) |
847 | end |
848 | |
849 | function option:RemoveValue(value) |
850 | for _,label in next, content:GetChildren() do |
851 | if label:IsA"TextLabel" and label.Text == (TAB_CONST .. value) then |
852 | label:Destroy() |
853 | valueCount = valueCount - 1 |
854 | break |
855 | end |
856 | end |
857 | |
858 | if self.value == value then |
859 | self:SetValue("") |
860 | end |
861 | end |
862 | |
863 | function option:SetValue(value) |
864 | library.flags[self.flag] = tostring(value) |
865 | self.value = tostring(value) |
866 | listvalue.Text = self.value |
867 | self.callback(value) |
868 | end |
869 | |
870 | function option:Close() |
871 | library.activePopup = nil |
872 | self.open = false |
873 | content.ScrollBarThickness = 0 |
874 | local position = main.AbsolutePosition |
875 | tweenService:Create(round, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = inContact and Color3.fromRGB(60, 60, 60) or Color3.fromRGB(40, 40, 40)}):Play() |
876 | tweenService:Create(self.mainHolder, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageTransparency = 1, Position = UDim2.new(0, position.X - 5, 0, position.Y -10)}):Play() |
877 | for _,label in next, content:GetChildren() do |
878 | if label:IsA"TextLabel" then |
879 | tweenService:Create(label, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 1, TextTransparency = 1}):Play() |
880 | end |
881 | end |
882 | wait(0.3) |
883 | --delay(0.3, function() |
884 | if not self.open then |
885 | self.mainHolder.Visible = false |
886 | end |
887 | --end) |
888 | end |
889 | |
890 | return option |
891 | end |
892 | |
893 | local function createBox(option, parent) |
894 | local main = library:Create("Frame", { |
895 | LayoutOrder = option.position, |
896 | Size = UDim2.new(1, 0, 0, 52), |
897 | BackgroundTransparency = 1, |
898 | Parent = parent.content |
899 | }) |
900 | |
901 | local outline = library:Create("ImageLabel", { |
902 | Position = UDim2.new(0, 6, 0, 4), |
903 | Size = UDim2.new(1, -12, 1, -10), |
904 | BackgroundTransparency = 1, |
905 | Image = "rbxassetid://3570695787", |
906 | ImageColor3 = Color3.fromRGB(60, 60, 60), |
907 | ScaleType = Enum.ScaleType.Slice, |
908 | SliceCenter = Rect.new(100, 100, 100, 100), |
909 | SliceScale = 0.02, |
910 | Parent = main |
911 | }) |
912 | |
913 | local round = library:Create("ImageLabel", { |
914 | Position = UDim2.new(0, 8, 0, 6), |
915 | Size = UDim2.new(1, -16, 1, -14), |
916 | BackgroundTransparency = 1, |
917 | Image = "rbxassetid://3570695787", |
918 | ImageColor3 = Color3.fromRGB(20, 20, 20), |
919 | ScaleType = Enum.ScaleType.Slice, |
920 | SliceCenter = Rect.new(100, 100, 100, 100), |
921 | SliceScale = 0.01, |
922 | Parent = main |
923 | }) |
924 | |
925 | local title = library:Create("TextLabel", { |
926 | Position = UDim2.new(0, 12, 0, 8), |
927 | Size = UDim2.new(1, -24, 0, 14), |
928 | BackgroundTransparency = 1, |
929 | Text = option.text, |
930 | TextSize = 14, |
931 | Font = Enum.Font.PatrickHand, |
932 | TextColor3 = Color3.fromRGB(100, 100, 100), |
933 | TextXAlignment = Enum.TextXAlignment.Left, |
934 | Parent = main |
935 | }) |
936 | |
937 | local inputvalue = library:Create("TextBox", { |
938 | Position = UDim2.new(0, 12, 0, 20), |
939 | Size = UDim2.new(1, -24, 0, 24), |
940 | BackgroundTransparency = 1, |
941 | Text = option.value, |
942 | TextSize = 18, |
943 | Font = Enum.Font.PatrickHand, |
944 | TextColor3 = Color3.fromRGB(255, 255, 255), |
945 | TextXAlignment = Enum.TextXAlignment.Left, |
946 | TextWrapped = true, |
947 | Parent = main |
948 | }) |
949 | |
950 | local inContact |
951 | local focused |
952 | main.InputBegan:connect(function(input) |
953 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
954 | if not focused then inputvalue:CaptureFocus() end |
955 | end |
956 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then |
957 | inContact = true |
958 | if not focused then |
959 | tweenService:Create(outline, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(100, 100, 100)}):Play() |
960 | end |
961 | end |
962 | end) |
963 | |
964 | main.InputEnded:connect(function(input) |
965 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then |
966 | inContact = false |
967 | if not focused then |
968 | tweenService:Create(outline, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play() |
969 | end |
970 | end |
971 | end) |
972 | |
973 | inputvalue.Focused:connect(function() |
974 | focused = true |
975 | tweenService:Create(outline, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(255, 65, 65)}):Play() |
976 | end) |
977 | |
978 | inputvalue.FocusLost:connect(function(enter) |
979 | focused = false |
980 | tweenService:Create(outline, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play() |
981 | option:SetValue(inputvalue.Text, enter) |
982 | end) |
983 | |
984 | function option:SetValue(value, enter) |
985 | library.flags[self.flag] = tostring(value) |
986 | self.value = tostring(value) |
987 | inputvalue.Text = self.value |
988 | self.callback(value, enter) |
989 | end |
990 | end |
991 | |
992 | local function createColorPickerWindow(option) |
993 | option.mainHolder = library:Create("ImageButton", { |
994 | ZIndex = 3, |
995 | Size = UDim2.new(0, 240, 0, 180), |
996 | BackgroundTransparency = 1, |
997 | Image = "rbxassetid://3570695787", |
998 | ImageTransparency = 1, |
999 | ImageColor3 = Color3.fromRGB(30, 30, 30), |
1000 | ScaleType = Enum.ScaleType.Slice, |
1001 | SliceCenter = Rect.new(100, 100, 100, 100), |
1002 | SliceScale = 0.02, |
1003 | Parent = library.base |
1004 | }) |
1005 | |
1006 | local hue, sat, val = Color3.toHSV(option.color) |
1007 | hue, sat, val = hue == 0 and 1 or hue, sat + 0.005, val - 0.005 |
1008 | local editinghue |
1009 | local editingsatval |
1010 | local currentColor = option.color |
1011 | local previousColors = {[1] = option.color} |
1012 | local originalColor = option.color |
1013 | local rainbowEnabled |
1014 | local rainbowLoop |
1015 | |
1016 | function option:updateVisuals(Color) |
1017 | currentColor = Color |
1018 | self.visualize2.ImageColor3 = Color |
1019 | hue, sat, val = Color3.toHSV(Color) |
1020 | hue = hue == 0 and 1 or hue |
1021 | self.satval.BackgroundColor3 = Color3.fromHSV(hue, 1, 1) |
1022 | self.hueSlider.Position = UDim2.new(1 - hue, 0, 0, 0) |
1023 | self.satvalSlider.Position = UDim2.new(sat, 0, 1 - val, 0) |
1024 | end |
1025 | |
1026 | option.hue = library:Create("ImageLabel", { |
1027 | ZIndex = 3, |
1028 | AnchorPoint = Vector2.new(0, 1), |
1029 | Position = UDim2.new(0, 8, 1, -8), |
1030 | Size = UDim2.new(1, -100, 0, 22), |
1031 | BackgroundTransparency = 1, |
1032 | Image = "rbxassetid://3570695787", |
1033 | ImageTransparency = 1, |
1034 | ScaleType = Enum.ScaleType.Slice, |
1035 | SliceCenter = Rect.new(100, 100, 100, 100), |
1036 | SliceScale = 0.02, |
1037 | Parent = option.mainHolder |
1038 | }) |
1039 | |
1040 | local Gradient = library:Create("UIGradient", { |
1041 | Color = ColorSequence.new({ |
1042 | ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 0, 0)), |
1043 | ColorSequenceKeypoint.new(0.157, Color3.fromRGB(255, 0, 255)), |
1044 | ColorSequenceKeypoint.new(0.323, Color3.fromRGB(0, 0, 255)), |
1045 | ColorSequenceKeypoint.new(0.488, Color3.fromRGB(0, 255, 255)), |
1046 | ColorSequenceKeypoint.new(0.66, Color3.fromRGB(0, 255, 0)), |
1047 | ColorSequenceKeypoint.new(0.817, Color3.fromRGB(255, 255, 0)), |
1048 | ColorSequenceKeypoint.new(1, Color3.fromRGB(255, 0, 0)), |
1049 | }), |
1050 | Parent = option.hue |
1051 | }) |
1052 | |
1053 | option.hueSlider = library:Create("Frame", { |
1054 | ZIndex = 3, |
1055 | Position = UDim2.new(1 - hue, 0, 0, 0), |
1056 | Size = UDim2.new(0, 2, 1, 0), |
1057 | BackgroundTransparency = 1, |
1058 | BackgroundColor3 = Color3.fromRGB(30, 30, 30), |
1059 | BorderColor3 = Color3.fromRGB(255, 255, 255), |
1060 | Parent = option.hue |
1061 | }) |
1062 | |
1063 | option.hue.InputBegan:connect(function(Input) |
1064 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
1065 | editinghue = true |
1066 | X = (option.hue.AbsolutePosition.X + option.hue.AbsoluteSize.X) - option.hue.AbsolutePosition.X |
1067 | X = (Input.Position.X - option.hue.AbsolutePosition.X) / X |
1068 | X = X < 0 and 0 or X > 0.995 and 0.995 or X |
1069 | option:updateVisuals(Color3.fromHSV(1 - X, sat, val)) |
1070 | end |
1071 | end) |
1072 | |
1073 | inputService.InputChanged:connect(function(Input) |
1074 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) and editinghue then |
1075 | X = (option.hue.AbsolutePosition.X + option.hue.AbsoluteSize.X) - option.hue.AbsolutePosition.X |
1076 | X = (Input.Position.X - option.hue.AbsolutePosition.X) / X |
1077 | X = X <= 0 and 0 or X >= 0.995 and 0.995 or X |
1078 | option:updateVisuals(Color3.fromHSV(1 - X, sat, val)) |
1079 | end |
1080 | end) |
1081 | |
1082 | option.hue.InputEnded:connect(function(Input) |
1083 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
1084 | editinghue = false |
1085 | end |
1086 | end) |
1087 | |
1088 | option.satval = library:Create("ImageLabel", { |
1089 | ZIndex = 3, |
1090 | Position = UDim2.new(0, 8, 0, 8), |
1091 | Size = UDim2.new(1, -100, 1, -42), |
1092 | BackgroundTransparency = 1, |
1093 | BackgroundColor3 = Color3.fromHSV(hue, 1, 1), |
1094 | BorderSizePixel = 0, |
1095 | Image = "rbxassetid://4155801252", |
1096 | ImageTransparency = 1, |
1097 | ClipsDescendants = true, |
1098 | Parent = option.mainHolder |
1099 | }) |
1100 | |
1101 | option.satvalSlider = library:Create("Frame", { |
1102 | ZIndex = 3, |
1103 | AnchorPoint = Vector2.new(0.5, 0.5), |
1104 | Position = UDim2.new(sat, 0, 1 - val, 0), |
1105 | Size = UDim2.new(0, 4, 0, 4), |
1106 | Rotation = 45, |
1107 | BackgroundTransparency = 1, |
1108 | BackgroundColor3 = Color3.fromRGB(255, 255, 255), |
1109 | Parent = option.satval |
1110 | }) |
1111 | |
1112 | option.satval.InputBegan:connect(function(Input) |
1113 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
1114 | editingsatval = true |
1115 | X = (option.satval.AbsolutePosition.X + option.satval.AbsoluteSize.X) - option.satval.AbsolutePosition.X |
1116 | Y = (option.satval.AbsolutePosition.Y + option.satval.AbsoluteSize.Y) - option.satval.AbsolutePosition.Y |
1117 | X = (Input.Position.X - option.satval.AbsolutePosition.X) / X |
1118 | Y = (Input.Position.Y - option.satval.AbsolutePosition.Y) / Y |
1119 | X = X <= 0.005 and 0.005 or X >= 1 and 1 or X |
1120 | Y = Y <= 0 and 0 or Y >= 0.995 and 0.995 or Y |
1121 | option:updateVisuals(Color3.fromHSV(hue, X, 1 - Y)) |
1122 | end |
1123 | end) |
1124 | |
1125 | inputService.InputChanged:connect(function(Input) |
1126 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) and editingsatval then |
1127 | X = (option.satval.AbsolutePosition.X + option.satval.AbsoluteSize.X) - option.satval.AbsolutePosition.X |
1128 | Y = (option.satval.AbsolutePosition.Y + option.satval.AbsoluteSize.Y) - option.satval.AbsolutePosition.Y |
1129 | X = (Input.Position.X - option.satval.AbsolutePosition.X) / X |
1130 | Y = (Input.Position.Y - option.satval.AbsolutePosition.Y) / Y |
1131 | X = X <= 0.005 and 0.005 or X >= 1 and 1 or X |
1132 | Y = Y <= 0 and 0 or Y >= 0.995 and 0.995 or Y |
1133 | option:updateVisuals(Color3.fromHSV(hue, X, 1 - Y)) |
1134 | end |
1135 | end) |
1136 | |
1137 | option.satval.InputEnded:connect(function(Input) |
1138 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
1139 | editingsatval = false |
1140 | end |
1141 | end) |
1142 | |
1143 | option.visualize2 = library:Create("ImageLabel", { |
1144 | ZIndex = 3, |
1145 | Position = UDim2.new(1, -8, 0, 8), |
1146 | Size = UDim2.new(0, -80, 0, 80), |
1147 | BackgroundTransparency = 1, |
1148 | Image = "rbxassetid://3570695787", |
1149 | ImageColor3 = currentColor, |
1150 | ScaleType = Enum.ScaleType.Slice, |
1151 | SliceCenter = Rect.new(100, 100, 100, 100), |
1152 | SliceScale = 0.02, |
1153 | Parent = option.mainHolder |
1154 | }) |
1155 | |
1156 | option.resetColor = library:Create("ImageLabel", { |
1157 | ZIndex = 3, |
1158 | Position = UDim2.new(1, -8, 0, 92), |
1159 | Size = UDim2.new(0, -80, 0, 18), |
1160 | BackgroundTransparency = 1, |
1161 | Image = "rbxassetid://3570695787", |
1162 | ImageTransparency = 1, |
1163 | ImageColor3 = Color3.fromRGB(20, 20, 20), |
1164 | ScaleType = Enum.ScaleType.Slice, |
1165 | SliceCenter = Rect.new(100, 100, 100, 100), |
1166 | SliceScale = 0.02, |
1167 | Parent = option.mainHolder |
1168 | }) |
1169 | |
1170 | option.resetText = library:Create("TextLabel", { |
1171 | ZIndex = 3, |
1172 | Size = UDim2.new(1, 0, 1, 0), |
1173 | BackgroundTransparency = 1, |
1174 | Text = "Reset", |
1175 | TextTransparency = 1, |
1176 | Font = Enum.Font.Code, |
1177 | TextSize = 15, |
1178 | TextColor3 = Color3.fromRGB(255, 255, 255), |
1179 | Parent = option.resetColor |
1180 | }) |
1181 | |
1182 | option.resetColor.InputBegan:connect(function(Input) |
1183 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) and not rainbowEnabled then |
1184 | previousColors = {originalColor} |
1185 | option:SetColor(originalColor) |
1186 | end |
1187 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) and not dragging then |
1188 | tweenService:Create(option.resetColor, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(10, 10, 10)}):Play() |
1189 | end |
1190 | end) |
1191 | |
1192 | option.resetColor.InputEnded:connect(function(Input) |
1193 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) and not dragging then |
1194 | tweenService:Create(option.resetColor, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(20, 20, 20)}):Play() |
1195 | end |
1196 | end) |
1197 | |
1198 | option.undoColor = library:Create("ImageLabel", { |
1199 | ZIndex = 3, |
1200 | Position = UDim2.new(1, -8, 0, 112), |
1201 | Size = UDim2.new(0, -80, 0, 18), |
1202 | BackgroundTransparency = 1, |
1203 | Image = "rbxassetid://3570695787", |
1204 | ImageTransparency = 1, |
1205 | ImageColor3 = Color3.fromRGB(20, 20, 20), |
1206 | ScaleType = Enum.ScaleType.Slice, |
1207 | SliceCenter = Rect.new(100, 100, 100, 100), |
1208 | SliceScale = 0.02, |
1209 | Parent = option.mainHolder |
1210 | }) |
1211 | |
1212 | option.undoText = library:Create("TextLabel", { |
1213 | ZIndex = 3, |
1214 | Size = UDim2.new(1, 0, 1, 0), |
1215 | BackgroundTransparency = 1, |
1216 | Text = "Undo", |
1217 | TextTransparency = 1, |
1218 | Font = Enum.Font.Code, |
1219 | TextSize = 15, |
1220 | TextColor3 = Color3.fromRGB(255, 255, 255), |
1221 | Parent = option.undoColor |
1222 | }) |
1223 | |
1224 | option.undoColor.InputBegan:connect(function(Input) |
1225 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) and not rainbowEnabled then |
1226 | local Num = #previousColors == 1 and 0 or 1 |
1227 | option:SetColor(previousColors[#previousColors - Num]) |
1228 | if #previousColors ~= 1 then |
1229 | table.remove(previousColors, #previousColors) |
1230 | end |
1231 | end |
1232 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) and not dragging then |
1233 | tweenService:Create(option.undoColor, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(10, 10, 10)}):Play() |
1234 | end |
1235 | end) |
1236 | |
1237 | option.undoColor.InputEnded:connect(function(Input) |
1238 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) and not dragging then |
1239 | tweenService:Create(option.undoColor, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(20, 20, 20)}):Play() |
1240 | end |
1241 | end) |
1242 | |
1243 | option.setColor = library:Create("ImageLabel", { |
1244 | ZIndex = 3, |
1245 | Position = UDim2.new(1, -8, 0, 132), |
1246 | Size = UDim2.new(0, -80, 0, 18), |
1247 | BackgroundTransparency = 1, |
1248 | Image = "rbxassetid://3570695787", |
1249 | ImageTransparency = 1, |
1250 | ImageColor3 = Color3.fromRGB(20, 20, 20), |
1251 | ScaleType = Enum.ScaleType.Slice, |
1252 | SliceCenter = Rect.new(100, 100, 100, 100), |
1253 | SliceScale = 0.02, |
1254 | Parent = option.mainHolder |
1255 | }) |
1256 | |
1257 | option.setText = library:Create("TextLabel", { |
1258 | ZIndex = 3, |
1259 | Size = UDim2.new(1, 0, 1, 0), |
1260 | BackgroundTransparency = 1, |
1261 | Text = "Set", |
1262 | TextTransparency = 1, |
1263 | Font = Enum.Font.Code, |
1264 | TextSize = 15, |
1265 | TextColor3 = Color3.fromRGB(255, 255, 255), |
1266 | Parent = option.setColor |
1267 | }) |
1268 | |
1269 | option.setColor.InputBegan:connect(function(Input) |
1270 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) and not rainbowEnabled then |
1271 | table.insert(previousColors, currentColor) |
1272 | option:SetColor(currentColor) |
1273 | end |
1274 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) and not dragging then |
1275 | tweenService:Create(option.setColor, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(10, 10, 10)}):Play() |
1276 | end |
1277 | end) |
1278 | |
1279 | option.setColor.InputEnded:connect(function(Input) |
1280 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) and not dragging then |
1281 | tweenService:Create(option.setColor, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(20, 20, 20)}):Play() |
1282 | end |
1283 | end) |
1284 | |
1285 | option.rainbow = library:Create("ImageLabel", { |
1286 | ZIndex = 3, |
1287 | Position = UDim2.new(1, -8, 0, 152), |
1288 | Size = UDim2.new(0, -80, 0, 18), |
1289 | BackgroundTransparency = 1, |
1290 | Image = "rbxassetid://3570695787", |
1291 | ImageTransparency = 1, |
1292 | ImageColor3 = Color3.fromRGB(20, 20, 20), |
1293 | ScaleType = Enum.ScaleType.Slice, |
1294 | SliceCenter = Rect.new(100, 100, 100, 100), |
1295 | SliceScale = 0.02, |
1296 | Parent = option.mainHolder |
1297 | }) |
1298 | |
1299 | option.rainbowText = library:Create("TextLabel", { |
1300 | ZIndex = 3, |
1301 | Size = UDim2.new(1, 0, 1, 0), |
1302 | BackgroundTransparency = 1, |
1303 | Text = "Rainbow", |
1304 | TextTransparency = 1, |
1305 | Font = Enum.Font.Code, |
1306 | TextSize = 15, |
1307 | TextColor3 = Color3.fromRGB(255, 255, 255), |
1308 | Parent = option.rainbow |
1309 | }) |
1310 | |
1311 | option.rainbow.InputBegan:connect(function(Input) |
1312 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
1313 | rainbowEnabled = not rainbowEnabled |
1314 | if rainbowEnabled then |
1315 | rainbowLoop = runService.Heartbeat:connect(function() |
1316 | option:SetColor(chromaColor) |
1317 | option.rainbowText.TextColor3 = chromaColor |
1318 | end) |
1319 | else |
1320 | rainbowLoop:Disconnect() |
1321 | option:SetColor(previousColors[#previousColors]) |
1322 | option.rainbowText.TextColor3 = Color3.fromRGB(255, 255, 255) |
1323 | end |
1324 | end |
1325 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) and not dragging then |
1326 | tweenService:Create(option.rainbow, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(10, 10, 10)}):Play() |
1327 | end |
1328 | end) |
1329 | |
1330 | option.rainbow.InputEnded:connect(function(Input) |
1331 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) and not dragging then |
1332 | tweenService:Create(option.rainbow, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(20, 20, 20)}):Play() |
1333 | end |
1334 | end) |
1335 | |
1336 | return option |
1337 | end |
1338 | |
1339 | local function createColor(option, parent, holder) |
1340 | option.main = library:Create("TextLabel", { |
1341 | LayoutOrder = option.position, |
1342 | Size = UDim2.new(1, 0, 0, 31), |
1343 | BackgroundTransparency = 1, |
1344 | Text = " " .. option.text, |
1345 | TextSize = 17, |
1346 | Font = Enum.Font.Gotham, |
1347 | TextColor3 = Color3.fromRGB(255, 255, 255), |
1348 | TextXAlignment = Enum.TextXAlignment.Left, |
1349 | Parent = parent.content |
1350 | }) |
1351 | |
1352 | local colorBoxOutline = library:Create("ImageLabel", { |
1353 | Position = UDim2.new(1, -6, 0, 4), |
1354 | Size = UDim2.new(-1, 10, 1, -10), |
1355 | SizeConstraint = Enum.SizeConstraint.RelativeYY, |
1356 | BackgroundTransparency = 1, |
1357 | Image = "rbxassetid://3570695787", |
1358 | ImageColor3 = Color3.fromRGB(100, 100, 100), |
1359 | ScaleType = Enum.ScaleType.Slice, |
1360 | SliceCenter = Rect.new(100, 100, 100, 100), |
1361 | SliceScale = 0.02, |
1362 | Parent = option.main |
1363 | }) |
1364 | |
1365 | option.visualize = library:Create("ImageLabel", { |
1366 | Position = UDim2.new(0, 2, 0, 2), |
1367 | Size = UDim2.new(1, -4, 1, -4), |
1368 | BackgroundTransparency = 1, |
1369 | Image = "rbxassetid://3570695787", |
1370 | ImageColor3 = option.color, |
1371 | ScaleType = Enum.ScaleType.Slice, |
1372 | SliceCenter = Rect.new(100, 100, 100, 100), |
1373 | SliceScale = 0.02, |
1374 | Parent = colorBoxOutline |
1375 | }) |
1376 | |
1377 | local inContact |
1378 | option.main.InputBegan:connect(function(input) |
1379 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
1380 | if not option.mainHolder then createColorPickerWindow(option) end |
1381 | if library.activePopup then |
1382 | library.activePopup:Close() |
1383 | end |
1384 | local position = option.main.AbsolutePosition |
1385 | option.mainHolder.Position = UDim2.new(0, position.X - 5, 0, position.Y - 10) |
1386 | option.open = true |
1387 | option.mainHolder.Visible = true |
1388 | library.activePopup = option |
1389 | tweenService:Create(option.mainHolder, TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {ImageTransparency = 0, Position = UDim2.new(0, position.X - 5, 0, position.Y - 4)}):Play() |
1390 | tweenService:Create(option.mainHolder, TweenInfo.new(0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0.1), {Position = UDim2.new(0, position.X - 5, 0, position.Y + 1)}):Play() |
1391 | tweenService:Create(option.satval, TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {BackgroundTransparency = 0}):Play() |
1392 | for _,object in next, option.mainHolder:GetDescendants() do |
1393 | if object:IsA"TextLabel" then |
1394 | tweenService:Create(object, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextTransparency = 0}):Play() |
1395 | elseif object:IsA"ImageLabel" then |
1396 | tweenService:Create(object, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageTransparency = 0}):Play() |
1397 | elseif object:IsA"Frame" then |
1398 | tweenService:Create(object, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 0}):Play() |
1399 | end |
1400 | end |
1401 | end |
1402 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then |
1403 | inContact = true |
1404 | if not option.open then |
1405 | tweenService:Create(colorBoxOutline, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(140, 140, 140)}):Play() |
1406 | end |
1407 | end |
1408 | end) |
1409 | |
1410 | option.main.InputEnded:connect(function(input) |
1411 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then |
1412 | inContact = true |
1413 | if not option.open then |
1414 | tweenService:Create(colorBoxOutline, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(100, 100, 100)}):Play() |
1415 | end |
1416 | end |
1417 | end) |
1418 | |
1419 | function option:SetColor(newColor) |
1420 | if self.mainHolder then |
1421 | self:updateVisuals(newColor) |
1422 | end |
1423 | self.visualize.ImageColor3 = newColor |
1424 | library.flags[self.flag] = newColor |
1425 | self.color = newColor |
1426 | self.callback(newColor) |
1427 | end |
1428 | |
1429 | function option:Close() |
1430 | library.activePopup = nil |
1431 | self.open = false |
1432 | local position = self.main.AbsolutePosition |
1433 | tweenService:Create(self.mainHolder, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageTransparency = 1, Position = UDim2.new(0, position.X - 5, 0, position.Y - 10)}):Play() |
1434 | tweenService:Create(self.satval, TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {BackgroundTransparency = 1}):Play() |
1435 | for _,object in next, self.mainHolder:GetDescendants() do |
1436 | if object:IsA"TextLabel" then |
1437 | tweenService:Create(object, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextTransparency = 1}):Play() |
1438 | elseif object:IsA"ImageLabel" then |
1439 | tweenService:Create(object, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageTransparency = 1}):Play() |
1440 | elseif object:IsA"Frame" then |
1441 | tweenService:Create(object, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 1}):Play() |
1442 | end |
1443 | end |
1444 | delay(0.3, function() |
1445 | if not self.open then |
1446 | self.mainHolder.Visible = false |
1447 | end |
1448 | end) |
1449 | end |
1450 | end |
1451 | |
1452 | local function createDivider(option, parent, holder) |
1453 | option.main = library:Create('Frame', { |
1454 | LayoutOrder = option.position, |
1455 | BackgroundTransparency = 1, |
1456 | |
1457 | Size = UDim2.new(1, 0, 0, 6), |
1458 | Parent = parent.content; |
1459 | }) |
1460 | |
1461 | option.divider = library:Create('Frame', { |
1462 | AnchorPoint = Vector2.new(0.5, 0.5), |
1463 | Position = UDim2.fromScale(0.5, 0.5), |
1464 | |
1465 | BorderSizePixel = 0, |
1466 | BorderColor3 = Color3.fromRGB(50, 50, 50), |
1467 | BackgroundColor3 = Color3.fromRGB(50, 50, 50), |
1468 | |
1469 | Size = UDim2.new(1, -10, 0, 2), |
1470 | Parent = option.main, |
1471 | }) |
1472 | end |
1473 | |
1474 | local function loadOptions(option, holder) |
1475 | for _,newOption in next, option.options do |
1476 | if newOption.type == "label" then |
1477 | createLabel(newOption, option) |
1478 | elseif newOption.type == "toggle" then |
1479 | createToggle(newOption, option) |
1480 | elseif newOption.type == "button" then |
1481 | createButton(newOption, option) |
1482 | elseif newOption.type == "list" then |
1483 | createList(newOption, option, holder) |
1484 | elseif newOption.type == "box" then |
1485 | createBox(newOption, option) |
1486 | elseif newOption.type == "bind" then |
1487 | createBind(newOption, option) |
1488 | elseif newOption.type == "slider" then |
1489 | createSlider(newOption, option) |
1490 | elseif newOption.type == "color" then |
1491 | createColor(newOption, option, holder) |
1492 | elseif newOption.type == 'divider' then |
1493 | createDivider(newOption, option, holder) |
1494 | elseif newOption.type == "folder" then |
1495 | newOption:init() |
1496 | end |
1497 | end |
1498 | end |
1499 | |
1500 | local function getFnctions(parent) |
1501 | function parent:AddLabel(option) |
1502 | option = typeof(option) == "table" and option or {} |
1503 | option.text = tostring(option.text) |
1504 | option.type = "label" |
1505 | option.position = #self.options |
1506 | table.insert(self.options, option) |
1507 | |
1508 | return option |
1509 | end |
1510 | |
1511 | function parent:AddDivider(option) |
1512 | option = type(option) == 'table' and option or {} |
1513 | option.type = 'divider' |
1514 | option.position = #self.options |
1515 | table.insert(self.options, option) |
1516 | |
1517 | return options |
1518 | end |
1519 | |
1520 | function parent:AddToggle(option) |
1521 | option = typeof(option) == "table" and option or {} |
1522 | option.text = tostring(option.text) |
1523 | option.state = typeof(option.state) == "boolean" and option.state or false |
1524 | option.callback = typeof(option.callback) == "function" and option.callback or function() end |
1525 | option.type = "toggle" |
1526 | option.position = #self.options |
1527 | option.flag = option.flag or option.text |
1528 | library.flags[option.flag] = option.state |
1529 | table.insert(self.options, option) |
1530 | |
1531 | return option |
1532 | end |
1533 | |
1534 | function parent:AddButton(option) |
1535 | option = typeof(option) == "table" and option or {} |
1536 | option.text = tostring(option.text) |
1537 | option.callback = typeof(option.callback) == "function" and option.callback or function() end |
1538 | option.type = "button" |
1539 | option.position = #self.options |
1540 | option.flag = option.flag or option.text |
1541 | table.insert(self.options, option) |
1542 | |
1543 | return option |
1544 | end |
1545 | |
1546 | function parent:AddBind(option) |
1547 | option = typeof(option) == "table" and option or {} |
1548 | option.text = tostring(option.text) |
1549 | option.key = (option.key and option.key.Name) or option.key or "F" |
1550 | option.hold = typeof(option.hold) == "boolean" and option.hold or false |
1551 | option.callback = typeof(option.callback) == "function" and option.callback or function() end |
1552 | option.type = "bind" |
1553 | option.position = #self.options |
1554 | option.flag = option.flag or option.text |
1555 | library.flags[option.flag] = option.key |
1556 | table.insert(self.options, option) |
1557 | |
1558 | return option |
1559 | end |
1560 | |
1561 | function parent:AddSlider(option) |
1562 | option = typeof(option) == "table" and option or {} |
1563 | option.text = tostring(option.text) |
1564 | option.min = typeof(option.min) == "number" and option.min or 0 |
1565 | option.max = typeof(option.max) == "number" and option.max or 0 |
1566 | option.dual = typeof(option.dual) == "boolean" and option.dual or false |
1567 | option.value = math.clamp(typeof(option.value) == "number" and option.value or option.min, option.min, option.max) |
1568 | option.value2 = typeof(option.value2) == "number" and option.value2 or option.max |
1569 | option.callback = typeof(option.callback) == "function" and option.callback or function() end |
1570 | option.float = typeof(option.value) == "number" and option.float or 1 |
1571 | option.type = "slider" |
1572 | option.position = #self.options |
1573 | option.flag = option.flag or option.text |
1574 | library.flags[option.flag] = option.value |
1575 | table.insert(self.options, option) |
1576 | |
1577 | if type(option.float) == 'number' then |
1578 | local _ = '' .. option.float; |
1579 | local num = select(2, _:gsub('%d', function(c) return c end)) |
1580 | |
1581 | option.places = math.max(1, num - 1) |
1582 | -- :) |
1583 | else |
1584 | option.places = 1; |
1585 | end |
1586 | |
1587 | return option |
1588 | end |
1589 | |
1590 | function parent:AddList(option) |
1591 | option = typeof(option) == "table" and option or {} |
1592 | option.text = tostring(option.text) |
1593 | option.values = typeof(option.values) == "table" and option.values or {} |
1594 | option.value = tostring(option.value or option.values[1] or "") |
1595 | option.callback = typeof(option.callback) == "function" and option.callback or function() end |
1596 | option.open = false |
1597 | option.type = "list" |
1598 | option.position = #self.options |
1599 | option.flag = option.flag or option.text |
1600 | library.flags[option.flag] = option.value |
1601 | table.insert(self.options, option) |
1602 | |
1603 | return option |
1604 | end |
1605 | |
1606 | function parent:AddBox(option) |
1607 | option = typeof(option) == "table" and option or {} |
1608 | option.text = tostring(option.text) |
1609 | option.value = tostring(option.value or "") |
1610 | option.callback = typeof(option.callback) == "function" and option.callback or function() end |
1611 | option.type = "box" |
1612 | option.position = #self.options |
1613 | option.flag = option.flag or option.text |
1614 | library.flags[option.flag] = option.value |
1615 | table.insert(self.options, option) |
1616 | |
1617 | return option |
1618 | end |
1619 | |
1620 | function parent:AddColor(option) |
1621 | option = typeof(option) == "table" and option or {} |
1622 | option.text = tostring(option.text) |
1623 | option.color = typeof(option.color) == "table" and Color3.new(tonumber(option.color[1]), tonumber(option.color[2]), tonumber(option.color[3])) or option.color or Color3.new(255, 255, 255) |
1624 | option.callback = typeof(option.callback) == "function" and option.callback or function() end |
1625 | option.open = false |
1626 | option.type = "color" |
1627 | option.position = #self.options |
1628 | option.flag = option.flag or option.text |
1629 | library.flags[option.flag] = option.color |
1630 | table.insert(self.options, option) |
1631 | |
1632 | return option |
1633 | end |
1634 | |
1635 | function parent:AddFolder(title) |
1636 | local option = {} |
1637 | option.title = tostring(title) |
1638 | option.options = {} |
1639 | option.open = false |
1640 | option.type = "folder" |
1641 | option.position = #self.options |
1642 | table.insert(self.options, option) |
1643 | |
1644 | getFnctions(option) |
1645 | |
1646 | function option:init() |
1647 | createOptionHolder(self.title, parent.content, self, true) |
1648 | loadOptions(self, parent) |
1649 | end |
1650 | |
1651 | return option |
1652 | end |
1653 | end |
1654 | |
1655 | function library:CreateWindow(title) |
1656 | local window = {title = tostring(title), options = {}, open = true, canInit = true, init = false, position = #self.windows} |
1657 | getFnctions(window) |
1658 | |
1659 | table.insert(library.windows, window) |
1660 | |
1661 | return window |
1662 | end |
1663 | |
1664 | local UIToggle |
1665 | local UnlockMouse |
1666 | function library:Init() |
1667 | |
1668 | self.base = self.base or self:Create("ScreenGui") |
1669 | if (syn and syn.protect_gui) then |
1670 | syn.protect_gui(self.base) |
1671 | self.base.Parent = game:GetService"CoreGui" |
1672 | elseif type(get_hidden_gui) == 'function' then |
1673 | self.base.Parent = get_hidden_gui() |
1674 | elseif type(gethui) == 'function' then |
1675 | self.base.Parent = gethui() |
1676 | else |
1677 | self.base.Name = tostring(math.random()) |
1678 | self.base.Parent = game:GetService"CoreGui" |
1679 | end |
1680 | |
1681 | |
1682 | self.cursor = self.cursor or self:Create("Frame", { |
1683 | ZIndex = 100, |
1684 | AnchorPoint = Vector2.new(0, 0), |
1685 | Size = UDim2.new(0, 5, 0, 5), |
1686 | BackgroundColor3 = Color3.fromRGB(255, 255, 255), |
1687 | Parent = self.base |
1688 | }) |
1689 | |
1690 | for _, window in next, self.windows do |
1691 | if window.canInit and not window.init then |
1692 | window.init = true |
1693 | createOptionHolder(window.title, self.base, window) |
1694 | loadOptions(window) |
1695 | end |
1696 | end |
1697 | end |
1698 | |
1699 | function library:Close() |
1700 | self.open = not self.open |
1701 | self.cursor.Visible = self.open |
1702 | if self.activePopup then |
1703 | self.activePopup:Close() |
1704 | end |
1705 | for _, window in next, self.windows do |
1706 | if window.main then |
1707 | window.main.Visible = self.open |
1708 | end |
1709 | end |
1710 | end |
1711 | |
1712 | inputService.InputBegan:connect(function(input) |
1713 | if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then |
1714 | if library.activePopup then |
1715 | if input.Position.X < library.activePopup.mainHolder.AbsolutePosition.X or input.Position.Y < library.activePopup.mainHolder.AbsolutePosition.Y then |
1716 | library.activePopup:Close() |
1717 | end |
1718 | end |
1719 | if library.activePopup then |
1720 | if input.Position.X > library.activePopup.mainHolder.AbsolutePosition.X + library.activePopup.mainHolder.AbsoluteSize.X or input.Position.Y > library.activePopup.mainHolder.AbsolutePosition.Y + library.activePopup.mainHolder.AbsoluteSize.Y then |
1721 | library.activePopup:Close() |
1722 | end |
1723 | end |
1724 | end |
1725 | end) |
1726 | |
1727 | inputService.InputChanged:connect(function(input) |
1728 | if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) and library.cursor then |
1729 | local mouse = inputService:GetMouseLocation() + Vector2.new(0, -36) |
1730 | library.cursor.Position = UDim2.new(0, mouse.X - 2, 0, mouse.Y - 2) |
1731 | end |
1732 | if input == dragInput and dragging then |
1733 | update(input) |
1734 | end |
1735 | end) |
1736 | |
1737 | return library |