So, my KO/WO script has mysteriously stopped working, and I don't recall (not just recall, I've reverted and grabbed the previous script, and it still doesn't work.) changing anything except removing a "Spree" value, and adjusted the script accordingly. I have no clue why this isn't working, and I don't even know how I can fix it. I've used my previous script, which failed, I just rewrote it, which failed.
It should also be noted that when you reset, the Death value will increase by one, and when you kill with the correct weapons, the kill value will increase by one.
The relevant scripting:
local pc = player.Character local function died() d.Value = d.Value + 1 local t = pc:FindFirstChild("Tag") if t then for i,v in pairs(game.Players:GetPlayers()) do if v.Name == t.Value then v.leaderstats.Kills.Value = v.leaderstats.Kills.Value + 1 end end end end pc.Humanoid.Died:connect(died) -- It used to be pc.Humanoid.Died:connect(function() instead of ---what it is now.
The above is what I believe to be the only relevant code, whoever, if I am mistaken, here is the full script.
game.Players.PlayerAdded:connect(function(player) repeat wait() until player and player.leaderstats and player.Character.Humanoid local l = player:FindFirstChild("leaderstats") local k = Instance.new("IntValue",l) k.Name = "Kills" k.Value = 0 local d = Instance.new("IntValue",l) d.Name = "Deaths" d.Value = 0 local pc = player.Character local function died() d.Value = d.Value + 1 local t = pc:FindFirstChild("Tag") if t then for i,v in pairs(game.Players:GetPlayers()) do if v.Name == t.Value then v.leaderstats.Kills.Value = v.leaderstats.Kills.Value + 1 end end end end pc.Humanoid.Died:connect(died) end) --[[ local t = Instance.new("StringValue", humanoid.Parent) t.Name = "Tag" t.Value = player.Name coroutine.resume(coroutine.create(function() wait(1) t:remove() end)) --]]
Finally, I know I'm using a StringValue. It's worked for me up until now. That, and I really have no idea how to use ObjectValue too well, and when I made the switch, the script either failed to work, or did the same as what it's doing now as far as I can remember.
Any help and replies will be ****extremely**** appreciated.