-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMainClient.lua
More file actions
318 lines (298 loc) · 9.93 KB
/
MainClient.lua
File metadata and controls
318 lines (298 loc) · 9.93 KB
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
--DARKPIXLZ 2022
--PreloadService
--DESC:
--[[
- Handles Navigation
- Handles Animation
- Handles SFX
- Handles Panel Open
- Handles some remotes
- Changes themes
]]
local function Print(str)
print("[PreloadService]: "..str)
end
local function Warn(str)
warn("[PreloadService]: "..str)
end
local function Error(str)
error("[PreloadService]: "..str)
end
local IsOpen
local MainFrame = script.Parent:WaitForChild("Main", 5)
local function IsAcrylicUsed()
return not require(game.ReplicatedStorage.PreloadService.Config)["Settings"].UseArcylic
end
local function ChangeTheme(Theme)
Warn("Building Theme...")
MainFrame.BackgroundColor3 = Theme.BackgroundColor
end
--ChangeTheme("Default")
local last = "Home"
game.ReplicatedStorage.PSRemotes.NewPlayerClient.OnClientEvent:Connect(function(a)
print(a)
script.Parent.Main.Home.Joined.Text = a.." Players in Server Lifetime"
script.Parent.Main.Home.RightNow.Text = #game.Players:GetPlayers().." in game right now"
end)
local function PlaySFX()
script.Sound:Play()
end
script.Parent.Main.Header.ScaleType = Enum.ScaleType.Crop
local UIS = game:GetService("UserInputService")
script.Parent.Main.Home.Head.Text = "Welcome to PreloadService, "..game.Players.LocalPlayer.DisplayName.."!"
-- Fix mobile scaling
if not UIS.KeyboardEnabled and UIS.TouchEnabled then
Print("Making adjustments to UI (Mobile)")
local Header = MainFrame.Header
Header.Mark.Logo.Position = UDim2.new(-0.274, 0,0.088, 0)
for i, v in ipairs(MainFrame.Dock.buttons:GetChildren()) do
local asset = v:FindFirstChild("Desc")
if asset then
asset.Visible = false
else
Warn("Could not find Desc in button")
end
end
MainFrame.Dock.buttons.UIGridLayout.CellPadding = UDim2.new(.02,0,.5,0)
MainFrame.Dock.buttons.UIGridLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
Header.Size = UDim2.new(1,0,.142,0)
local Dock = MainFrame.Dock
Dock.Position = UDim2.new(0.016, 0,0.134, 0)
Dock.Size = UDim2.new(0.967, 0,0.093, 0)
end
--//NAVIGATION\\--
local expandedNav = script.Parent.Main.expanded
local menuDB = false
local last2
local function NewNotification(admin, bodytext, headingtext, image, dur)
local Placeholder = Instance.new("Frame")
Placeholder.Parent = admin.PlayerGui.PreloadServiceAdminPanel.Notifications
Placeholder.BackgroundTransparency = 1
Placeholder.Size = UDim2.new(0.996,0,0.096,0)
local notif = admin.PlayerGui.PreloadServiceAdminPanel.Notifications.Template:Clone()
notif.Position = UDim2.new(0.4,0,0.904,0)
notif.Visible = true
notif.Size = UDim2.new(0.996,0,0.096,0)
notif.Parent = admin.PlayerGui.PreloadServiceAdminPanel.NotificationsTest
notif.Body.Text = bodytext
notif.Header.Title.Text = headingtext
notif.Header.ImageL.Image = image
local NewSound = Instance.new("Sound")
NewSound.Parent = notif
NewSound.SoundId = "rbxassetid://9770089602"
NewSound:Play()
local TS = game:GetService("TweenService")
local NotifTween = TS:Create(
notif,
TweenInfo.new(
0.4,
Enum.EasingStyle.Quart,
Enum.EasingDirection.In,
0,
false,
0
),
{
Position = UDim2.new(-0.02,0,0.904,0)
}
)
NotifTween:Play()
NotifTween.Completed:Wait()
Placeholder:Destroy()
notif.Parent = admin.PlayerGui.PreloadServiceAdminPanel.Notifications
task.wait(dur)
local Placeholder2 = Instance.new("Frame")
Placeholder2.Parent = admin.PlayerGui.PreloadServiceAdminPanel.Notifications
Placeholder2.BackgroundTransparency = 1
Placeholder2.Size = UDim2.new(0.996,0,0.096,0)
notif.Parent = admin.PlayerGui.PreloadServiceAdminPanel.NotificationsTest
local NotifTween2 = TS:Create(
notif,
TweenInfo.new(
0.5,
Enum.EasingStyle.Quart,
Enum.EasingDirection.In,
0,
false,
0
),
{
Position = UDim2.new(1.8,0,0.904,0)
}
)
NotifTween2:Play()
NotifTween2.Completed:Wait()
notif:Destroy()
Placeholder2:Destroy()
end
-- Animations by 6Marchy4
local UIS = game:GetService("UserInputService")
local TS = game:GetService("TweenService")
local neon = require(script.Parent.ButtonAnims:WaitForChild("neon"))
local IsOpen = true
local function Open()
script.Parent:SetAttribute("IsVisible", true)
if IsAcrylicUsed() then
neon:BindFrame(script.Parent.Main.Blur, {
Transparency = 0.98;
BrickColor = BrickColor.new("Institutional white");
})
end
local Main = script:FindFirstAncestorOfClass("ScreenGui"):FindFirstChildOfClass("Frame")
Main.Visible = true
TS:Create(Main, TweenInfo.new(0.6, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
--{0.147, 0},{0.169, 0}
--Position = UDim2.fromScale(Main.Position.X.Scale, Main.Position.Y.Scale - 0.05);
Position = UDim2.new(.147,0,.169,0);
BackgroundTransparency = 0.5;
}):Play()
for _, Descendant in pairs(Main:GetDescendants()) do
if Descendant:IsA("Frame") and not Descendant:GetAttribute("ExcludeTransparent") then
TS:Create(Descendant, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
BackgroundTransparency = 0
}):Play()
end
if Descendant:IsA("TextLabel") then
TS:Create(Descendant, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
TextTransparency = 0
}):Play()
end
if Descendant:IsA("ImageLabel") then
TS:Create(Descendant, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
ImageTransparency = 0
}):Play()
end
if Descendant:IsA("TextButton") and Descendant:GetAttribute("IsVisible") then
TS:Create(Descendant, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
TextTransparency = 0;
BackgroundTransparency = 0
}):Play()
end
end
task.wait(.6)
IsOpen = true
end
local function Close()
script.Parent:SetAttribute("IsVisible", false)
if IsAcrylicUsed() then
neon:UnbindFrame(script.Parent.Main.Blur)
end
local Main = script:FindFirstAncestorOfClass("ScreenGui"):FindFirstChildOfClass("Frame")
TS:Create(Main, TweenInfo.new(0.6, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
Position = UDim2.fromScale(Main.Position.X.Scale, Main.Position.Y.Scale + 0.05);
Transparency = 1;
}):Play()
for _, Descendant in pairs(Main:GetDescendants()) do
if Descendant:IsA("ImageLabel") and not (Descendant.BackgroundTransparency == 1) then
TS:Create(Descendant, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
ImageTransparency = 1,
BackgroundTransparency = 1
}):Play()
elseif Descendant:IsA("GuiObject") and not (Descendant.BackgroundTransparency == 1) then
TS:Create(Descendant, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
Transparency = 1
}):Play()
elseif Descendant:IsA("TextLabel") and not (Descendant.BackgroundTransparency == 1) then
TS:Create(Descendant, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
TextTransparency = 1,
BackgroundTransparency = 1
}):Play()
elseif Descendant:IsA("Frame") and not (Descendant.BackgroundTransparency == 1) then
TS:Create(Descendant, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
BackgroundTransparency = 1
}):Play()
end
end
end
--Close()
task.wait(.1)
--script.Parent.Main.Visible = false
local function GetSetting(String)
return require(game.ReplicatedStorage.PreloadService.Config)["Settings"][String]
end
local Down
game:GetService("UserInputService").InputBegan:Connect(function(key, typing)
if typing then
return
end
Down = UIS:IsKeyDown(Enum.KeyCode.LeftShift)
if key.KeyCode == GetSetting("PanelKeybind") then
if GetSetting("RequireShift") == true then
if Down then
if menuDB == false then
Open()
PlaySFX()
repeat task.wait() until IsOpen
script.Parent.Main.Position = UDim2.new(.147,0,.169,0)
menuDB = true
else
Close()
PlaySFX()
menuDB = false
task.wait(.1)
script.Parent.Main.Visible = false
end
end
else
if menuDB == false then
Open()
PlaySFX()
repeat task.wait() until IsOpen
script.Parent.Main.Position = UDim2.new(.147,0,.169,0)
menuDB = true
else
Close()
PlaySFX()
menuDB = false
task.wait(.1)
script.Parent.Main.Visible = false
end
end
else return end
end)
script.Parent.Main.Header.Minimize.MouseButton1Click:Connect(function()
Close()
PlaySFX()
menuDB = false
task.wait(.1)
script.Parent.Main.Visible = false
end)
script.Parent.Main.Menu.Main.BUpdate.Check.MouseButton1Click:Connect(function()
local tl = script.Parent.Main.Menu.Main.BUpdate.Text
tl.Text = "Checking..."
task.wait(0.2)
tl.Text = "Waiting for server response.."
game.ReplicatedStorage.PSRemotes.CheckForUpdates:FireServer()
tl.Parent.Value.Changed:Connect(function()
tl.Text = "Completed."
end)
task.wait(5)
tl.Text = "Check for Updates"
end)
task.wait(2)
for i, v in ipairs(script.Parent.Main.Dock.buttons:GetChildren()) do
local frame = string.sub(v.Name, 2,100)
v.TextButton.MouseButton1Click:Connect(function()
if v.Name == "AMinimize" then return end
if script.Parent.Main:FindFirstChild(frame) then
last2 = v.Name
script.Parent.Main.Animation.Position = UDim2.new(0,0,0,0) --Fixes bug present in 2.0.0, atleast it should..
script.Parent.Main.Animation:TweenSize(UDim2.new(1,0,1,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true)
PlaySFX()
script.Parent.Main[tostring(last)].Visible = false
last = frame
task.wait(GetSetting("PanelLoadingTime"))
script.Parent.Main[frame].Visible = true
-- task.wait(0.2)
script.Parent.Main.Animation:TweenSizeAndPosition(UDim2.new(0,0,1,0), UDim2.new(1,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true)
-- task.wait(.2)
script.Parent.Main.Animation.Position = UDim2.new(0,0,0,0)
-- NewNotification(game.Players.LocalPlayer, frame.." has been opened, this is to test the new notification system ;)", "Test notification", "rbxassetid://9482016562", 5)
else --Doesn't exist
Warn("Page not found! If you added a button please make sure that a page with the same name, but without the first character exists!")
script.Parent.Main[tostring(last)].Visible = false
last = "Other"
script.Parent.Main.Other.Visible = true
end
end)
end