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

OnTouched function doesnt connect, any ideas why?

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)

1 comment

0

Does anything appear in console?

1 answer

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.

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