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

Simple touched function? [solved]

Hello, I'm new to scripting, could anyone help me with a touched function?

function touchies()
--bunch of stuff you don't need to know about
end
script.Parent:Touch(touchies)

1 answer

✓ Accepted answer

Line 4 is the problem, you put :Touch You need to put, .Touched:connect So here is the fixed script:

function touchies()
--stuff
end
script.Parent.Touched:connect(touchies)

And if you didn't know, there is an alternative way. Put line 4 into line 1 and change end to end) Like this:

script.Parent.Touched:connect(function()
	--stuff
end)

3 comments

0

Thank you!

0

Exactly what grenad said. I'd just like to add the fact that the second piece of code that Gren did is called an 'anonymous function'.

0

Wow, I didn't even know that myself.

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