Anyway there was a problem that happened when making a killstreak tool
Basically I'm making a tool called: "Death Scythe" that does 20 damage, also If the scythe hits someone with 20 HP or below (I haven't added the feature that causes the event when the HP Is below 20 or something) the head will be deleted by the user, and gets a kill, which makes them stronger, the problem Is that It doesn't give kills when It kills a user
Damage script (Under the slash script):
local KillStreakGUI = script.Parent.Parent["Killstreak GUI"] local GetKillReady = script.Parent.GetReadyForKill Handle.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid then humanoid:TakeDamage(20) if humanoid.Health == 20 then humanoid.Parent.Head:Destroy() KillStreakGUI.Value.Value = KillStreakGUI.Value.Value +1 GetKillReady:FireClient() end end end)
Local script (Get ready for getting a kill):
local GetKillEvent = script.Parent.Parent.GetKill local GetKillReady = script.Parent.GetReadyForKill GetKillReady.OnClientEvent:Connect(function() GetKillReady:FireServer() end)
Add kill script (Server script):
local KillStreakGUI = script.Parent["Killstreak GUI"] local GetKill = script.Parent.GetKill GetKill.OnServerEvent:Connect(function() KillStreakGUI.TextLabel = KillStreakGUI.Value.Value +1 end)
Do you have a leaderstats? If you want a kills on it should look like this:
local Kills = Instance.new('IntValue', leaderstats) Kills.Name = 'Kills' Kills.Value = 0 local Deaths = Instance.new('IntValue', leaderstats) Deaths.Name = 'Deaths' Deaths.Value = 0 local Players = game.Players Players.PlayerAdded:Connect(function(player) wait(1) local Stats = leaderstats:Clone() Stats.Parent = player local Deaths = Stats.Deaths player.CharacterAdded:Connect(function(Character) Deaths.Value = Deaths.Value + 1 local Humanoid = Character:FindFirstChild("Humanoid") if Humanoid then Humanoid.Died:connect(function() for i, Child in pairs(Humanoid:GetChildren()) do if Child:IsA("ObjectValue") and Child.Value and Child.Value:IsA("Player") then local Killer = Child.Value if Killer:FindFirstChild("leaderstats") and Killer.leaderstats:FindFirstChild "Kills" then local Kills = Killer.leaderstats.Kills Kills.Value = Kills.Value +1 end return end end end) end end) end)
You don't have to add the deaths. Make sure you include the bottom part about kills. When the players head is off, the player should then die, so that it counts towards the kill on the leaderboard. Hope this helps!