Our game Light Game is a game composed of several mini-games, and between each mini-game, players are teleported back to the lobby, where they must enter a zone in order to enter the next mini-game. For teleportation, we use Model:SetPrimaryPartCFrame on the players.
Recently, it has come to our attention that in rare cases*, some players would return to their original position in the matchmaking zone immediately upon getting teleported to the mini-game. In all cases, they would obtain the mini-game actions and tools in the lobby, which means that the issue is not caused by another system written by us.
The teleportation is pretty basic and happens in the following function** which is used to admit players into the game:
Admission = function(Player)
local Char = Player.Character
if not table.find(Playing, Player) and Char and Char.PrimaryPart and Char.Humanoid.Health > 0 then
table.insert(Playing, Player)
Player.Playing.Value = true
local X = Game1.Area.Position.X + math.random(-Game1.Area.Size.X / 2 + 5, Game1.Area.Size.X / 2 - 5)
local Z = Game1.Area.Position.Z + math.random(-Game1.Area.Size.Z / 2 + 5, Game1.Area.Size.Z / 2 - 5)
local RandomPos = CFrame.new(X, Game1.Area.Position.Y, Z)
Char:SetPrimaryPartCFrame(RandomPos)
PlayerRemote:FireClient(Player, "PassPrompt", "DoubleSpeed")
task.spawn(GiveGun, Player)
end
end
I would think that the issue might be happening because of high latency on the players’ end, or maybe anti-cheat acting, but again, it is the server that does the teleportation.
We are open to any-and-all possible fixes and ideas. Thank you for your support.
*It is worth noting that in an average server, around 50 players enter the matchmaking zone. 2-3 return due to the issue.
**The admission function is a bit different for every game mode, but the creation of the CFrame and the teleportation remain the same. The issue also happens in every game mode.