Hi everybody,
I’ve been having trouble understanding what’s going wrong in my code; I am trying to calculate ranks from a local script (with xp info sent via remote event).
Error: attempt to call a number value
local function setUpClientXp(xpAmount)
local rank = xpAmount/1000
local rankValue = ((rank - 0.5) - (rank - 0.5)%1) --Round our xp to nearest rank
local currentRankXp
if rankValue <1 then
rankValue = 0
else
currentRankXp = xpAmount - (rankValue(rankValue+1000)/2) --Error occurs here
end
end
I have tried the following:
- Using string.format, except I need the variable in number form for calculating some extra goodies, I have also tried using tonumber afterward with no success
- Replacing xpAmount with a number (to verify whether the info in remote event was not working)
This is probably a simple mistake on my end, but I’d really appreciate help.
Thanks for stopping by!