Attempt to Index Nil with Name [Tycoon]

I want to make a tycoon for me and my friends to play, but the collector for the dropped parts keeps making an error when I create the drops really fast (There is no error if I make the parts slowly). The game still works as normal however, which confuses me. The following images contains the error as well as the script where the error occurred.


The Error.


The Script where the error occurred.

I have come up with no solutions so far.

[EDIT: If I remove the error Hit.Parent.Name == "Part" and just leave it with Hit.Parent:FindFirstChild("CashValue") I get attempt to index nil with FindFirstChild as an error.]

Try this:

script.Parent.Touched:Connect(function(Hit)
if Hit.Parent ~= nil then
--the same code in the touched function
end
end)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.