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

How to fix the leaderboard so don't add more KOs on when shooting the dead body?

Basically, I've recently scripted a gun. However, when I were to kill someone, they break into parts (as normal) when they die. The KO adds onto the leaderboard. When I shoot any of the parts of the body, the KOs increase each time. Help would be appreciated.

1 comment

0

Before you add the point to their stats say "if hit.Parent.Humanoid.Health == 0 then return end", that way you won't get points for shooting the dead guy

1 answer

✓ Accepted answer

this is an untested answer bc i dont know all your variables and such, but it should work.

this is also assuming you are doing this in a local script

local blullet = Instance.new(Part,tool)
local hum = bullet.hit.Parent.Parent.Character.Humanoid
local ko = Instance.new(leaderstat,game.Players.LocalPlayer)

while true do
if hum.Health = 0 then
ko.Value = ko.Value + 1
wait until -- This inserts a wait until variable, waiting until the humaniod that you killed returns to full health before restarting the while true do --
hum.Health == 100
end
end
end

1 comment

0

Thanks alot

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