so my goal here is that when you touch the part you get teleported, get 50 cash depending on how many rebirths you have. But when i have 1 rebirth, and i touch the part, it gives me 50 cash instead of 100 cash. Here's the script:
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local leaderstats = player:WaitForChild("leaderstats")
local Cash = leaderstats.Cash
local Rebirths = leaderstats.Rebirths
local Gems = leaderstats.Gems
if Rebirths.Value > 0 then
Cash.Value = Cash.Value + (50*(Rebirths.Value + 1))
Gems.Value = Gems.Value + Rebirths.Value
else
Cash.Value = Cash.Value + 50
end
player.Character:SetPrimaryPartCFrame(CFrame.new(script.Parent.Parent.TeleportPart.Position))
end)
Can someone help me fix this problem? Or maybe even explain why i got the script wrong?

2 comments
idk maybe try changing else with elseif
Before your if-statement, please try print(Rebirths.Value). It is possible that you are not incrementing the Rebirths correctly elsewhere and that it is 0 by the time you run this script.