Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Would this be buggy in my round-based game?

Asked by 3 years ago
Edited 3 years ago

I'm making this round-based game. At the end of each game it makes a gui visible that says; "You did it better than x%"

Would that be buggy?

Let's just say the module will return the amount of players that played the game;

local AmountOfPlayers = require(game.ReplicatedStorage.Modules.AmountOfPlayers)
local PlayersThatLost = require(game.ReplicatedStorage.Modules.PlayersThatLost)


function GetPercentage(v0)
   if tonumber(PlayersThatPlayedGame) > 0 then;
     local Percentage = (PlayersThatPlayedGame / AmountOfPlayers) * v0;
        return Percentage
     end
end)

local Percentage = GetPercentage(1)
local TextLabel = script.Parent
TextLabel.Text = "You did it better than; " .. tostring(Percentage) .. "% of people!"

0
I doubt it Robowon1 323 — 3y
0
you can get rid of the tonumber and tostring, it would just be better to have your module built to return a number in the first place SteamG00B 1633 — 3y
0
sure thanks! CaIcuIati0n 246 — 3y

Answer this question