Hi!
I wonder why this code doesn’t work!
I tried cloning a part from serverstorage into workspace if the part was nil.
My code did nothing…
while true do
wait(0.01)
if script.Parent ~= nil then
wait(1)
print("Everything is fine!")
else
game.ServerStorage.InfJumpOrb:Clone().Parent = workspace
wait(1)
script:Destroy()
end
end
Well if the part’s parent is nil and it is the script’s parent I don’t think it will run. Because that means the script would be a descendant of nil. You need to have the script be somewhere else most likely.
while true do
wait(0.5) --This probably doesn’t have to loop as frequently. You could just check if it gets deleted instead using events. Actually it’s not even needed since it’s guaranteed to wait in both branches. Or you could delete the waits in the branches and leave this one at 1 second.
if game.Workspace:FindFirstChild(“InfJumpOrb”) then
wait(1)
print("Everything is fine!")
else
game.ServerStorage.InfJumpOrb:Clone().Parent = workspace
wait(1)
script:Destroy()
end
end