I have 2 scripts: Client and server
The problem is on my server script, where I can't add players to a table
local PlayersToTeleport = {}
game.ReplicatedStorage:WaitForChild("MoveBus").OnServerEvent:Connect(function(plr, randomSeat)
randomSeat.Touched:Connect(function(TouchedPart)
if TouchedPart.Parent:FindFirstChild("Humanoid") then
local Character = TouchedPart.Parent
local Player = game.Players:GetPlayerFromCharacter(Character)
local AlreadyInTable = false
for _,OtherPlayer in next,PlayersToTeleport do
if OtherPlayer == Player then
AlreadyInTable = true
end
end
if not AlreadyInTable then
table.insert(PlayersToTeleport,Player)
end
end
end)
Can you help me fix it?

2 comments
And you fire the MoveBus event?
Use print()'s to determine where the function is running and where it is not running. It will help you out a ton.