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

Is this right?

Asked by 10 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 10 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.)

isOn = false -- If the brick is transparent or not
door = game.Workspace.Part -- Change part to the name of the thing you want to be transparent
function on() -- Opening the door
isOn = true
door.Transparency = .5
door.CanCollide = false
end
function off() -- Closing the door
isOn = false
door.Transparency = 0
door.CanCollide = true
end
function check()--Decides whether to open the door or close the door
if isOn = false then--If door is closed then
on()
elseif isOn = true then--Otherwise, if the door is open then
off()
end
script.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 10 years ago

you dont need the functions just get rid of them.

Answer this question