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

Button Door help? [closed]

Asked by 11 years ago

How do you make a door open and close using green and red parts as its buttons?

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?

4 answers

Log in to vote
3
Answered by
Moosee 62
11 years ago

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:

1function onClicked()
2      if player onClicked then
3door.Transparency = 0
4door.CanCollide = true
5 
6end
7 
8script.Parent.ClickDetector.MouseClick:connect(onClicked)
Ad
Log in to vote
2
Answered by 11 years ago

Learn the event MouseClick and about the Object ClickDetector

1
I tried to use it but it didn't work, I'm new to scripting... DrTacoaX -5 — 11y
0
Okay. BosswalrusTheCoder 88 — 11y
Log in to vote
2
Answered by
dreamy67 135
11 years ago

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:

1door = game.Workspace.Door
2 
3function Clicked(Plr)
4door.Transparency = 1
5door.CanCollide = false
6end
7 
8script.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:

1door = game.Workspace.Door
2 
3function Clicked(Plr)
4door.Transparency = 0
5door.CanCollide = true
6end
7 
8script.Parent.MouseClick:connect(Clicked)

If you do it right it should open and close the door

Log in to vote
2
Answered by
IcyEvil 260 Moderation Voter
11 years ago

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)

1function onClicked(OnPlayerClicked)
2script.Parent.BrickColor = BrickColor.red()
3wait(4.0)
4end
5some.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 ) )