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

Is this script correct?

Asked by 10 years ago

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)

3 answers

Log in to vote
0
Answered by 10 years ago

In the first line you need script.Parent.Parent other than that, perfect.

0
Thanks. ClassiclySmart 10 — 10y
Ad
Log in to vote
0
Answered by
Xduel 211 Moderation Voter
10 years ago

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

Log in to vote
0
Answered by 10 years ago

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)

Answer this question