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

Door opening onclick script not working? Not sure why.

Asked by 5 years ago

I have a door opening script and it's not working.

Script:

dooropen = script.Parent.Opened
doorclose = script.Parent.Closed

doorclose.Click:connect(function()
    doorclose.CanCollide = false
    doorclose.Transparency = 1
    dooropen.CanCollide = true
    dooropen.Transparency = 0
    wait(5)
    doorclose.CanCollide = true
    doorclose.Transparency = 0
    dooropen.CanCollide =false
    dooropen.Transparency = 1
end)

Thank you in advance.

0
Where are the scripts located? Pojoto 329 — 5y
0
Where are the scripts located? Pojoto 329 — 5y
1
inside a model that has a dooropen and doorclose. SloganRightHere 37 — 5y

1 answer

Log in to vote
3
Answered by 5 years ago

You need a click detector in doorclose. Also do this:

dooropen = script.Parent.Opened
doorclose = script.Parent.Closed

doorclose.ClickDetector.MouseClick:connect(function()
    doorclose.CanCollide = false
    doorclose.Transparency = 1
    dooropen.CanCollide = true
    dooropen.Transparency = 0
    wait(5)
    doorclose.CanCollide = true
    doorclose.Transparency = 0
    dooropen.CanCollide =false
    dooropen.Transparency = 1
end)

2
Thank you! SloganRightHere 37 — 5y
2
np titaneagle 0 — 5y
Ad

Answer this question