Value change does not save

Hello, I was making a new rebirth UI for my game and when I tested it today in-game, every time you would gain your rebirths, and then used a sword, the players stats would just come back to normal.

Rebirth Script

local Frame = script.Parent.Parent
local Player = game.Players.LocalPlayer
local neededStr = Player.leaderstats.Coins -- this is the currency
local swing = Player.leaderstats.Swing -- other stat
local rebirths = Player.leaderstats.Rebirths -- rebirth stat
local Text = "REBIRTH FOR 500 COINS?" 
local amount = 500 -- amount they need to rebirth

	if neededStr.Value >= amount then
		swing.Value = 0
		neededStr.Value = 0
		rebirths.Value = rebirths.Value + 1 
		script.Parent.Text = "Success! You've gotten 1 Rebirths."
		script.Parent.Text = Text
		Player.Character.Humanoid.Health = 0

So it puts the Swing and Coin values to 0, and gives the desired amount of rebirths, but when they use a Sword to gain Swing again, it just gives the same amount.

How do I fix this?

I don’t think that this part of the code is the issue. From what you are talking about with swings of a sword it seems like an issue with the sword swinging script or what ever you use to add the sword swings.

If you want to as an example increase the amount of swings you get from a sword if you do a rebirth then you could use the datastore service to store how many rebirths they have and if the user has a curtain amount of rebirths it will change the amount that you get.