Players sometimes teleport under map

Ok so idk why, but usually when i set the cframe of the characters pivot (tried changing rootpart cframe, but that doesnt change anything.) They spawn way below the spawnpoint.

I have tried searching for a fix but found nothing that worked so far.

Heres my code:

function roundmodule.TeleportPlayer(player)
local character = player.Character
character:PivotTo(workspace.Map:WaitForChild("Map").Spawn.CFrame)
end

Note: The spawns arent CanCollide off and are Anchored, the same for any ground below the spawns

Maybe the player gets teleported before the map fully loads in? Try adding a wait. This has happened to me before where the player spawns before the map fully loads, causing them to fall into space

Ok, i will try that and tell you if it worked

1 Like

anchoring their humanoidrootpart then tping then waiting a bit for the map to load before unanchoring also works. helps the client load it faster since its closer

1 Like

I’ve had issues with this in my own game. I would make sure when you teleport in your character doesn’t teleport halfway in the ground, or adding a task.wait() that waits a couple second before teleporting to ensure that the map has fully loaded in. Also I would recommend turning your spawn parts can collide off, as that could cause issues.

Maybe try using .Position instead of .CFrame and see if that works.

So you are using character:PivotTo(workspace.Map:WaitForChild("Map").Spawn.CFrame) but isn’t that to the center of the Map.
Are the spawn parts named Map? If they are where are they located? If the center of the Part is sitting at ground level then your Character is going to spawn into that point.
If the entire Map is a model named Map then of course you are going to spawn at the center of that.

Can you try adding an offset to the CFrame? By this, I mean can you try adding a Vector3 or CFrame to the CFrame to offset the position?

Example: offsetted = part.CFrame + Vector3.new(0,10,0)

The example I just provided should return the part’s CFrame, but with its Y value offset by 10. In simple terms, it returns the parts position but moved upwards by 10 studs/units.

You can apply this example in your own code, just change the Y value (or any other value if you want to change the other positions) to however much you want to move the characters upwards.

Okay sorry for late response, it seems to work now.
Thanks for all the people that helped me!

1 Like