1

# button opening door?

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


2
bloxxyz 274
7 years ago

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