I'm having a lot of trouble with a script in my game:
game.Players.PlayerAdded:connect(function(player)
wait(1)
game.ReplicatedStorage.UpdateStatus:FireAllClients()
player.Character.Humanoid.Died:connect(function()
print("HUMANOID DIED")
local playerNum
for i, plr in pairs(players:GetPlayers()) do
if plr == player.Name then
playerNum = i
print(player.Name .. "leaving game.")
end
end
table.remove(playersPlaying, playerNum)
print(player.Name .. "leaving game.")
end)
end)
Can someone explain to me why the .Died event only seems to run once? To my knowledge, it should run like this: player joins, event's connected. Whenever the player dies from that point on, the code will run. Is this not the case? If so, can someone explain why? Help is much appreciated.
