So I'm making a curtain type model that disappears when I click on the button and comes back within 5 seconds. I tried following a tutorial from the Wiki but it isn't working.
This is the hierarchy on Explorer:
This is the script:
Door = script.Parent.Parent.Door function onTouched(hit) Door.BodyA.Transparency= 1 Door.BodyB.Transparency= 1 Door.BodyC.Transparency= 1 Door.BodyD.Transparency= 1 Door.BodyE.Transparency= 1 Door.BodyA.CanCollide= false Door.BodyB.CanCollide= false Door.BodyC.CanCollide= false Door.BodyD.CanCollide= false Door.BodyE.CanCollide= false wait(5) Door.BodyA.Transparency= 0 Door.BodyB.Transparency= 0 Door.BodyC.Transparency= 0 Door.BodyD.Transparency= 0 Door.BodyE.Transparency= 0 Door.BodyA.CanCollide= false Door.BodyB.CanCollide= false Door.BodyC.CanCollide= false Door.BodyD.CanCollide= false Door.BodyE.CanCollide= false end script.Parent.Touched:connect(onTouched)
The script you posted is if you physically touch it. You need to change your connection line. I also added a debounce so the function doesn't keep spamming if people click it multiple times.
Door = script.Parent.Parent.Door on = false script.Parent.ClickDetector.MouseClick:connect(function() if on == false then on = true Door.BodyA.Transparency= 1 Door.BodyB.Transparency= 1 Door.BodyC.Transparency= 1 Door.BodyD.Transparency= 1 Door.BodyE.Transparency= 1 Door.BodyA.CanCollide= false Door.BodyB.CanCollide= false Door.BodyC.CanCollide= false Door.BodyD.CanCollide= false Door.BodyE.CanCollide= false wait(5) Door.BodyA.Transparency= 0 Door.BodyB.Transparency= 0 Door.BodyC.Transparency= 0 Door.BodyD.Transparency= 0 Door.BodyE.Transparency= 0 Door.BodyA.CanCollide= false Door.BodyB.CanCollide= false Door.BodyC.CanCollide= false Door.BodyD.CanCollide= false Door.BodyE.CanCollide= false on = false end end)
Locked by adark, SanityMan, and TheMyrco
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?