So im having an issue where if a player leaves in the middle of a round it breaks it due to it not removing them when they leave. I already have the script that removes them when they die but I don't know how to make it remove them when a player leaves.
Can someone help?
game:GetService('Players').PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild('Humanoid').Died:connect(function()
for i, v in ipairs(_G.gameplayers) do
if v == player.Name then
table.remove(_G.gameplayers, i)
break
end
end
end)
end)
end)
