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

Is this right?

Asked by 11 years ago

Heres the script function on() isOn = true script.Parent.Transparency = 0. script.Parent.CanCollide = true. end

function off() isOn = false script.Parent.Transparency = .5 script.Parent.CanCollide = false . end

2 answers

Log in to vote
2
Answered by 11 years ago

Assuming that you are calling this when you step on a certain brick. (Put this script inside of that brick that you want to call the functions when stepped on.)

01isOn = false -- If the brick is transparent or not
02door = game.Workspace.Part -- Change part to the name of the thing you want to be transparent
03function on() -- Opening the door
04isOn = true
05door.Transparency = .5
06door.CanCollide = false
07end
08function off() -- Closing the door
09isOn = false
10door.Transparency = 0
11door.CanCollide = true
12end
13function check()--Decides whether to open the door or close the door
14if isOn = false then--If door is closed then
15on()
16elseif isOn = true then--Otherwise, if the door is open then
17off()
18end
19script.Parent.Touched:connect(check)--When the script's parent is touched, it will start the function check.
Ad
Log in to vote
-2
Answered by 11 years ago

you dont need the functions just get rid of them.

Answer this question