Exhaused allowed execution time on an "operating" system im making in roblox lua

How do i fix this error?

10:48:04.139  Players.Techononux3.PlayerScripts.OnBoot:8: Script timeout: exhausted allowed execution time  -  Client - ExecLib:16

OnBoot lua code

local storage = game.ReplicatedStorage
local lib = storage.Lib
local syslib = lib.System
local cmdlib = require(syslib.CmdLib)
local execlib = require(syslib.ExecLib)
cmdlib.clear()
cmdlib.printl("Booting Universal-system!")
local Rcode, hadError = execlib.exec(storage.Prgms.SysCtrl,true)

if hadError then
	print(Rcode)
	cmdlib.printl("Critical Error: "..Rcode)
end

ExecLib lua code

local storage = game.ReplicatedStorage
local lib = storage.Lib
local syslib = lib.System
local cmdlib = require(syslib.CmdLib) 
local Functions = {}

function Functions.exec(path, echo)
	if echo then
		cmdlib.printl("Launching " .. path:GetFullName())
	end

	local success, module = pcall(require, path)
	if success then
		local success2, result = pcall(module.run)
		if not success2 then
			return result, true
		end
		return result, false
	else
		return module, true
	end
end

return Functions

sysctrl, the program to run lua code

local storage = game.ReplicatedStorage
local lib = storage.Lib
local syslib = lib.System
local cmdlib = require(syslib.CmdLib) 
local winlib = require(syslib.WindowLib) 
local Functions = {}
function Functions.run()
	cmdlib.printl("HelloWorld")
	local window = winlib.createWin("SysCtrl",0.5,0.3,"  System control.")
	local button = Instance.new("TextButton")
	button.Parent = window.Body
	while true do
		if window.Dragging.value == true then
			button.ZIndex = window.Body.ZIndex - 1
			button.AutomaticSize = Enum.AutomaticSize.XY
			button.BackgroundColor3 = Color3.new(0.541176, 0.541176, 0.541176)
			button.Position = UDim2(0.1,0,0.1,0)
			task.wait(0.03)
			while window.Dragging.value == true do
				task.wait(0.1)
			end
		end
		
	end

end
return Functions

When window.Dragging.value is false, it doesn’t wait in the loop.

1 Like

Add a wait() inside this loop, while loops run extremely fast

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.