Hey i really need some help fixing my Size error here

Hey so im trying to make the player collect points but touching a part. and i want to make a part in the player grow every 10 points. and for now i’ve made the code only if the value is bigger than 10 just to test it but it doesnt work for some reason. i would really like some help here. thanks!
There is no error msg if anyone is asking

local part = script.Parent
local value = math.random(1,4)
local function onTouch(otherPart)
	local hum = otherPart.Parent:FindFirstChild('Humanoid')
	if hum then
		local player = game.Players:FindFirstChild(otherPart.Parent.Name)
		if player then
			otherPart = player:FindFirstChild("TouchPart")
			player.leaderstats.Points.Value = player.leaderstats.Points.Value + value
			if(player.leaderstats.Points.Value > 10) then
				local DigPart = player:FindFirstChild("Dig")
				if DigPart then
					DigPart.Size = Vector3.new(10, 3, 10)

It looks like you’re giving 1-4 points whenever they touch the part, and then you’re destroying the part. This could be an issue and the reason it’s not firing is because you actually don’t have 10 points yet, so keep that in mind.

Another possible issue here is that you’re referencing “DigPart” as something in the player, but I’d assume that it’d be in the Character instead. Trying doing local DigPart = player.Character:FindFirstChild(“Dig”) instead of player and let me know if the issue still persists. There are other potential issues but I believe this is the most likely.

Yeah there isn’t only one part. there’s a couple. But i’ve tried it and it does work!
thank you so much!

1 Like