Im trying to make a game that you need exp to level up and I want to get the percent of how much exp they have. I put this line of code in part of my script but i keep ending up with -nan(ind)
local xp = player:WaitForChild("plrInfo"):WaitForChild("EXP") local xpneeded = player:WaitForChild("plrInfo"):WaitForChild("XPNeeded") local percentage1 = xp.Value/xpneeded.Value print(percentage1) local percentage2 = percentage1*100 print(percentage2) local percentage3 = math.floor(percentage2) print(percentage3) label.Text = percentage3.."%"
Your math here is right, so this may be one of the EXP values that are messing this up. Meanwhile, there is a simplified way to find the percentage.
local percentage = math.floor((xp.Value/xpneeded.Value)*100) label.Text = percentage.."%"