So I'm making a elevator game and im trying to have an elevator door appear every 30 seconds, the floors end every 30 seconds but for some reason the timing with the door is off, ill show a portion of the floor script which is fine, then the door script.
-- this script is fine
elseif floor == 4 then
wait(2)
ooo = game.ServerStorage.FLOORS.BOSSFIGHT1:Clone()
ooo.Parent = game.Workspace
ppp = game.ServerStorage.Weapons.sword:Clone()
ppp.Parent = game.Workspace
wait(30)
ooo:Destroy()
ppp:Destroy()
end
end
here is the one that i cant fix.
while true do
local dor = game.ServerStorage.door:Clone()
wait(30)
dor.Parent = game.Workspace
wait(2)
dor:Destroy()
end
Ive tried messing with the door script and i dont want to add it to my floor script because then i have to write more code

2 comments
Try putting the local dor = game.ServerStorage.door:Clone() outside of the looped function, make sure to remove the 'local' as it's outside of the function
ok