[MATHS] How to detect a value that goes up every 5 times?

(please keep in mind that this is the first time i am attempting to make a skill point system because i don’t make level based games and i am garbage at maths

Okay, I am gonna give a long and boring explanation of what I am trying to attempt:

  • I am making a Skill Points system where every 5 points to the health stat increases your base max health by 5.

Example of my Skill Point system:
https://gyazo.com/076b0feec62be0d9fdcfead44d75beeb


The maths I made for increasing health:

local humanoid = char:WaitForChild("Humanoid")
humanoid.MaxHealth = humanoid.MaxHealth + 1 * (player.Data2.Health.Value) --[MY SKILL POINT HEALTH VALUE] 

What I want it to do
https://gyazo.com/4ba060940302aa8555b78917f86d9d4d

  • (the 100 value represents the health, the + 1 is just there, and the * and the number after that is supposed to be my skill point health value.)

So… What’s the issue?

  • I am trying to ask if there is a proper way of detecting player.Data2.Health.Value going up by every 5 values? as mentioned before I am trying to make the health go up by 5 EVERY 5 skill point health values.

Why not make it go up every 1 value increase instead of waiting until they get 5 health values?

  • I have noticed that my player base sometimes complains the lack of progress and how Exp and Levels only unlock new skills and that’s pretty much it and they want some sort of progress. I wanted to make something that is a little (the more value of something you have the stronger you are) but in a much smaller scale where people don’t have 10 Billion Damage or health etc.

Just add 5 to your multiplier. Unless I misunderstood.

Also possibly relevant:

local old = stat.Value

stat.Changed:Connect(function(new)
    if new - 5 == old then
        -- Do something
        old = new
    end
end)

I probably missed the question entirely but i’m super tired so if I did i’ll fix asap

1 Like

I would do exactly the same except use %

so it would be

stat: GetPropertychangedSignal ("Value"):Connect(function()
   if stat.Value % 5 == 0 then
       -- do something
   end
end)

Do you mean like
humanoid.MaxHealth = 100 + 5 * math.floor(player.Data2.Health.Value / 5)
The relation would be:

--	stat	maxhealth
	0-4		100
	5-9		105
	10-14	110
	15-19	115
--	and so on
3 Likes