How to make tool damage with playerleaderstat

I’m trying to make the players tool damage is based on players leaderstat. But every time the damage value change, The damage stays the same.

-tool.Equipped:Connect(function()
	
	local chr = tool.Parent
	local plr = game.Players:FindFirstChild(chr.Name)
	local dmg = plr.Rescources.damage.Value
	print(dmg)
...

I have a button that gives the player a tool and changes the damage leaderstat to 10. But every time it prints the dmg, it stays 0.

Should i use Events or something? pls Let me Know

1 Like

it is inside a script. Do i need to put this in a local script?

Are you trying to damage the player, or change the damage stat?

Edit: No, you don’t. Keep it in the Script.

I am trying to damage the player but when I equip the tool, Instead of printing ‘10’ (damage value) it prints ‘0’ (in the leaderstat script, the damage is set to 0). Like the tool script doesn’t detect that the damage leaderstat value has changed.

Is your script in the button a LocalScript? If so, you need to use a Remote Event. Local Scripts execute client-side.

I am using a Local script for my button and It fires a remote event. It works fine. The only thing that works in the tool script is the animation not the damage.

In that case I need to see the snippet that changes the value.

Edit: Is there another script that’s changing the value?