My player list doesn’t seem to be correctly updating while playing the game, it only updates every time you reset, instead of in real time. It’s supposed to show new players joining and leaving the game and the GUI should automatically refresh, instead it’s just frozen until you re spawn and doesn’t give you an updated version of who’s on the server. Does anyone know what I am doing wrong? Any help is much appreciated
Code
game.Players.PlayerAdded:connect(update)
mouse.KeyDown:connect(function(key)
if string.lower(key) == "l" then
if ld.Visible then
game.Lighting.Blur.Size = 0
script.Parent:FindFirstChild("Open"):Play()
ld.Visible = not ld.Visible
elseif not ld.Visible then
ld.Visible = true
game.Lighting.Blur.Size = 15
script.Parent:FindFirstChild("Close"):Play()
end
end
end)
local listed = {}
local function Update(tag)
listed[player.Name] = tag
local function Remove(player)
if listed[player.Name] then
listed[player.Name]:Destroy()
listed[player.Name] = nil
end
end
game.Players.PlayerRemoving:Connect(Remove)
update()