I have a Brick with a ScreenGui with a Button that opens a door
I have a script for it, but it doesn't work.
PlayButton = script.Parent -- (It is a TextButton) door = PlayButton.Parent.Parent.Door -- (This is the door) function Play() door.CanCollide = false door.Transparency = 0.7 wait(3) door.CanCollide = true door.Transparency = 0 end PlayButton.MouseButton1Down:connect(Play)
This script doesn't work either:
PlayButton = script.Parent -- (It is a TextButton) door = PlayButton.Parent.Parent.Door -- (This is the door) function Play() door.CanCollide = false door.Transparency = 0.7 wait(3) door.CanCollide = true door.Transparency = 0 end PlayButton.MouseClick:connect(Play)
How do I fix this?
You are using the wrong methods
. Go to this link and scroll down to the Events
section.
debounce = false --Add a debounce so it doesn't spam. PlayButton = script.Parent -- (It is a TextButton) door = PlayButton.Parent.Parent.Door -- (This is the door) function Play() if not debounce then debounce = true door.CanCollide = false door.Transparency = 0.7 wait(3) door.CanCollide = true door.Transparency = 0 debounce = false end end PlayButton.MouseButton1Click:connect(Play)
PlayButton = script.Parent -- (It is a TextButton) door = PlayButton.Parent.Parent.Door -- (This is the door) debounce = false function Play() if not debounce then debounce = true door.CanCollide = false door.Transparency = 0.7 wait(3) door.CanCollide = true door.Transparency = 0 debounce = false end PlayButton.MouseButton1Click:connect(Play)