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:

if hitt.Parent.hit.Value < 1 and hitt.Parent.Timber.Value == 0 then --Error here.
		user.leaderstats.Gold.Value = user.leaderstats.Gold.Value + hitt.Parent.Gold.Value
		hitt.Parent.Timber.Value = 1
		wait(resettime)
	else
		wait(1)
	end
	end
	ting = 0
	end
end

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!

5 comments

0

I forgot: It also subtracts 1 from Timber every time it hits the ore.

0

Where is line 69 at?

0

@PreciseLogic he commented where the error is. He only posted part of his code, rather than posting the entire thing. Look at line 1

0

Would be really useful if you gave us a picture of the hierarchy with your question!!!!

0