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

button opening door?

Asked by 10 years ago

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

function lefttClick(playerWhoClicked)
script.Parent.Parent.trapdoor.Transparency=0.6
script.Parent.Parent.trapdoor.CanCollide=false
wait(2)
script.Parent.Parent.trapdoor.Transparency=0
script.Parent.Parent.trapdoor.CanCollide=true

end
Workspace.Part.ClickDetector.MouseClick:connect(function rightClick(playerWhoClicked)
do i have to include a if then statement?
or..

1 answer

Log in to vote
2
Answered by
bloxxyz 274 Moderation Voter
10 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,

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

Now, with your problem, try this:

script.Parent.ClickDetector.MouseClick:connect(function()
script.Parent.Transparency=0.6
script.Parent.CanCollide=false
wait(2)
script.Parent.Transparency=0
script.Parent.CanCollide=true
end)

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 — 10y
Ad

Answer this question