script.Parent.Touched:Connect(function(Object) local Player = game.Players[Object.Parent.Name] if Player.leaderstats.Coins.Value >= 100 then Player.leaderstats.Rebirths.Value = Player.leaderstats.Rebirths.Value + (Player.leaderstats.Coins.Value/100) Player.leaderstats.Coins.Value = Player.leaderstats.Coins.Value - (Player.leaderstats.Coins.Value/100) * 100 end end)
My coin value ends up being 0
You can use the / operator to check how many times 100 goes into the amount of coins the user has.
script.Parent.Touched:Connect(function(Object) local Player = game.Players[Object.Parent.Name] if Player.leaderstats.Coins.Value >= 100 then local RebirthsToAward = math.floor(coins/100) -- Preventing decimals Player.leaderstats.Rebirths.Value += RebirthsToAward Player.leaderstats.Coins.Value -= RebirthsToAward * 100 -- Subtracting the amount of coins necessary end end)