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

making a button to open a door?

Asked by 10 years ago

im trying to make a button that when is pressed a door will open i want to know how i can make the button and door interact with each other so that this could happen.. i already know how to make the door transparent and collide..i just want to know how this would translate to lua "if button pressed then do function blah blah"

2 answers

Log in to vote
2
Answered by 10 years ago

You will need to use a ClickDetector object. Insert it into the part you want to be clickable, and then use the MouseClick event inside of the ClickDetector. When the event fires, then you cause the door to open.

Ad
Log in to vote
1
Answered by 10 years ago

This is if they are click on the door itself

I know I am forgetting something but I don't know what it is

function onClicked ()
    script.Parent.CanCollide = false
    script.Parent.Transparency = 1
end

If you want it to be a button, just add another .Parent then add the name of the door after that Ex:

function onClicked ()
    script.Parent.Parent.Door.CanCollide = false
    script.Parent.Parent.Door.Transparency = 1
end

Answer this question