-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSR_Admin_Plugin_Source_Code
More file actions
409 lines (324 loc) · 12.4 KB
/
SR_Admin_Plugin_Source_Code
File metadata and controls
409 lines (324 loc) · 12.4 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
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
local insertservice = game:GetService("InsertService")
local changehistoryservice = game:GetService("ChangeHistoryService")
local tweenservice = game:GetService("TweenService")
local toolbar = plugin:CreateToolbar("SR Admin Panel Installation")
local installbutton = toolbar:CreateButton("SR Admin Installation Panel","Opens up the installation panel that is used to install the SR Admin system.","rbxassetid://14215430082")
local stableadminpanelid = 10477896976
local stableVersion = "4.0.S8P0"
local canaryadminpanelid = 11898421409
local canaryVersion = "4.0.C8P2"
local installUI = script:WaitForChild("SRPluginUI")
local MainUIPos = installUI.Main.Position
local NewUIPos = UDim2.new(MainUIPos.X,20,0)
installbutton.Click:Connect(function()
local closed = false
local f = game.CoreGui:GetChildren()
for i=1,#f do
if f[i].Name == "SRPluginUI" then
f[i]:Destroy()
end
end
local preUIBlur = game.Lighting:GetChildren()
for i=1,#preUIBlur do
if preUIBlur[i].Name == "UIBlur" then
preUIBlur[i]:Destroy()
end
end
local newUIBlur = script:WaitForChild("UIBlur"):Clone()
newUIBlur.Parent = game.Lighting
local v = installUI:Clone()
v.Parent = game.CoreGui
local currentpos = v.Main.Position
v.Main.Position = NewUIPos
local MUPAnim = tweenservice:Create(v.Main,TweenInfo.new(1),{Position = MainUIPos})
local BlurAnim = tweenservice:Create(newUIBlur,TweenInfo.new(1),{Size = 500})
MUPAnim:Play()
BlurAnim:Play()
wait(1)
local stableinstall = v:WaitForChild("Main"):WaitForChild("Stable"):WaitForChild("Install")
local canaryinstall = v:WaitForChild("Main"):WaitForChild("Canary"):WaitForChild("Install")
local close = v:WaitForChild("Main"):WaitForChild("Title"):WaitForChild("Close")
v:WaitForChild("Main"):WaitForChild("Canary"):WaitForChild("Version").Text = canaryVersion
v:WaitForChild("Main"):WaitForChild("Stable"):WaitForChild("Version").Text = stableVersion
local hasLoader = game:GetService("ServerScriptService"):FindFirstChild("SR_Loader")
local hasConfig = nil
if hasLoader then
hasConfig = hasLoader:FindFirstChild("Config")
end
if hasConfig ~= nil then
local cfg = require(hasConfig)
if cfg["AdminVersion"] == nil then
stableinstall.Text = "UPDATE"
stableinstall.Active = false
stableinstall.UIStroke.Color = Color3.new(0.243137, 0.243137, 0.243137)
else
if cfg["AdminVersion"] ~= stableVersion and cfg["AdminVersion"] == canaryVersion then
stableinstall.Text = "INSTALL"
canaryinstall.Text = "AT CURRENT VERSION"
canaryinstall.Active = false
canaryinstall.UIStroke.Color = Color3.new(0.243137, 0.243137, 0.243137)
elseif cfg["AdminVersion"] == stableVersion and cfg["AdminVersion"] ~= canaryVersion then
canaryinstall.Text = "INSTALL"
stableinstall.Text = "AT CURRENT VERSION"
stableinstall.Active = false
stableinstall.UIStroke.Color = Color3.new(0.243137, 0.243137, 0.243137)
else
if string.find(cfg["AdminVersion"],"C",1,false) then
if cfg["AdminVersion"] ~= canaryVersion then
stableinstall.Text = "INSTALL"
canaryinstall.Text = "UPDATE"
end
elseif string.find(cfg["AdminVersion"],"S",1,false) then
if cfg["AdminVersion"] ~= stableVersion then
stableinstall.Text = "UPDATE"
canaryinstall.Text = "INSTALL"
end
end
end
end
end
close.Activated:Connect(function()
if closed == false then
closed = true
local NoMUPAnim = tweenservice:Create(v.Main,TweenInfo.new(1),{Position = NewUIPos})
local NoBlurAnim = tweenservice:Create(newUIBlur,TweenInfo.new(1),{Size = 0})
NoBlurAnim:Play()
NoMUPAnim:Play()
NoBlurAnim.Completed:Connect(function()
newUIBlur:Destroy()
end)
NoMUPAnim.Completed:Connect(function()
v:Destroy()
end)
if v then
v:Destroy()
end
end
end)
canaryinstall.Activated:Connect(function()
local success,model = pcall(insertservice.LoadAsset,insertservice,canaryadminpanelid)
if success and model and closed == false then
local waypointsuccess,errs = pcall(function()
changehistoryservice:SetWaypoint("Before Installation")
end)
if waypointsuccess then
local closed = true
local prevconfig
local prevframework
model.Parent = game.ServerStorage
local SRAdminStuff = model:WaitForChild("SR Admin Canary")
local modelitems = SRAdminStuff:GetChildren()
local prevstufffolder = Instance.new("Folder")
prevstufffolder.Name = "Previous_Admin_Panel_Items"
prevstufffolder.Parent = game.ServerScriptService
local hasAdmin = game:GetService("ServerScriptService"):FindFirstChild("SR_Loader")
if hasAdmin ~= nil then
prevconfig = hasAdmin:FindFirstChild("Config")
prevframework = hasAdmin:FindFirstChild("SR_FrameWork")
if prevconfig then
prevconfig.Parent = prevstufffolder
prevconfig.Name = "Previous_Config"
end
if prevframework then
prevframework.Parent = prevstufffolder
prevframework.Name = "Previous_(SR_Framework)"
end
game.ServerScriptService.SR_Loader:Destroy()
end
if game.ServerScriptService:FindFirstChild("README") then
game.ServerScriptService.README:Destroy()
end
if game.ReplicatedStorage:FindFirstChild("SRAdminEvents") then
game.ReplicatedStorage.SRAdminEvents:Destroy()
end
if game.ServerStorage:FindFirstChild("Vehicles") then
game.ServerStorage.Vehicles:Clone().Parent = prevstufffolder
game.ServerStorage.Vehicles:Destroy()
end
if game.ServerStorage:FindFirstChild("Tools") then
game.ServerStorage.Tools:Clone().Parent = prevstufffolder
game.ServerStorage.Tools:Destroy()
end
local sp = game.StarterPlayer
local spcstuff = sp.StarterCharacterScripts:GetChildren()
local sppstuff = sp.StarterPlayerScripts:GetChildren()
for i=1,#spcstuff do
if spcstuff[i].Name == "CkVal" or spcstuff[i].Name == "Flying" or spcstuff[i].Name == "Frozen" or spcstuff[i].Name == "Rank" then
spcstuff[i]:Destroy()
end
end
for i=1,#sppstuff do
if sppstuff[i].Name == "ClientRecieve" then
sppstuff[i]:Destroy()
end
end
for i=1,#modelitems do
if modelitems[i].Name == "ReplicatedStorage" then
local events = modelitems[i]:GetChildren()
for i=1,#events do
events[i].Parent = game.ReplicatedStorage
end
elseif modelitems[i].Name == "ServerScriptService" then
local loaderscript = modelitems[i]:WaitForChild("SR_Loader")
loaderscript.Parent = game.ServerScriptService
prevstufffolder.Parent = loaderscript
print("Previous SR Framework & Config is located at: "..(prevstufffolder.Parent).Name)
elseif modelitems[i].Name == "README" then
local license = modelitems[i]
license.Parent = game.ServerScriptService
elseif modelitems[i].Name == "StarterCharacterScripts" then
local sc = game.StarterPlayer.StarterCharacterScripts
local scsitems = modelitems[i]:GetChildren()
for i=1,#scsitems do
scsitems[i].Parent = sc
end
elseif modelitems[i].Name == "StarterPlayerScripts" then
local sp = game.StarterPlayer.StarterPlayerScripts
local spsitems = modelitems[i]:GetChildren()
for i=1,#spsitems do
spsitems[i].Parent = sp
end
elseif modelitems[i].Name == "ServerStorage" then
local ss = game.ServerStorage
local ssitems = modelitems[i]:GetChildren()
for i=1,#ssitems do
ssitems[i].Parent = ss
end
end
end
model:Destroy()
warn("Successfully installed the canary version of the SR Admin Panel.")
else
warn("Something went wrong with the installation process. Please try again")
end
local NoMUPAnim = tweenservice:Create(v.Main,TweenInfo.new(1),{Position = NewUIPos})
local NoBlurAnim = tweenservice:Create(newUIBlur,TweenInfo.new(1),{Size = 0})
NoBlurAnim:Play()
NoMUPAnim:Play()
NoBlurAnim.Completed:Connect(function()
newUIBlur:Destroy()
end)
NoMUPAnim.Completed:Connect(function()
v:Destroy()
end)
if v then
v:Destroy()
end
else
warn("Something went wrong with the installation process. Please ensure that you own the models before using the plugin.")
end
end)
stableinstall.Activated:Connect(function()
local success,model = pcall(insertservice.LoadAsset,insertservice,stableadminpanelid)
if success and model and closed == false then
local waypointsuccess,errs = pcall(function()
changehistoryservice:SetWaypoint("Before Installation")
end)
if waypointsuccess then
local closed = true
local prevconfig
local prevframework
model.Parent = game.ServerStorage
local SRAdminStuff = model:WaitForChild("SR Admin Stable")
local modelitems = SRAdminStuff:GetChildren()
local prevstufffolder = Instance.new("Folder")
prevstufffolder.Name = "Previous_Admin_Panel_Items"
prevstufffolder.Parent = game.ServerScriptService
local hasAdmin = game:GetService("ServerScriptService"):FindFirstChild("SR_Loader")
if hasAdmin ~= nil then
prevconfig = hasAdmin:FindFirstChild("Config")
prevframework = hasAdmin:FindFirstChild("SR_FrameWork")
if prevconfig then
prevconfig.Parent = prevstufffolder
prevconfig.Name = "Previous_Config"
end
if prevframework then
prevframework.Parent = prevstufffolder
prevframework.Name = "Previous_(SR_Framework)"
end
game.ServerScriptService.SR_Loader:Destroy()
end
if game.ServerScriptService:FindFirstChild("README") then
game.ServerScriptService.README:Destroy()
end
if game.ReplicatedStorage:FindFirstChild("SRAdminEvents") then
game.ReplicatedStorage.SRAdminEvents:Destroy()
end
if game.ServerStorage:FindFirstChild("Vehicles") then
game.ServerStorage.Vehicles:Clone().Parent = prevstufffolder
game.ServerStorage.Vehicles:Destroy()
end
if game.ServerStorage:FindFirstChild("Tools") then
game.ServerStorage.Tools:Clone().Parent = prevstufffolder
game.ServerStorage.Tools:Destroy()
end
local sp = game.StarterPlayer
local spcstuff = sp.StarterCharacterScripts:GetChildren()
local sppstuff = sp.StarterPlayerScripts:GetChildren()
for i=1,#spcstuff do
if spcstuff[i].Name == "CkVal" or spcstuff[i].Name == "Flying" or spcstuff[i].Name == "Frozen" or spcstuff[i].Name == "Rank" then
spcstuff[i]:Destroy()
end
end
for i=1,#sppstuff do
if sppstuff[i].Name == "ClientRecieve" then
sppstuff[i]:Destroy()
end
end
for i=1,#modelitems do
if modelitems[i].Name == "ReplicatedStorage" then
local events = modelitems[i]:GetChildren()
for i=1,#events do
events[i].Parent = game.ReplicatedStorage
end
elseif modelitems[i].Name == "ServerScriptService" then
local loaderscript = modelitems[i]:WaitForChild("SR_Loader")
loaderscript.Parent = game.ServerScriptService
prevstufffolder.Parent = loaderscript
print("Previous SR Framework & Config is located at: "..(prevstufffolder.Parent).Name)
elseif modelitems[i].Name == "README" then
local license = modelitems[i]
license.Parent = game.ServerScriptService
elseif modelitems[i].Name == "StarterCharacterScripts" then
local sc = game.StarterPlayer.StarterCharacterScripts
local scsitems = modelitems[i]:GetChildren()
for i=1,#scsitems do
scsitems[i].Parent = sc
end
elseif modelitems[i].Name == "StarterPlayerScripts" then
local sp = game.StarterPlayer.StarterPlayerScripts
local spsitems = modelitems[i]:GetChildren()
for i=1,#spsitems do
spsitems[i].Parent = sp
end
elseif modelitems[i].Name == "ServerStorage" then
local ss = game.ServerStorage
local ssitems = modelitems[i]:GetChildren()
for i=1,#ssitems do
ssitems[i].Parent = ss
end
end
end
model:Destroy()
warn("Successfully installed the SR Admin Panel.")
else
warn("Something went wrong with the installation process. Please try again")
end
local NoMUPAnim = tweenservice:Create(v.Main,TweenInfo.new(1),{Position = NewUIPos})
local NoBlurAnim = tweenservice:Create(newUIBlur,TweenInfo.new(1),{Size = 0})
NoBlurAnim:Play()
NoMUPAnim:Play()
NoBlurAnim.Completed:Connect(function()
newUIBlur:Destroy()
end)
NoMUPAnim.Completed:Connect(function()
v:Destroy()
end)
if v then
v:Destroy()
end
else
warn("Something went wrong with the installation process. Please ensure that you own the models before using the plugin.")
end
end)
end)