# Function for finding rank number and stage of armour based on kills

So basically what I wanna do is to change my ranking up system, the concept is to increase the number of kills required by 5 every time you rank up. For reference let’s say you just started the game, you’ll need 5 kills to rank up, after you ranked up you need 10 kills etc. Now when you rank up you build an armour thing around your arm and there is 5 stages to it when its completed it like evolves and starts again from the first stage, so basically it takes 5 ranks up if you just started the game for it to return to stage 1. Basically what I need to figure out is how to make a function that will return the rank number and stage of the armour based on your kills. I’m bad at math so I have no leads, if anyone can help that’d be great.

``````Kills = 100
Rank = 1

Done = false
repeat
local Value = 0
for i = 1, Rank do
Value += i * 5
end
if Kills - Value >= 0 then
Rank += 1
else
Done = true
end
until Done == true
local Stage = 1
for i = 1, Rank do
if Stage < 5 then
Stage += 1
else
Stage = 1
end
end
print(Rank)
print(Stage)
``````

Pretty sure I found the solution, will test this soon

1 Like
``````KillsRequiredForRankUp = (CurrentRank + 1) * 5 --Assuming rank starts at 0.
``````

Here’s the general formula you’ll need.

1 Like

That doesn’t really help for anything that’s just the rank * 5

1 Like

You haven’t provided any code to work with so I just wrote a simple formula.

1 Like

Well the formula is too basic to be any help and I already found a solution but thank you anyways

So basically what I wanna do is to change my ranking up system, the concept is to increase the number of kills required by 5 every time you rank up.

The formula is exactly what you asked for though.

What I asked for is a function that does this: “Basically what I need to figure out is how to make a function that will return the rank number and stage of the armour based on your kills” what you provided had nothing to do with this, all you did was multiply the current rank with 5 which basically has no relevance to what I asked for.

all you did was multiply the current rank with 5 which basically has no relevance to what I asked for.

Incorrect, perhaps you should check the formula again.

``````Rank = 0, Kills = 5
Rank = 1, Kills = 10
Rank = 2, Kills = 15
``````

Look at the quote from this post.