so im just watching peaspod tutorial, and i tried a other variation of a touch event and it doesnt work. can anyone explain why? heres the code:
function OnTouched() script.Parent.BrickColor = BrickColor.new("Baby blue") end script.Parent.Touched:connect(OnTouched)
I see nothing wrong with your code. Everything should work exactly as it should be. If that method didn't work for you, then maybe try to this (--comments
included.):
script.Parent.Touched:Connect(function() --Instead of connecting an existing function, let's connect an anonymous function instead, since we're using it only once. script.Parent.BrickColor = BrickColor.new("Baby blue") end)
Also, capitalise the Connect
as connect
is deprecated.