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 10 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
10 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:

function onClicked()
      if player onClicked then
door.Transparency = 0
door.CanCollide = true

end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

Ad
Log in to vote
2
Answered by 10 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 — 10y
0
Okay. BosswalrusTheCoder 88 — 10y
Log in to vote
2
Answered by
dreamy67 135
10 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:

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

Log in to vote
2
Answered by
IcyEvil 260 Moderation Voter
10 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)

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 ) )