Hi everyone,
I have just recently started learning how to script in Roblox, and it has been great! However, I have a slight issue when I display a variable on a player’s GUI. Instead of displaying: “Orbs now spawn every 2.5 seconds”, it displays “Orbs now spawn every 2.500000 seconds.”
The code runs completely fine, it’s more of a visual issue. Is there any way to limit the number of decimal places that are displayed? I simply do not have any solutions to this personally, and the only info i could find online was rounding decimal places, so I’m sorry if this question has been asked as I could not find it.
Screenshot in-game:
Here’s the code for the GUI, I’m sorry if my code is horrible, I’m still learning:
if _G.goaltouched == true then
if _G.timer <= 1 then
_G.timer -= 0.1
local text = "%s has touched the goal! Orbs now spawn every %f seconds"
label.Text = string.format(text, _G.playername, _G.timer)
_G.goaltouched = false
else
_G.timer -= 0.5
local text = "%s has touched the goal! Orbs now spawn every %f seconds"
label.Text = string.format(text, _G.playername, _G.timer)
_G.goaltouched = false
end
end
Thank you! Any help is appreciated.