so im making a door for my border game but the door script doesnt seem to work? well, it works, but the door ONLY expands down and doesnt retract. heres the script:
local gate = script.Parent
local button = gate.Parent["gate button"]
local clickdetector = button.ClickDetector
local debounce = false
local opened = false
clickdetector.MouseClick:Connect(function()
if debounce then return end
if opened == true then
debounce = true
for i = 16.5,0.5,0.25 do
gate.Position = gate.Position - Vector3.new(0,0.125,0)
gate.Size = gate.Size + Vector3.new(0,0.25,0)
end
opened = false
debounce = false
end
if opened == false then
debounce = true
for i = 16.5,0.5,0.25 do
wait(0.1)
gate.Position = gate.Position + Vector3.new(0,0.125,0)
gate.Size = gate.Size - Vector3.new(0,0.25,0)
end
opened = true
debounce = false
end
end)
thank you for your help :p

5 comments
maybe add a wait(.1) when ur closing it
maybe add a wait(.1) when ur closing it
oh... i forgot to do that... hold on
now it doesnt even work :/
add [Solved] to mark as self solved