Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a player recieve KO's points on a leaderboard when killing an NPC?

I know partially how to make a player get KO points when they kill a regular player, but it doesn't work on NPC's.

1 answer

✓ Accepted answer

You could perhaps modify your weapons like this

EnemyHumanoid stands for the person/NPC you are hitting with the weapon

if EnemyHumanoid.Health > 0 then--This is to check if the person/NPC is alive, it could cause problems to damage a dead person
EnemyHumanoid:TakeDamage(50)--This damages the person/NPC with Damage (Change it by your needs!)
if EnemyHumanoid.Health < 0 then--This checks if the person is dead, if it is, the Player gets awarded.
Player.leaderstats.Cash.Value = Player.leaderstats.Cash.Value + 50--Rewards the player (Change it by your needs!)
end
end

Now if you want to edit your weapons, just replace the line, in which you find ":TakeDamage" with the script above.

Contact me, if you'd need further explanation.

2 comments

0

Yea, could you explain this a bit more please?

0

Okay, I've edited it abit.

This discussion is preserved as it was. New answers, comments, and votes are closed.