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

how to make a click detector door?

Asked by 10 years ago

I have a door but i need a click deco tor door

1 answer

Log in to vote
0
Answered by 10 years ago
a = Instance.new("ClickDetector")
a.Parent=game.Workspace.Part
variable = true

function onClick()
    if(variable=true)then
    script.Parent.Transparency=0.5
    script.Parent.CanCollide=false
    variable=false
    end
    if(variable=false)then
    script.Parent.Transparency=0
    script.Parent.CanCollide=true
    variable=true
end

script.Parent.ClickDetector.MouseClick:connect(onClick)

The code above should create a one button open and close door, not tested however.

0
ok thx jls12345678 0 — 10y
Ad

Answer this question