Im trying to make a kill streak script, but the issue is, my script doesn’t work and it’s not erroring. In 5 seconds, it’s supposed to check if the person who killed the player who joined is still in the game, and then after that it’s supposed to check if the player got 3 kills, but it never checks because even though I added a print function if the player got 3 kills (which I made it so one kill = 3 for debugging purposes), but the print function never fires, and I receive no errors in the Output.
Script:
local RunService = game:GetService("RunService")
game:GetService("Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local kills = Instance.new("IntValue",character)
kills.Name = "kills"
character:WaitForChild("Humanoid").Died:Connect(function()
if character.Humanoid:FindFirstChild("creator") then
local Player = character.Humanoid.creator.Value
local killerCharacter = Player.Character
local Kills = killerCharacter:WaitForChild("kills")
Kills.Value += 3
local creator = character.Humanoid:FindFirstChild("creator")
while task.wait() do
if killerCharacter then
task.wait(6)
if Kills == 3 then
print("yay")
end
end
end
end
end)
end)
end)