Attempt To Call A Number Value

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!

You are attempting to call it here. I am not sure what you were trying to do here. Perhaps multiply?

1 Like

AAAAAAAAA, so that’s what it was. My small brain didn’t realize that multiplying with brackets in real life e.g. (4)(4) = 16, doesn’t always apply here. Thanks, I really appreciate the help!