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
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
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.
you dont need the functions just get rid of them.
This discussion is preserved as it was. New answers, comments, and votes are closed.