local library windowcount local defaults txtcolor Color3 fromRGB 255 2

  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
local library = {
windowcount = 0;
}
local defaults = {
txtcolor = Color3.fromRGB(255, 255, 255),
underline = Color3.fromRGB(0, 255, 140),
barcolor = Color3.fromRGB(40, 40, 40),
bgcolor = Color3.fromRGB(30, 30, 30),
}
function library:Create(class, props)
local object = Instance.new(class);
for i, prop in next, props do
if i ~= "Parent" then
object[i] = prop;
end
end
object.Parent = props.Parent;
return object;
end
function library:CreateWindow(options)
local window = {
count = 0;
toggles = {},
closed = false;
}
local options = options or {};
setmetatable(options, {__index = defaults})
self.windowcount = self.windowcount + 1;
if not library.gui then
library.gui = self:Create("ScreenGui", {Name = "UILibrary", Parent = game:GetService("CoreGui")})
end
window.frame = self:Create("Frame", {
Parent = self.gui,
Active = true,
Draggable = true,
BackgroundTransparency = 0,
Size = UDim2.new(0, 190, 0, 30),
Position = UDim2.new(0, (15 + ((200 * self.windowcount) - 200)), 0, 15),
BackgroundColor3 = options.barcolor,
BorderSizePixel = 0;
})
window.background = self:Create('Frame', {
Parent = window.frame,
BorderSizePixel = 0;
BackgroundColor3 = options.bgcolor,
Position = UDim2.new(0, 0, 1, 0),
Size = UDim2.new(1, 0, 0, 25),
ClipsDescendants = true;
})
self:Create("Frame", {
Size = UDim2.new(1, 0, 0, 1),
Position = UDim2.new(0, 0, 1, -1),
BorderSizePixel = 0;
BackgroundColor3 = options.underline;
Parent = window.frame
})
local togglebutton = self:Create("TextButton", {
ZIndex = 2,
BackgroundTransparency = 1;
Position = UDim2.new(1, -25, 0, 0),
Size = UDim2.new(0, 25, 1, 0),
Text = "-",
TextSize = 17,
TextColor3 = options.txtcolor,
Font = Enum.Font.SourceSans;
Parent = window.frame,
});
togglebutton.MouseButton1Click:connect(function()
window.closed = not window.closed
togglebutton.Text = (window.closed and "+" or "-")
if window.closed then
window:Resize(true, UDim2.new(1, 0, 0, 0))
else
window:Resize(true)
end
end)
self:Create("TextLabel", {
Size = UDim2.new(1, 0, 1, 0),
BackgroundTransparency = 1;
BorderSizePixel = 0;
TextColor3 = options.txtcolor,
TextColor3 = (options.bartextcolor or Color3.fromRGB(255, 255, 255));
TextSize = 17,
Font = Enum.Font.SourceSansSemibold;
Text = options.text or "window",
Name = "Window",
Parent = window.frame,
})
function window:Resize(tween, change)
local size = change or UDim2.new(1, 0, 0, ((20 * self.count) + 10))
if tween then
self.background:TweenSize(size, "Out", "Sine", 0.5, true)
else
self.background.Size = size
end
end
function window:AddToggle(text, callback)
self.count = self.count + 1
callback = callback or function() end
local label = library:Create("TextLabel", {
Text = text,
Size = UDim2.new(1, -10, 0, 20);
Position = UDim2.new(0, 5, 0, ((20 * self.count) - 20) + 5),
BackgroundTransparency = 1;
TextColor3 = Color3.fromRGB(255, 255, 255);
TextXAlignment = Enum.TextXAlignment.Left;
TextSize = 16,
Font = Enum.Font.SourceSans,
Parent = self.background;
})
local button = library:Create("TextButton", {
Text = "OFF",
TextColor3 = Color3.fromRGB(255, 25, 25),
BackgroundTransparency = 1;
Position = UDim2.new(1, -25, 0, 0),
Size = UDim2.new(0, 25, 1, 0),
TextSize = 17,
Font = Enum.Font.SourceSansSemibold,
Parent = label;
})
button.MouseButton1Click:connect(function()
self.toggles[text] = (not self.toggles[text])
button.TextColor3 = (self.toggles[text] and Color3.fromRGB(0, 255, 140) or Color3.fromRGB(255, 25, 25))
button.Text =(self.toggles[text] and "ON" or "OFF")
callback(self.toggles[text])
end)
self:Resize()
return button
end
function window:AddBox(text, callback)
self.count = self.count + 1
callback = callback or function() end
local box = library:Create("TextBox", {
PlaceholderText = text,
Size = UDim2.new(1, -10, 0, 20);
Position = UDim2.new(0, 5, 0, ((20 * self.count) - 20) + 5),
BackgroundTransparency = 0.75;
BackgroundColor3 = options.boxcolor,
TextColor3 = Color3.fromRGB(255, 255, 255);
TextXAlignment = Enum.TextXAlignment.Center;
TextSize = 16,
Text = "",
Font = Enum.Font.SourceSans,
BorderSizePixel = 0;
Parent = self.background;
})
box.FocusLost:connect(function(...)
callback(box, ...)
end)
self:Resize()
return box
end
function window:AddButton(text, callback)
self.count = self.count + 1
callback = callback or function() end
local button = library:Create("TextButton", {
Text = text,
Size = UDim2.new(1, -10, 0, 20);
Position = UDim2.new(0, 5, 0, ((20 * self.count) - 20) + 5),
BackgroundTransparency = 1;
TextColor3 = Color3.fromRGB(255, 255, 255);
TextXAlignment = Enum.TextXAlignment.Left;
TextSize = 16,
Font = Enum.Font.SourceSans,
Parent = self.background;
})
button.MouseButton1Click:connect(callback)
self:Resize()
return button
end
return window
end
return library