Hello, I’m trying to understand the inner working of how things works in order for Roblox’s code logic, as I’ve ran into almost unexplainable inconsistencies in the past. (Which I kindof know now)
I meant like… If you enable/parent/clone a script while the system is running (or even when the server first start), when will the content of this script start to run in a frame/tick based on scheduler’s priority list?
It will run at the same time the initial script is running. Known as cooperative multithreading. Falls into coroutine teritory. Doesn’t seem to go anywhere in the task scheduler frame by frame territory although it’s very difficult to see as it only happens at one frame.
If you put it in a loop like task.wait() it goes in heartbeat frame, and the cloned script will also run at the same time within the same frame in “parallel” cooperative multithreading.
while true do
debug.profilebegin("Script 2 Hello")
print("Script 2 Hello!")
local scriptTest = game.ServerStorage.Script:Clone()
scriptTest.Parent = game.ServerScriptService
debug.profileend()
task.wait()
end