newbie here, im trying to make a sliding door but i don't know what's wrong.
gate = script.Parent.Parent.Gate
active = script.Parent.Parent.Bool
condition = script.Parent.Parent.Condition
function onClick()
if active.Value == true then
if condition.Value == false then
active.Value = false
print("opening...")
for i = 1, 28 do
gate.Position = gate.Position + Vector3.new(0.5, 0, 0)
wait(.1)
end
condition.Value = true
active.Value = true
else
active.Value = false
print("closing...")
for i = 1, 28 do
gate.Position = gate.Position - Vector3.new(0.5, 0, 0)
wait(.1)
end
condition.Value = false
active.Value = true
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClick()

4 comments
Good idea, thanks.
wait do you want a sliding door or a door that just opens like teleporting to a new position? cuz if its teleportation i can do it C:
i made a model for it, its rlly different but feel free to use it :D
https://www.roblox.com/library/904992801/Sliding-Door