door = script.Parent.Parent.Door function onClicked() door.Transparency = 1 door.CanCollide = false wait(2) door.Transparency = 0 door.CanCollide = true wait(3) script.Parent.ClickDetector.MouseClick:connect(onClicked) end
No Errors?
try this, you call the function inside the function so in order for it to work the function must have be called before
door = script.Parent.Parent.Door function onClicked() door.Transparency = 1 door.CanCollide = false wait(2) door.Transparency = 0 door.CanCollide = true wait(3) end script.Parent.ClickDetector.MouseClick:connect(onClicked)
EDIT: If you have the same problem make sure that the door or part is anchoired
The line below needs to be placed below "end" because you need to call the function before.
script.Parent.ClickDetector.MouseClick:connect(onClicked)`
Fixed script below:
door = script.Parent.Parent.Door function onClicked() door.Transparency = 1 door.CanCollide = false wait(2) door.Transparency = 0 door.CanCollide = true wait(3) end script.Parent.ClickDetector.MouseClick:connect(onClicked)