Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I'm trying to make a door appear every 30 seconds how do I fix this?

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

0

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

0

ok

1 answer

Here's a complete fix.

    local dor = game.ServerStorage.door:Clone()
    wait(30)
    dor.Parent = game.Workspace
while true do
--This will make it disappear again.
    wait(30) --Or, you can change it to 2.
    dor.Transparency = 1
dor.CanCollide = false

wait(30) --Change it to 2 if you want to. 
--This will make it appear again.
 dor.Transparency = 0
dor.CanCollide = true
end

Hopefully this will work. If there is scripts in the door, do:

    local dor = game.ServerStorage.door:Clone()
    wait(30)
--Copy and paste the line below if you have more scripts
                              dor.ScriptName.Disabled = true
    dor.Parent = game.Workspace
while true do
--This will make it disappear again.
    wait(30) --Or, you can change it to 2.
    dor.Transparency = 1
dor.CanCollide = false
wait(30) --Change it to 2 if you want to. 
--This will make it appear again.
 dor.Transparency = 0
--Copy and paste the line below if you have more scripts
                              dor.ScriptName.Disabled = false
dor.CanCollide = true

My best answer, I'm not sure if it will work, not tested.

This discussion is preserved as it was. New answers, comments, and votes are closed.