I am making a PVP survival game and depending If the player won the round or not then they get awarded “Money” and I am coding the part where when the player dies then they only get 5 “Money” but if they win then they get 10 “Money” But It is not working for some reason I can’t figure out is instead of the player getting 5 “Money” they get a lot more than what I wanted them to get here is my code:
Server Script
game:GetService('ReplicatedStorage'):WaitForChild('Events'):WaitForChild('RemoteEvents'):WaitForChild("GameEvents"):WaitForChild('Give5Money').OnServerEvent:Connect(function(player)
task.wait(3)
local money = player:WaitForChild('leaderstats'):WaitForChild('Money')
print("MONEY VALUE BEFORE: " .. money.Value)
money.Value = money.Value + 1.5
print("MONEY VALUE AFTER: " .. money.Value)
end)
I am using 1.5 “Money” because when I tested it at the end of the round I got 8.5 “Money” when I only wanted it to give 5 and nothing more here is my local script code:
Local Script
if survived.Value == false then
moneyEarned.Value = 5
amountEarnedText.Text = "You Earned $"..moneyEarned.Value.."!"
game:GetService('ReplicatedStorage'):WaitForChild('Events'):WaitForChild('RemoteEvents'):WaitForChild("GameEvents"):WaitForChild('Give5Money'):FireServer(game.Players.LocalPlayer)
end
Thanks.