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

how can i make an object open/close?

Asked by 8 years ago

how can i make a door or any other objects to click on them and open or close?

1 answer

Log in to vote
0
Answered by
Cesire 45
8 years ago

That is very simple, here's how to do it.

Step 1: Build your door.

Step 2: Insert a ClickDetector inside your door.

Step 3: Insert a Script inside your door.

Step 4: Copy and paste the following coden into the script

local isDoorOpen = false
local door = script.Parent
local click = door.ClickDetector

click.MouseClick:connect(function()
if isDoorOpen == false then

door.Transparency = 1
door.CanCollide = false

else

door.Transparency = 0
door.CanCollide = true

end



Ad

Answer this question