-
Notifications
You must be signed in to change notification settings - Fork 319
/
Owl Hub UI Lib
728 lines (618 loc) · 28.4 KB
/
Owl Hub UI Lib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
local OwlLib = {Content = {}};
local config = {};
local placeID = tostring(game.PlaceId);
local httpService = game:GetService("HttpService");
pcall(function()
config = httpService:JSONDecode(readfile(placeID .. ".txt"));
end);
local function saveConfig()
writefile(placeID .. ".txt", httpService:JSONEncode(config));
end;
local oldScript = script;
local popupGui = game:GetObjects("rbxassetid://4743303040")[1];
popupGui.Parent = game:GetService("CoreGui");
popupGui.Name = httpService:GenerateGUID(false);
script = popupGui.mainScript;
local popup = loadstring(popupGui.mainScript.Source)();
script = oldScript;
local owlLibGui = game:GetObjects("rbxassetid://4530443679")[1];
owlLibGui.Parent = game:GetService("CoreGui");
owlLibGui.Name = httpService:GenerateGUID(false);
local mainFrame = owlLibGui.mainFrame;
local tweenService = game:GetService("TweenService");
local inputService = game:GetService("UserInputService");
local firstBodyFrame;
local startPos;
local dragging = false;
local draggableInput;
local draggableStart;
local mouse = game:GetService("Players").LocalPlayer:GetMouse();
local clamp = math.clamp;
local floor = math.floor;
local fromHSV = Color3.fromHSV;
local fromRGB = Color3.fromRGB;
local newUDim2 = UDim2.new;
mainFrame.topBarFrame.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
dragging = true;
draggableStart = input.Position;
startPos = mainFrame.AbsolutePosition;
end;
end);
mainFrame.topBarFrame.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
dragging = false;
end;
end);
inputService.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement and dragging then
mainFrame.Position = newUDim2(0, startPos.X + (input.Position.X - draggableStart.X), 0, startPos.Y + (input.Position.Y - draggableStart.Y));
end;
end);
local exitTween = tweenService:Create(mainFrame.topBarFrame.exitBtn, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageTransparency = 0});
local exitTween1 = tweenService:Create(mainFrame.topBarFrame.exitBtn, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageTransparency = 0.2});
local miniTween = tweenService:Create(mainFrame.topBarFrame.miniBtn, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageTransparency = 0});
local miniTween2 = tweenService:Create(mainFrame.topBarFrame.miniBtn, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageTransparency = 0.2});
mainFrame.topBarFrame.exitBtn.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
exitTween:Play();
end;
end);
mainFrame.topBarFrame.exitBtn.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
exitTween1:Play();
end;
end);
mainFrame.topBarFrame.exitBtn.MouseButton1Click:Connect(function()
mainFrame:TweenSize(newUDim2(0, 387, 0, 27), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25);
wait(0.25);
mainFrame.topBarFrame:TweenSize(newUDim2(0, 0, 0, 27), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25);
mainFrame:TweenSize(newUDim2(0, 0, 0, 27), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25);
wait(0.25);
owlLibGui:Destroy();
end);
mainFrame.topBarFrame.miniBtn.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
miniTween:Play();
end;
end);
mainFrame.topBarFrame.miniBtn.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
miniTween2:Play();
end;
end);
mainFrame.topBarFrame.miniBtn.MouseButton1Click:Connect(function()
if mainFrame.Size ~= newUDim2(0, 387, 0, 27) then
mainFrame:TweenSize(newUDim2(0, 387, 0, 27), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, true);
else
mainFrame:TweenSize(newUDim2(0, 387, 0, 225), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, true);
end;
end);
inputService.InputBegan:Connect(function(input, onGui)
if not onGui and (input.KeyCode == Enum.KeyCode.P or input.KeyCode == Enum.KeyCode.RightShift) then
owlLibGui.Enabled = not owlLibGui.Enabled;
end;
end);
function OwlLib:SetCategory() end;
function OwlLib.Content:Resize(scrollingFrame)
scrollingFrame.CanvasSize = newUDim2(0, 0, 0, (#scrollingFrame:GetChildren() - 1) * 36);
end;
function OwlLib.Content:Ripple(btn)
spawn(function()
local rippleEffect = Instance.new("ImageLabel", btn);
local rippleEffectInner = Instance.new("ImageLabel", rippleEffect);
rippleEffect.Name = "rippleEffect";
rippleEffect.BackgroundTransparency = 1;
rippleEffect.BorderSizePixel = 0;
rippleEffect.Image = "rbxassetid://2708891598";
rippleEffect.ImageColor3 = fromRGB(244, 244, 244);
rippleEffect.ImageTransparency = 0.7;
rippleEffect.ScaleType = Enum.ScaleType.Fit;
rippleEffectInner.Name = "rippleEffect";
rippleEffectInner.AnchorPoint = Vector2.new(0.5, 0.5);
rippleEffectInner.BackgroundTransparency = 1;
rippleEffectInner.BorderSizePixel = 0;
rippleEffectInner.Position = newUDim2(0.5, 0, 0.5, 0);
rippleEffectInner.Size = newUDim2(0.93, 0, 0.93, 0);
rippleEffectInner.Image = "rbxassetid://2708891598";
rippleEffectInner.ImageColor3 = fromRGB(45, 45, 45);
rippleEffectInner.ImageTransparency = 0.7;
rippleEffectInner.ScaleType = Enum.ScaleType.Fit;
rippleEffect.Position = newUDim2(0, mouse.X - rippleEffect.AbsolutePosition.X, 0, mouse.Y - rippleEffect.AbsolutePosition.Y);
rippleEffect:TweenSizeAndPosition(newUDim2(10, 0, 10, 0), newUDim2(-4.5, 0, -4.5, 0), "Out", "Quad", 0.33);
for i = 1, 10 do
rippleEffect.ImageTransparency = rippleEffect.ImageTransparency + 0.01;
wait();
end;
rippleEffect:Destroy();
end)
end;
function OwlLib.Content:initBtnEffect(btn)
local btnHover = tweenService:Create(btn, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 0.85});
local btnHover1 = tweenService:Create(btn, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 1});
btn.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
btnHover:Play();
end;
end);
btn.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
btnHover1:Play();
end;
end);
end;
function OwlLib:new(title)
local self = setmetatable({}, {__index = self.Content});
self.bodyFrame = game:GetObjects("rbxassetid://4531111462")[1];
self.bodyFrame.Parent = mainFrame;
self.bodyFrame.Name = title .. "BodyFrame";
self.bodyFrame.Visible = false;
local tabBtn = game:GetObjects("rbxassetid://4530456835")[1];
tabBtn.Parent = mainFrame.tabsFrame;
tabBtn.tabLabel.Text = title;
tabBtn.Size = newUDim2(0, tabBtn.tabLabel.TextBounds.X + 20, 1, 0, 0);
if not firstBodyFrame then
firstBodyFrame = self.bodyFrame;
self.bodyFrame.Visible = true;
tabBtn.ImageColor3 = fromRGB(30, 30, 30);
end;
--[[tabBtn.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement and tabBtn.ImageColor3 ~= fromRGB(50, 50, 50) then
tweenService:Create(tabBtn, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = fromRGB(40, 40, 40)}):Play();
end;
end);
tabBtn.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement and tabBtn.ImageColor3 ~= fromRGB(50, 50, 50) then
tweenService:Create(tabBtn, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = fromRGB(30, 30, 30)}):Play();
end;
end);]]
tabBtn.MouseButton1Click:Connect(function()
for i, v in next, mainFrame:GetChildren() do
if v.Name:find("BodyFrame") then
if v ~= self.bodyFrame then
v.Visible = false;
end;
end;
end;
for i, v in next, mainFrame.tabsFrame:GetChildren() do
if v:IsA("ImageButton") then
v.ImageColor3 = fromRGB(50, 50, 50);
end;
end;
tabBtn.ImageColor3 = fromRGB(30, 30, 30);
self.bodyFrame.Visible = true;
end);
return self;
end;
function OwlLib.Content:newBtn(title, callback, noToggle)
self:Resize(self.bodyFrame);
if not noToggle then
local enabled = config[title] and true or false;
if enabled then
callback(enabled);
popup:new("Enabled " .. title);
end;
local btn = game:GetObjects("rbxassetid://4531129509")[1];
btn.Parent = self.bodyFrame;
btn.titleLabel.Text = title;
btn.titleLabel.Size = newUDim2(0, btn.titleLabel.TextBounds.X, 1, 0);
btn.Size = newUDim2(0, btn.titleLabel.Size.X.Offset + 50, 0, 30);
self:initBtnEffect(btn);
local toggle = {
[true] = fromRGB(0, 194, 94),
[false] = fromRGB(180, 0, 0)
};
tweenService:Create(btn.statusFrame, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = toggle[enabled]}):Play();
btn.MouseButton1Click:Connect(function()
self:Ripple(btn);
enabled = not enabled;
config[title] = enabled;
saveConfig();
tweenService:Create(btn.statusFrame, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = toggle[enabled]}):Play();
callback(enabled);
popup:new((enabled and "Enabled " or "Disabled ") .. title);
end);
return {
Set = function(self, bool)
enabled = bool;
if not noToggle then
config[title] = enabled;
saveConfig();
tweenService:Create(btn.statusFrame, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = toggle[enabled]}):Play();
callback(enabled);
popup:new((enabled and "Enabled " or "Disabled ") .. title);
end;
end;
};
elseif noToggle then
local btn = game:GetObjects("rbxassetid://4531209476")[1];
btn.Parent = self.bodyFrame;
btn.titleLabel.Text = title;
btn.titleLabel.Size = newUDim2(0, btn.titleLabel.TextBounds.X, 1, 0);
btn.Size = newUDim2(0, btn.titleLabel.Size.X.Offset + 17, 0, 30);
self:initBtnEffect(btn);
btn.MouseButton1Click:Connect(function()
self:Ripple(btn);
callback();
popup:new("Enabled " .. title);
end);
return {
Fire = function(self)
callback();
popup:new("Enabled " .. title);
end;
};
end;
end;
function OwlLib.Content:newSlider(title, callback, min, max, startPoint)
self:Resize(self.bodyFrame);
local dragging = false;
local sliderFrame = game:GetObjects("rbxassetid://4531326550")[1];
sliderFrame.Parent = self.bodyFrame;
sliderFrame.titleLabel.Text = title;
sliderFrame.titleLabel.Size = newUDim2(0, sliderFrame.titleLabel.TextBounds.X, 1, 0);
sliderFrame.Size = newUDim2(0, sliderFrame.titleLabel.Size.X.Offset + 195, 0, 30);
local startPoint = config[title] and tonumber(config[title]) or startPoint;
local sliderIndicatorFrame = sliderFrame.sliderIndicatorFrame;
sliderIndicatorFrame.valueLabel.Text = tostring(startPoint and floor((startPoint / max) * (max - min) + min) or 0);
local slidingFrame = sliderFrame.sliderIndicatorFrame.slidingFrame;
slidingFrame.Size = newUDim2((startPoint or 0) / max, 0, 1, 0);
if startPoint then
local callbackValue = floor((startPoint / max) * (max - min) + min);
callback(callbackValue);
if config[title] then
popup:new("Set " .. title .. " to " .. tostring(callbackValue));
end;
end;
local function slide(input)
local pos = newUDim2(clamp((input.Position.X - sliderIndicatorFrame.AbsolutePosition.X) / sliderIndicatorFrame.AbsoluteSize.X, 0, 1), 0, 1, 0);
slidingFrame:TweenSize(pos, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
local value = floor(((pos.X.Scale * max) / max) * (max - min) + min);
sliderIndicatorFrame.valueLabel.Text = tostring(value);
callback(value);
end;
sliderIndicatorFrame.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
slide(input);
dragging = true;
end;
end);
sliderIndicatorFrame.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
dragging = false;
config[title] = sliderIndicatorFrame.valueLabel.Text;
saveConfig();
popup:new("Set " .. title .. " to " .. sliderIndicatorFrame.valueLabel.Text);
end;
end);
inputService.InputChanged:Connect(function(input)
if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
slide(input);
end;
end);
end;
function OwlLib.Content:newTextbox(title, callback, presetText, noCallbackOnStart)
self:Resize(self.bodyFrame);
local btn = game:GetObjects("rbxassetid://4531463561")[1];
btn.Parent = self.bodyFrame;
btn.titleLabel.Text = title;
btn.titleLabel.Size = newUDim2(0, btn.titleLabel.TextBounds.X, 1, 0);
btn.Size = newUDim2(0, btn.titleLabel.Size.X.Offset + 100, 0, 30);
local presetText = (config[title] and config[title]) or (presetText and presetText or "");
if config[title] then
popup:new("Set " .. title .. " to " .. config[title]);
end;
btn.inputBox.Text = presetText;
if not noCallbackOnStart then
callback(presetText);
end;
btn.inputBox.FocusLost:Connect(function()
config[title] = btn.inputBox.Text;
saveConfig();
callback(btn.inputBox.Text);
popup:new("Set " .. title .. " to " .. btn.inputBox.Text);
end);
end;
function OwlLib.Content:newBind(title, callback, presetKeyCode)
self:Resize(self.bodyFrame);
local enabled = false;
local listening = false;
local presetKeyCode = config[title] and Enum.KeyCode[config[title]] or presetKeyCode;
local activated = presetKeyCode and true or false;
local keyCode = presetKeyCode;
local btn = game:GetObjects("rbxassetid://4531229816")[1];
btn.Parent = self.bodyFrame;
btn.titleLabel.Text = title;
btn.titleLabel.Size = newUDim2(0, btn.titleLabel.TextBounds.X, 1, 0);
btn.Size = newUDim2(0, btn.titleLabel.Size.X.Offset + 90, 0, 30);
btn.bindBtn.Text = presetKeyCode and string.upper(tostring(string.char(presetKeyCode.Value))) or "KEY";
if config[title] then
popup:new("Set " .. title .. " to " .. string.upper(tostring(string.char(presetKeyCode.Value))));
end;
inputService.InputBegan:Connect(function(input, onGui)
if onGui then return; end;
if listening and not activated then
pcall(function()
btn.bindBtn.Text = string.upper(tostring(string.char(input.KeyCode.Value)));
listening = false;
config[title] = input.KeyCode.Name;
saveConfig();
keyCode = input.KeyCode;
activated = true;
popup:new("Set " .. title .. " to " .. string.upper(tostring(string.char(input.KeyCode.Value))));
end);
elseif activated and not listening and input.KeyCode == keyCode then
enabled = not enabled;
callback(enabled);
end;
end);
btn.bindBtn.MouseButton1Click:Connect(function()
btn.bindBtn.Text = "...";
activated = false;
listening = true;
end);
end;
function OwlLib.Content:newCBind(title, callback, presetKeyCode)
self:Resize(self.bodyFrame);
local enabled = false;
local presetKeyCode = presetKeyCode and presetKeyCode;
local shortNames = {
RightControl = 'RightCtrl';
LeftControl = 'LeftCtrl';
LeftShift = 'LShift';
RightShift = 'RShift';
MouseButton1 = "Mouse1";
MouseButton2 = "Mouse2";
};
if config[title] then
local keyboard = config[title]:find("Keyboard");
if keyboard then
presetKeyCode = Enum.KeyCode[config[title]:gsub("Keyboard", "")];
else
presetKeyCode = Enum.UserInputType[config[title]];
end;
popup:new("Set " .. title .. " to " .. (shortNames[presetKeyCode.Name] or presetKeyCode.Name));
end;
local activated = presetKeyCode and true or false;
local banned = {
Return = true;
Space = true;
Tab = true;
Unknown = true;
}
local function isreallypressed(bind, inp)
local key = bind
if typeof(key) == "Instance" then
if key.UserInputType == Enum.UserInputType.Keyboard and inp.KeyCode == key.KeyCode then
return true;
elseif tostring(key.UserInputType):find("MouseButton") and inp.UserInputType == key.UserInputType then
return true
end
end
if tostring(key):find'MouseButton' then
return key == inp.UserInputType
else
return key == inp.KeyCode
end
end
local allowed = {
MouseButton1 = true;
MouseButton2 = true;
};
local nm = (presetKeyCode and (shortNames[presetKeyCode.Name] or presetKeyCode.Name) or "None");
local keyCode = presetKeyCode;
local btn = game:GetObjects("rbxassetid://4531229816")[1];
btn.Parent = self.bodyFrame;
btn.titleLabel.Text = title;
btn.titleLabel.Size = newUDim2(0, btn.titleLabel.TextBounds.X, 1, 0);
btn.Size = newUDim2(0, btn.titleLabel.Size.X.Offset + 90, 0, 30);
btn.bindBtn.Text = nm;
inputService.InputBegan:Connect(function(input, onGui)
if onGui then return; end;
if activated and isreallypressed(keyCode, input) then
callback(true);
end;
end);
inputService.InputEnded:Connect(function(input, onGui)
if onGui then return; end;
if activated and not listening and isreallypressed(keyCode, input) then
callback(false);
end;
end);
btn.bindBtn.MouseButton1Click:Connect(function()
btn.bindBtn.Text = "...";
activated = false;
local input, onGui = inputService.InputBegan:Wait();
config[title] = (input.UserInputType ~= Enum.UserInputType.Keyboard and input.UserInputType.Name or input.KeyCode.Name .. "Keyboard");
saveConfig();
keyCode = input;
local name = (input.UserInputType ~= Enum.UserInputType.Keyboard and (shortNames[input.UserInputType.Name] or input.UserInputType.Name) or input.KeyCode.Name);
btn.bindBtn.Text = name
activated = true;
popup:new("Set " .. title .. " to " .. (shortNames[input.UserInputType.Name] or input.UserInputType.Name));
end);
end;
function OwlLib.Content:newColorPicker(title, callback, presetColor)
self:Resize(self.bodyFrame);
local oldSize;
local rainbow = false;
local hueSatDragging = false;
local valueDragging = false;
local btn = game:GetObjects("rbxassetid://4531551348")[1];
btn.Parent = self.bodyFrame;
btn.titleLabel.Text = title;
btn.titleLabel.Size = newUDim2(0, btn.titleLabel.TextBounds.X, 1, 0);
btn.Size = newUDim2(0, btn.titleLabel.Size.X.Offset + 50, 0, 30);
local colorFrame = btn.colorFrame;
local colorPickingFrame = btn.colorPickingFrame;
local rainbowBtn = colorPickingFrame.rainbowBtn;
local hueSatFrame = colorPickingFrame.hueSatFrame;
local valueFrame = colorPickingFrame.valueFrame;
local hueSatIndicatorFrame = hueSatFrame.hueSatIndicatorFrame;
local valueIndicatorFrame = valueFrame.valueIndicatorFrame;
local presetColor = presetColor and presetColor or fromRGB(255, 255, 255);
if config[title] then
if config[title]["R"] then
presetColor = fromRGB(config[title]["R"], config[title]["G"], config[title]["B"]);
popup:new("Set " .. title .. " to " .. floor(config[title]["R"] * 255) .. " " .. floor(config[title]["G"] * 255) .. " " .. floor(config[title]["B"] * 255));
elseif config[title] == "Rainbow" then
rainbow = true;
popup:new("Set " .. title .. " to rainbow");
end;
end;
callback(presetColor);
colorFrame.BackgroundColor3 = presetColor;
self:initBtnEffect(btn);
btn.MouseButton1Click:Connect(function()
if not colorPickingFrame.Visible then
oldSize = self.bodyFrame.CanvasSize;
self.bodyFrame.CanvasSize = oldSize + newUDim2(0, 0, 0, 170);
colorPickingFrame.Visible = true;
colorPickingFrame:TweenSize(newUDim2(0, 170, 0, 120), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
elseif colorPickingFrame.Visible then
colorPickingFrame:TweenSize(newUDim2(0, 170, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
wait(0.15);
colorPickingFrame.Visible = false;
self.bodyFrame.CanvasSize = oldSize;
end;
end);
rainbowBtn.MouseButton1Click:Connect(function()
config[title] = "Rainbow";
saveConfig();
rainbow = true;
popup:new("Set " .. title .. " to rainbow");
end);
hueSatFrame.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
hueSatDragging = true;
end;
end);
hueSatFrame.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
hueSatDragging = false;
config[title] = {R = colorFrame.BackgroundColor3.R * 255, G = colorFrame.BackgroundColor3.G * 255, B = colorFrame.BackgroundColor3.B * 255};
saveConfig();
popup:new("Set " .. title .. " to " .. floor(colorFrame.BackgroundColor3.R * 255) .. " " .. floor(colorFrame.BackgroundColor3.G * 255) .. " " .. floor(colorFrame.BackgroundColor3.B * 255));
end;
end);
valueFrame.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
valueDragging = true;
end;
end)
valueFrame.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
valueDragging = false;
config[title] = {R = colorFrame.BackgroundColor3.R * 255, G = colorFrame.BackgroundColor3.G * 255, B = colorFrame.BackgroundColor3.B * 255};
saveConfig();
popup:new("Set " .. title .. " to " .. floor(colorFrame.BackgroundColor3.R) .. " " .. floor(colorFrame.BackgroundColor3.G) .. " " .. floor(colorFrame.BackgroundColor3.B));
end;
end);
game:GetService("UserInputService").InputChanged:Connect(function(input)
if hueSatDragging and input.UserInputType == Enum.UserInputType.MouseMovement then
rainbow = false;
hueSatIndicatorFrame.Position = newUDim2(clamp((input.Position.X - hueSatFrame.AbsolutePosition.X) / hueSatFrame.AbsoluteSize.X, 0, 1), 0, clamp((input.Position.Y - hueSatFrame.AbsolutePosition.Y) / hueSatFrame.AbsoluteSize.Y, 0, 1), 0);
valueIndicatorFrame.BackgroundColor3 = fromHSV(h, 1 - (1 - hueSatIndicatorFrame.Position.Y.Scale), 1);
colorFrame.BackgroundColor3 = fromHSV(hueSatIndicatorFrame.Position.X.Scale, 1 - hueSatIndicatorFrame.Position.Y.Scale, 1 - valueIndicatorFrame.Position.Y.Scale);
valueFrame.ImageColor3 = fromHSV(hueSatIndicatorFrame.Position.X.Scale, 1 - hueSatIndicatorFrame.Position.Y.Scale, 1);
callback(colorFrame.BackgroundColor3);
elseif valueDragging and input.UserInputType == Enum.UserInputType.MouseMovement then
rainbow = false;
valueIndicatorFrame.Position = newUDim2(0, 0, clamp((input.Position.Y - valueFrame.AbsolutePosition.Y) / valueFrame.AbsoluteSize.Y, 0, 1), 0);
valueIndicatorFrame.BackgroundColor3 = fromHSV(h, 1 - (1 - hueSatIndicatorFrame.Position.Y.Scale), 1);
colorFrame.BackgroundColor3 = fromHSV(hueSatIndicatorFrame.Position.X.Scale, 1 - hueSatIndicatorFrame.Position.Y.Scale, 1 - valueIndicatorFrame.Position.Y.Scale);
valueFrame.ImageColor3 = fromHSV(hueSatIndicatorFrame.Position.X.Scale, 1 - hueSatIndicatorFrame.Position.Y.Scale, 1);
callback(colorFrame.BackgroundColor3);
end;
end);
spawn(function()
while true do
for i = 1, 230 do
rainbowBtn.TextColor3 = fromHSV(i / 230, 1, 1);
if rainbow then
colorFrame.BackgroundColor3 = fromHSV(i / 230, 1, 1);
callback(fromHSV(i / 230, 1, 1));
end;
wait();
end;
wait();
end;
end);
end;
function OwlLib.Content:newDropdown(title, callback, list, noCallbackOnStart)
self:Resize(self.bodyFrame);
local oldSize;
local btn = game:GetObjects("rbxassetid://4531687341")[1];
btn.Parent = self.bodyFrame;
btn.titleLabel.Text = title;
btn.titleLabel.Size = newUDim2(0, btn.titleLabel.TextBounds.X, 1, 0);
btn.Size = newUDim2(0, btn.titleLabel.Size.X.Offset + 80, 0, 30);
if not noCallbackOnStart then
callback(config[title] and config[title] or list[1]);
if config[title] then
popup:new("Set " .. title .. " to " .. config[title]);
end;
end;
local arrowLabel = btn.arrowLabel;
local bodyFrame = btn.bodyFrame;
self:initBtnEffect(btn);
local function refresh(list)
for i, v in next, bodyFrame:GetChildren() do
if not v:IsA("UIListLayout") then v:Destroy(); end;
end
for i, v in next, list do
local btn = game:GetObjects("rbxassetid://4531683854")[1];
btn.Parent = bodyFrame;
btn.Text = v;
btn.ZIndex = 2;
local btnHover = tweenService:Create(btn, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 0.5});
local btnHover1 = tweenService:Create(btn, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 1});
btn.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
btnHover:Play();
end;
end);
btn.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
btnHover1:Play();
end;
end);
local arrowTween = tweenService:Create(arrowLabel, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Rotation = 180});
btn.MouseButton1Click:Connect(function()
config[title] = v;
saveConfig();
callback(v);
popup:new("Set " .. title .. " to " .. v);
arrowTween:Play();
bodyFrame:TweenSize(newUDim2(0, 170, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
wait(0.15);
bodyFrame.Visible = false;
self.bodyFrame.CanvasSize = oldSize;
end);
end;
end
refresh(list);
local arrowTween = tweenService:Create(arrowLabel, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Rotation = 0});
local arrowTween1 = tweenService:Create(arrowLabel, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Rotation = 180});
btn.MouseButton1Click:Connect(function()
if not bodyFrame.Visible then
oldSize = self.bodyFrame.CanvasSize;
self.bodyFrame.CanvasSize = oldSize + newUDim2(0, 0, 0, 170);
bodyFrame.Visible = true;
arrowTween:Play();
bodyFrame:TweenSize(newUDim2(0, 170, 0, (#bodyFrame:GetChildren() - 1) * 27), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
elseif bodyFrame.Visible then
arrowTween1:Play();
bodyFrame:TweenSize(newUDim2(0, 170, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
wait(0.15);
bodyFrame.Visible = false;
self.bodyFrame.CanvasSize = oldSize;
end;
end);
return {
Refresh = function(self, list)
refresh(list);
end
}
end;
return OwlLib;