I'm making a quest system and I want the player to receive half of what the quest wants the player to get in money.
1 | local plr = game.Players.LocalPlayer |
2 | local q = plr:WaitForChild( "QuestGrass" ) |
3 | local qa = plr:WaitForChild( "QuestActive" ) |
4 |
5 | script.Parent.Changed:Connect( function () |
6 | script.Parent.TextArea.Text = "Hey there can you get me " .. q.Value .. " Grass and I'll give you $" .. q.Value/ 2 .. " in return" |
7 | end ) |
To round numbers, you simply use the math.floor
or math.ceil
methods.
In a script, if you wanted to lets say round UP the value 0.5 you would use math.ceil. A good way to remember this is ceilings are UP hence math.ceil.
If you wanted to round DOWN a value lets say 2.2 you would use math.floor. You can remember this because floors are DOWN hence math.floor.
Hope this helps :)