I need Help on a script that will reset your leaderbored stats When touching a part
game.Players.PlayerAdded:connect(function(p) local stats = Instance.new("IntValue") stats.Name = "leaderstats" stats.Parent = p local money = Instance.new("IntValue") money.Name = "Coins" money.Value = 50 money.Parent = stats end)
That's my leader bored script.
Add a script on the part, then put this code:
game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local money = Instance.new("IntValue") money.Name = "Coins" money.Value = 50 money.Parent = leaderstats end) script.Parent.Touched:Connect(function(otherPart) local humanoid = otherPart.Parent:FindFirstChild('Humanoid') local player = game.Players:FindFirstChild(otherPart.Parent.Name) player.leaderstats.Coins.Value = 0 --resets points print(player.Name.. " reseted points to 0!") -- you can remove this end)
Tell me when there's a problem.