Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

What's wrong with this sliding door script? i get nothing in output and door does nothing

Asked by 6 years ago

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()

1 answer

Log in to vote
0
Answered by 6 years ago

This might not be helpful, but try putting prints at some places, if it doesnt print thats where its wrong

0
Good idea, thanks. creeperhunter76 554 — 6y
0
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: lukebloxdaily 6 — 6y
0
i made a model for it, its rlly different but feel free to use it :D lukebloxdaily 6 — 6y
Ad

Answer this question