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

button opening door?

Asked by 11 years ago

hi guys this is my script but i dont know why it does not work

01function lefttClick(playerWhoClicked)
02script.Parent.Parent.trapdoor.Transparency=0.6
03script.Parent.Parent.trapdoor.CanCollide=false
04wait(2)
05script.Parent.Parent.trapdoor.Transparency=0
06script.Parent.Parent.trapdoor.CanCollide=true
07 
08end
09Workspace.Part.ClickDetector.MouseClick:connect(function rightClick(playerWhoClicked)
10do i have to include a if then statement?
11or..

1 answer

Log in to vote
2
Answered by
bloxxyz 274 Moderation Voter
11 years ago

Hi, to start this off, if you want to add comments to a script, instead of writing it out inside of the script, use the comment feature,

1--it looks something like this, just use 2 '--'s before writing something.

Now, with your problem, try this:

1script.Parent.ClickDetector.MouseClick:connect(function()
2script.Parent.Transparency=0.6
3script.Parent.CanCollide=false
4wait(2)
5script.Parent.Transparency=0
6script.Parent.CanCollide=true
7end)

One thing I should note is that the script should be inside of the brick that is going to be doing this. It makes scripts so much easier instead of working with a script outside of the part. Simply cut and paste the script inside of the part in Properties.

Also, leftClick I believe is not a valid event, so you would have to do MouseClick. I would recommend the following wiki article on ClickDetector and how it works, if you wanted to get more in-depth with scripts like this. http://wiki.roblox.com/index.php?title=Clickdetector

Give +1 rep if I helped.

0
do i put the script within the click detector..also i thought you could name your function anything so i named it leftlcick namelessassasin 30 — 11y
Ad

Answer this question