Hello,
So I am trying to script a system where if you click a button then it willl add u to a table and a UI baord thing but when you leave if you are on the board you get taken off and removed from the table. I have not worked with tables much and for some reason it will not remove the player.
I am also geting another issue where it will not remove the user from the board (I get an error for this but not the table removeal one)
Script:
– Add player on host board-
local Players = {}
game.ReplicatedStorage.HostStuff.AddPlayer.OnServerEvent:Connect(function(plr)
print("4454535")
if plr:GetRankInGroup(6559630) >= 20 then
print("ffffff")
if not Players[plr] then
print("Player is not in host system but now is.")
Players[plr] = true
else
print("Player is already in the host system")
end
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
if plr:GetRankInGroup(6559630) >= 20 then
if Players[plr.Name] then
print("Player who left is on the list")
if game.ServerStorage.CurrentHost.Value == plr.Name then
print("Host")
else
for i, v in pairs(game.Players:GetChildren()) do
if not plr then
v.PlayerGui.SurfaceGui.ListDown:FindFirstChild(plr.Name):Destroy()
end
end
Players[plr.Name] = false
print(Players)
end
end
end
end)
Error I get: