Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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.

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 cmgtotalyawesome 1418 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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
0
Thanks alot P_sychik 7 — 6y
Ad

Answer this question