Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

making a button to open a door?

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

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.

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

This discussion is preserved as it was. New answers, comments, and votes are closed.