I’m doing something that takes a long time for a script to process and I need the script, not to TimeOut.
when I try to set the Script Timeout I get an error.
Players.ffancyaxax12.PlayerGui.LocalScript:11: attempt to index nil with ‘SetTimeout’
local scriptContext = game:GetService("ScriptContext")
scriptContex:SetTimeout(100)
You can only use SetTimeout() in plugins or the command bar. That means Scripts and LocalScripts are not able to call ScriptContext:SetTimeout() at all. Keep that in mind.
You have misspelled your variable name. It’s supposed to be scriptContext:SetTimeout(100), not scriptContex:SetTimeout(100).
You can change the timeout in studio’s settings, it’ll apply to the current place you’re editing:
Important to note that changing this setting only applies in studio and the script would exhaust in a live game. Additionally, the dev console command bar is not the same as the studio command bar and attempting to use SetTimeout from the dev console command bar would generate the same permission error as a regular script.
OP did not specify their specific use case, however if the resource intensive operation would need to be completed in a live server, strategically adding wait()s would allow the function to continue, and would minimize the impact on the server’s responsiveness. Not yielding during any resource intensive operation (i.e map load) can cause the server to become unresponsive until the operation completes.