I have done this before, but i cannot figure out why it isn't working. the game im putting it in is FE, so that may be why. or i might be doing it differently from before, since it's been a while since i have done this,

the script doesnt remove player's UserId's from the table when they leave and it just keep them there,

it's a global player list, so i cant just get from players in the servers.

function playerAdded(player)			
	online:UpdateAsync("onlinep", function(old)
			onlineplayers = old or {}			
		table.insert(onlineplayers, player.Name)	
		return onlineplayers	
	end)
end

function playerLeft(playerl)
	for i,v in pairs(onlineplayers) do	
		if v == playerl.Name then	
		table.remove(onlineplayers, i)
		return onlineplayers
		end
	end
end

game.Players.PlayerAdded:Connect(playerAdded)
game.Players.PlayerRemoving:Connect(playerLeft)

it's been a while since i have done this and i can't find anything that works on the wiki, but it never worked.

4 comments

0

I would imagine that the problem lies with when you add their ID in, not when you remove it. Could we see that code?

0

it works because i get the player's name from the ID to put on the gui. but okay

0

i just changed it to player's names though because it's not saving data