It prints out the line “succesfully removed player from the table” However it doesn’t actually remove the player from the table
script.Parent.ProximityPrompt.Triggered:Connect(function(plr)
local plrId = game.Players:GetUserIdFromNameAsync(plr.Name)
local char = game.Workspace[plr.Name]
if table.find(playersInTable,plrId) then
table.remove(playersInTable,plrId)
print("succesfully removed player from table!")
plr:LoadCharacter()
else
if not table.find(playersInTable,plrId) then
table.insert(playersInTable,plrId)
print("Succesfully added player in the table!")
for i, spawnPoint in pairs(spawns) do
char:FindFirstChild("HumanoidRootPart").CFrame = spawnPoint.CFrame
char:FindFirstChild("HumanoidRootPart").Anchored = true
table.remove(spawns,i)
end
end
end
end)
Thanks in advance