I would’ve compiled UI into code with [Free] Hierarchy Saver - Instance to code (Converter/Compiler)
Would’ve combined it with Narrowing the LuaBridge overhead (old)
The rest of the code is pretty fine.
Now you do need to hear me out. I know you are not very good yet, but you soon will be 101%.
What is LuaBridge overhead, you may ask?
Well, it’s essentially abusing the hell out of the Roblox API to be a perfect delight for VM to execute.
local SetProperty:(ins:Instance,prop:string,val:any)->()
local GetProperty:(ins:Instance,prop:string)->any
local GetService:(DataModel:DataModel,service:string)->Instance
xpcall(function():()
(game::any)[nil]=nil
end,function():()
SetProperty = debug.info(2,"f")::typeof(SetProperty)
end)
xpcall(function():()
return (game::any)[nil]
end,function():()
GetProperty = debug.info(2,"f")::typeof(GetProperty)
end)
So this way we obtained 2 functions, getter and setter, and as we know, Roblox instances are basically newproxy() with __index and __newindex attached to it.
Sadly, even integrated into Roblox API metatables (like this one), it does tax performance heavily, but this way we stop using metatables entirely.
Look for example code:
local Hi = Instance.new("Part") do
SetProperty(Hi,"Name","Lol")
SetProperty(Hi,"Parent",workspace)
end
print("Part's Name:",Hi)
And you can use do end this way to format code, as you can see.
Now what the hell is a Hierarchy Saver?
It’s essentially a plugin that converts selected instances into Luau code and has the option to compile with LuaBridge technique; you just have to go
Shared Settings → FastNamecalls →
Now you can select your UI, press Convert, and get code to reconstruct this UI 1 to 1.
That just made code harder to understand, more unreadable, and worse on performance.
Remember:
Abstraction shall not be learned, it shall be fought
Cut ze fluff, eat ze bug
Performance #1, everything else is cope.
As for now comrade ![]()
Your code is fine and clear; avoid abstracting it into tables.
