Okay, so this code ESSENTIALLY is SUPPOSED to end the round and kill all players once all players within the AliveCount table DIES accept the killer. It works... sort of.. after the killer kills 1 person it says the round ends even though there is another person alive. What's wrong with my script?
Also worth noting is all the objects in Alive is the players. They were placed there once the round started.
Ty for anyone who can help. This is really frustrating.
Also, if any of you ScriptingHelper LEECHERS are going to try and use my script for your own purposes: I HOPE YOU BURN IN HADES
--Killer Kills Everyone: THE BIG COMPLEX CODE-- for i,c in pairs(game.Players:GetPlayers()) do for i,v in pairs(alive:GetChildren()) do if c.Name == v.Name then table.insert(aliveCount, v) end c.Character.Humanoid.Died:connect(function(died) table.remove(aliveCount, i) if #aliveCount == 1 then --After Stuff-- for i,v in pairs(alive:GetChildren()) do v.Head:remove() end print("The killer has killed EVERYONE. MUAHAHA!") round.Value = ("gameover") Temphint = Instance.new("Message", game.Workspace) Temphint.Text = ("The Hitman has killed everyone. Hitman Wins!") gameOverMusic3:Play() killerGuiText:Destroy() gameChosenClone:Destroy() wait(5) Temphint:Destroy() RoundEndMain:Destroy() end end) end end
To be honest, I don't understand this script. It's not your fault it's just my limited knowledge of Lua. Try seeing if you've spelled the words correctly and make sure there is capitals in the right place.
Hope this helps.
Try putting this in after stuff:
for i,player in pairs(game.Players:GetChildren()) do player:LoadCharacter() --Sets back to regular spawn. end