How do you make a door open and close using green and red parts as its buttons?
You would insert a clickdetector
to the object that your going to click on.
Then you would make a onClicked
Script code line.
It would look like this:
function onClicked() if player onClicked then door.Transparency = 0 door.CanCollide = true end script.Parent.ClickDetector.MouseClick:connect(onClicked)
Learn the event MouseClick
and about the Object ClickDetector
Make a part called, "Door"
Then go into the green brick and insert a click detector
Put a script into the click detector and put in this script:
door = game.Workspace.Door function Clicked(Plr) door.Transparency = 1 door.CanCollide = false end script.Parent.MouseClick:connect(Clicked)
Then go into the red brick and put in a click detector, then into that a script.
In the script put:
door = game.Workspace.Door function Clicked(Plr) door.Transparency = 0 door.CanCollide = true end script.Parent.MouseClick:connect(Clicked)
If you do it right it should open and close the door
well first to change the color on click you would need to do something like this ( ALSO YOU NEED TO ADD A CLICK THING TO IT FOR THIS TO WORK)
function onClicked(OnPlayerClicked) script.Parent.BrickColor = BrickColor.red() wait(4.0) end some.click.ammount:Connect
That is a way and it is not a very good way either (note: you need to have the brick green) There are many faults there some of this is good but I Forgot the Click Values thing ( P.S. Im new to scripting to) (P.P.S. You do get Better at it ( Trust me ) )
Closed as Not Constructive by IcyEvil and youtubemasterWOW
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?