I'm trying to make a button door and I would like to know if this script is correct.
door = script.Parent.Door button = script.Parent button.click(function(prt) door.Transparency = 0.1 wait(0.5) door.Transparency = 0.2 wait(0.5) door.Transparency = 0.3 wait(0.5) door.Transparency = 0.4 wait(0.5) door.Transparency = 0.5 wait(0.5) door.Transparency = 0.6 wait(0.5) door.Transparency = 0.7 wait(0.5) door.Transparency = 0.8 wait (0.5) door.Transparency = 0.935 door.CanCollide = false wait (5) door.Transparency = 0.8 wait(0.5) door.Transparency = 0.7 wait(0.5) door.Transparency = 0.6 wait(0.5) door.Transparency = 0.5 wait(0.5) door.Transparency = 0.4 wait(0.5) door.Transparency = 0.3 wait(0.5) door.Transparency = 0.2 wait(0.5) door.Transparency = 0.1 wait (0.5) door.Transparency = 0 door.CanCollide = true end) script.Parent.ClickDetector.MouseClick:connect(click)
In the first line you need script.Parent.Parent other than that, perfect.
Technically this is correct, but I'd suggest you use something called a "for loop" for setting the doors transparency. You can probably find information on them and the "while loop" on this cite, the roblox wiki, or even youtube. In fact here's a page on them: http://wiki.roblox.com/index.php?title=Loops
Isn't the function also defined incorrectly.? You'd only use that if you were defining it within the connection line..
function click() --code here end button.ClickDetector.MouseClick:connect(click)