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

Why is hit a nil value in this Touched function?

Here is the line of code that errored:

boxCopy.Touched:connect(boxPrizeAwarder(hit, box, prize))
-- it says: "ServerScriptService.Script:32: attempt to index local 'hit' (a nil value)"

Why is it erroring? I thought that the first argument was always the part that hit the object. Is that not the case?

1 answer

✓ Accepted answer
boxCopy.Touched:Connect(function(hit)
	boxPrizeAwarder(hit, box, prize)
end)

1 comment

0

thank you

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