Parent is nil?
I'm making a mining script. This script is in a tool and it is a LocalScript.
The error is this:
Local script:69: attempt to index field "Parent" (a nil value)
and this is the part of the script that fails:
01 | if hitt.Parent.hit.Value < 1 and hitt.Parent.Timber.Value = = 0 then |
02 | user.leaderstats.Gold.Value = user.leaderstats.Gold.Value + hitt.Parent.Gold.Value |
03 | hitt.Parent.Timber.Value = 1 |
Script Explanation:
The script checks if the hit object is called OreORE. If it is, Then it checks for multiple values, such as Timber and Hit. If the Timber is 0, OreORE is removed and a certain amount of Gold is given to the player.
Any help is appreciated. Thanks!