How would I go about making it so that when an NPC is killed, it only drops items for players who did a certain amount of damage? Just needed so I can prevent boosting.
The way I would go about this is creating and saving the damage done by the players in a dictionary as the following:
--// Define the table to store players damage
local PlayerDamageTab = {}
--// Convert the damage to percentage
PlayerDamageTab[Player] = math.clamp(0,MaxHealth,Damage) / MaxHealth * 100
--// Then you can check for their damage
local PlayerDamage = PlayerDamage[Player]
if (PlayerDamage and PlayerDamage >= 15) then --// If player did 15% or more of it’s health then:
end
2 Likes