I was able to come up with a good core system that has worked for me very well. While wait is often frowned upon, it works really well here, and it doesn’t cause any notable lag for the short amount of time this code is active. When calling this function locally, make sure that you put it in a coroutine.wrap() so whatever else runs after it isn’t halted for the short period of time it takes for this to complete (unless that’s what you want.) It completely stops and frees up your memory when it’s done, thanks to Lua’s Automatic Garbage Collection:
[‘LoadRobloxCore’] = function(CoreType, CoreProperty, Toggle)
repeat
local success = pcall(function()
if CoreType == "SetCore" then
game.StarterGui:SetCore(CoreProperty, Toggle)
elseif CoreType == "SetCoreGui" then
game.StarterGui:SetCoreGuiEnabled(CoreProperty, Toggle)
end
end)
wait(0.02)
until
success
end;
Hope this utility function helps you as much as it’s done for me!