Attempt to index nil with "Equipped"

Im trying to make the proximity prompt show and trigger when the axe is equipped, its giving me an error tho. If you can solved this I would appreciate your time!

-- Variables

local SS = game:GetService("ServerStorage")
local WS = game:GetService("Workspace")
local Tree = script.Parent.Parent
local Stump = script.Parent
local PP = Stump.ChopTree

PP.Triggered:Connect(function(player)
	local Axe = player.Backpack:FindFirstChild("Axe")
	Axe.Equipped:Connect(function()
		player.leaderstats.Wood.Value += 1
	end)
end)

1 Like

print type of variable Axe please

...

	local Axe = player.Backpack:FindFirstChild("Axe")
    print(typeof(Axe))
...
PP.Triggered:Connect(function(player)
	if player.Character:FindFirstChild("Axe") then
		player.leaderstats.Wood.Value += 1
	end
end)
2 Likes

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