Hello!
I’ve recently released a game and I’ve seen some players report an issue where they don’t teleport sometimes.
The game grabs a list of players that are gonna play by checking if the player has character and has humanoidrootpart and has AFK off.
Then, it sends the list to bindable event which teleports them to the map.
Code:
script.Parent.SetSpawns.Event:Connect(function(PlayingPlayers, Map)
local AvailableSpawns = {}
for _, v in pairs(Map.Spawns:GetChildren()) do
if v:IsA("Part") then
table.insert(AvailableSpawns, v)
end
end
for _, v in pairs(PlayingPlayers) do
if v.Character then
local hrp = v.Character:FindFirstChild("HumanoidRootPart")
if hrp then
local index = math.random(1, #AvailableSpawns)
local randomSpawn = AvailableSpawns[index]
hrp.CFrame = randomSpawn.CFrame
table.remove(AvailableSpawns, index)
end
end
end
end)
For some reason, someone always stays in the lobby and has the knife.
for _, v in pairs(game.Players:GetPlayers()) do
if table.find(AFKPlayers, v) == nil and v.Character then
if v.Character.PrimaryPart then
table.insert(PlayingPlayers, v)
end
end
end
Well, tbh I dont see anything wrong with the above script, which makes me think tht the AFKPlayers table must be malfunctioning. Can you send me the script which handles the AFKPlayers table @WondrousNinja?
I don’t think that’s the issue because the rounds work in a while loop to grab the players that are gonna play. If he doesn’t have a character he stays in the lobby and the game doesn’t recognize him as someone in the round.
The problem is they have already have a character loaded and humanoidrootpart too but they don’t teleport.