How to make a touch part that removes all leaderstats?

Hi,

I have a part that gave me money, but now I want to remove it from my leaderstats as it’s saved. How do I do this?

local __PART = script.Parent

__PART.Touched:Connect(function(__HIT)
	if __HIT.Name == "HumanoidRootPart" then
		local __PLR = game:GetService("Players"):GetPlayerFromCharacter(__HIT.Parent)
		__PLR:FindFirstChild("leaderstats"):FindFirstChild("yourvaluethinghere").Value = 0
	end
end)

Hi, put this in server script

local Part = -- put the part here
Part.Touched:Connect(function(v1)
if v1.Parent:FindFirstChild("Humanoid") ~= nil then
game.Players:FindFirstChild(v1.Parent.Name).leaderstats:FindFirstChild("Money").Value = 0 --change "Money" to what you have named in leaderstats
end
end)

Is your money value an IntValue?

Yea it’s an int value in leaderstats folder

Whoopsies, wrong person to reply to. Sorry!

If your ‘Cash’ value is an IntValue then you can simply go into the said player’s leader stats folder, and set the value to 0 or alternatively :Destroy() it.