Help on distributing the reward

I am making a boss system that distribute the reward by the players who damaged the boss.

			local damages = game.ServerStorage.Damages[boss.Name]
			for i,v in pairs(damages:GetChildren()) do
				if game.Players:FindFirstChild(v.Name) then
					local fullLife = boss.Config.FullLife.Value 
                    local reward = boss.Config.Reward.Value
					local damagedCaused = v.Value
             end
         end

I am trying to get how many percentage the damage caused is of the full life, to so give the obtained percentage of the reward. How can I do this?

1 Like

You divide damageCaused by MaxHealth.

Lets say Boss has 200 hp. Plr1 dealt 60 dmg, Plr2 dealt 120, Plr3 dealt 20.

maxHp = 200
plr1 = 60/200 -- 0.3
plr2 = 120/200 -- 0.6
plr3 = 20/200 -- 0.1
1 Like

Thank you very much, it worked

1 Like