How would i remove a player from a table quickly in my script?
–Heres The Script
local playeruse = false
local tool = game.ReplicatedStorage.BluePrint:Clone()
local user
local PlayerTable = {}
local function PlrAdded (plr)
task.wait(1)
PlayerTable[#PlayerTable+1] = plr
if playeruse == false then
user = plr.UserId
local char = plr.Character or plr.CharacterAdded:Wait()
print("check")
tool.Parent = char
playeruse = true
end
end
local function playerRemoved(plr)
if user == plr.UserId then
table.remove(?)
user = nil
playeruse = false
print("check")
for _, player in pairs(game.Players:GetChildren()) do
local randPlayer = math.random(1, #PlayerTable)
local char = randPlayer.Character or randPlayer.CharacterAdded:Wait()
tool.Parent = char
end
end
end
game.Players.PlayerRemoving:Connect(playerRemoved)
game.Players.PlayerAdded:Connect(PlrAdded)