In my game, you spawn in a spawnbox and is able to choose between 4 elements to play. After choosing an element, you are teleported to a random Spawnpoint in the map.
The issue is, there’s a small chance that, when you are teleported, your position for the server is about 20 studs below where you were supposed to be teleported to. This makes no sense because: for the character’s player who was teleported and the players who were in the game before they were teleported, they are in the correct position; while for the server and players who joined the game after they were teleported, they are in the wrong position.
It’s a small chance, but since it’s a fighting game, it’s very annoying when it happens because you have to fight an invisible player.
StreamingEnabled is disabled and the methods I’ve tried to teleport the character was using PivotTo()
(current one being used), setting the HumanoidRootPart’s Position or its CFrame.
This post was made because genuinely no other posts have helped me. I have found posts with similar issues, but none of their solutions worked. I’ve had this problem for months already.
Code:
-- inside the class choosed event:
local spawns = workspace.Spawns:GetChildren()
local chosenSpawn = spawns[math.random(1, #spawns)]
character:PivotTo(CFrame.new(chosenSpawn.Position + Vector3.new(0, 5, 0)))