So I am making a game I the players would be given a task to kill npc’s.
I made a script for the detection but the problem is that my sword has 4 skills.
Works perfect but not for one of the 4 skills.
My skill uses 20 parts which touch on the NPC’s body it will lose health.
-5 health per part.
I used this script to to add the the kills to the leaderstats.
if V1.Humanoid.Health < 1 then
player.leaderstats.Kills.Value = player.leaderstats.Kills.Value + 1
if c:FindFirstChild("KilledNinjas") then
c.KilledNinjas.Value = c.KilledNinjas.Value + 0.05
end
end
Usually i should be one but here there are 20 parts so they add up to 20 kills.
I debugged a lot for this.
So I changed the 1(on the 2nd line) to 0.05(that mean 0.05 * 20 = 1).
I thought it would work but nope. After I debugged a lot for this too I found our that you can’t used decimal numbers for IntValue’s and NumberValue’s.
So I switched to StringValues to check if it works but there to Nope
Here is how I would do it :
first: I would give the plr a invisible value inside the Humanoid called Tag – that gets inside plr if hit with sword.
Tag is a objectvalue , Tag.Value = plr
Humanoid.Died:connect(function()
if Humanoid:findFirstChild(“Tag”) then
Tag.Value.KilledNinjas.value = …
end