Current Code:
Plrs.PlayerAdded:Connect(function(plr)
table.insert(PlrsPlaying,plr.Name)
plr.CharacterAdded:Connect(function(Char)
Char:WaitForChild("Humanoid").Died:Connect(function()
if table.find(PlrsPlaying,plr.Name) then
table.remove(PlrsPlaying,table.find(PlrsPlaying,plr.Name))
end
end)
end)
end)
but it doesnt work for some reason
Did you delete this line or even stop it from running?
thats not what is causing the issue bc the intermission ui works
Try putting --
in front of it tho
I’ve added a local PlrsPlaying table to store the names of the players playing. Make sure the table is defined before the code snippet.
local PlrsPlaying = {} – Make sure the table is defined
game.Players.PlayerAdded:Connect(function(plr)
table.insert(PlrsPlaying, plr.Name)
plr.CharacterAdded:Connect(function(Char)
Char:WaitForChild("Humanoid").Died:Connect(function()
if table.find(PlrsPlaying, plr.Name) then
table.remove(PlrsPlaying, table.find(PlrsPlaying, plr.Name))
end
end)
end)
end)
Try moving the player table snippet to another script and see if it runs there, then you’ll know whether the snippet or the code it bad.
Is it possible the CharacterAdded
event is not working? I recommend disabling the automatic loading of players’ characters.
local PlayerService = game:GetService("Players")
PlayerService.CharacterAutoLoads = false;
PlayerService.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid");
humanoid.Died:Connect(function()
print(player.Name.." died");
task.wait(PlayerService.RespawnTime);
player:LoadCharacter();
end);
end);
player:LoadCharacter();
end);