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

NONE of my training scripts working?! Even though I am sure I wrote them correct!

Asked by 6 years ago
Edited 6 years ago

Hello! Okay so, I am a begginer at scripting. So now I know a Little I wanted to practise and experiment. But none of my scripts I write work!! Here is one I wrote and it does not work:

script.Parent.ClickDetector:connect(function() script.Parent.BrickColor = BrickColor.new ("Pink") end)

Yes, I have a click detector in the block. And on Youtube PeasFactory uses this and it works, but not for me. There is nothing in the output either :/ Please help me.

1 answer

Log in to vote
0
Answered by
UgOsMiLy 1074 Moderation Voter
6 years ago

Use MouseClick. It is an event of the ClickDetector that fires when you click on it. Connect it to the function and it will work.

script.Parent.ClickDetector.MouseClick:Connect(function(player)
    script.Parent.BrickColor = BrickColor.new("Pink")
end)

Also, use Connect, as connect is deprecated. Not that it was the reason your script didn't work, because it wasn't but it is better to use non-deprecated functions.

Ad

Answer this question