Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is hit a nil value in this Touched function?

Asked by 6 years ago

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

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago
boxCopy.Touched:Connect(function(hit)
    boxPrizeAwarder(hit, box, prize)
end)
0
thank you User#21908 42 — 6y
Ad

Answer this question