In my tower defense game, the players get cash every time the wave is starting. But with my script I made which divides the amount of cash you get of how many players there are, it makes a huge decimal. Here is what it looks like:
I need there to be no decimals and just make it into a whole number. Here is the script of what I have:
local reward = 50 * math.round(wave / 1)
local devideReward = 1
if #game.Players:GetChildren() == 1 then
devideReward = 1
elseif #game.Players:GetChildren() == 2 then
devideReward = 1.5
elseif #game.Players:GetChildren() == 3 then
devideReward = 2
elseif #game.Players:GetChildren() == 4 then
devideReward = 2.5
end
if mode == "PettyWarfare" then
reward = 200 / devideReward + 50 / devideReward * wave
elseif mode == "Normal" then
reward = 200 / devideReward + 40 / devideReward * wave
elseif mode == "WorldWar" then
reward = 200 / devideReward + 33 / devideReward * wave
end
for i, player in ipairs(Players:GetPlayers()) do
player.Gold.Value += reward
end
info.Message.Value = "Wave Reward: $" .. reward
task.wait(2)
for i=5, 0, -1 do
info.Message.Value = "Next wave starting in..." .. i
task.wait(1)
end