I’m basically searching on whether or not the NumberValue “Time” reaches 1 or not and if it does, the script will execute a cloning sequence for a certain model so that it can reset the server’s play space (I’m making a sandbox game).
Thing is, I don’t know how to approach it other than using the “while true do” function, which isn’t always going to work, let alone do I think it is optimized enough to prevent lag if and when it needs to clone bigger models.
Here is my code that I have currently that checks for the value:
while true do
wait(0.00001)
game:GetService("ReplicatedStorage"):WaitForChild("SpecialCases")
local reset = game:GetService("ReplicatedStorage").SpecialCases["Server Reset"]:Clone()
if script.Parent.Time == 1 then
reset.Parent = workspace.Base.ItemHolder
reset.Name = "Scheduled Reset"
reset.Yeetandelete.Disabled = false
wait(10)
reset:Destroy()
end
end
Just in case you want to see the explorer to better understand the situation, here is the screenshot for it and the code:
If anyone could help it would be appreciated