Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.