This repository was archived by the owner on Jul 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathLoadGui.lua
More file actions
64 lines (59 loc) · 1.43 KB
/
LoadGui.lua
File metadata and controls
64 lines (59 loc) · 1.43 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
local Scripts = { -- my guis
SynapseXI = 9651949832,
KrnlInternal = 9651942519,
CBSpectatorViewer = 9651945189,
CustomOutput = 9651951940,
Keystrokes = 9651923967,
WaypointManager = 8724458646,
SpotifyPlayer = 9651793707
}
local function LoadScript(x)
if x:IsA("Script") then
xpcall(coroutine.wrap(function()
local Fenv, FenvMt, RealFenv, Func = {}, {}, {
script = x
}, loadstring(x.Source, "=" .. x:GetFullName())
FenvMt.__index = function(a, b)
if RealFenv[b] == nil then
return getfenv()[b]
else
return RealFenv[b]
end
end
FenvMt.__newindex = function(a, b, c)
if RealFenv[b] == nil then
getfenv()[b] = c
else
RealFenv[b] = c
end
end
setmetatable(Fenv, FenvMt)
setfenv(Func, Fenv)
return Func()
end), warn)
end
for _, v in pairs(x:GetChildren()) do
xpcall(LoadScript, warn, v)
end
end
local function LoadGui(id, objectname)
if typeof(id) == "string" and Scripts[id] then
id = Scripts[id]
end
local success, object = xpcall(function()
return game:GetObjects("rbxassetid://"..id)[1]
end, warn)
if not success then return end
local name = ""
for _ = 1, 16 do
name ..= string.char(math.random(97, 122))
end
if syn then
syn.protect_gui(object)
end
object.Name = objectname or name
object.Parent = (gethui and gethui()) or (get_hidden_ui and get_hidden_ui()) or game.CoreGui
xpcall(LoadScript, warn, object)
return object
end
return LoadGui