Why is the position always 0,0,0 when teleporting?

So I’m trying to teleport a player to a part but his teleport position always goes 0,0,0 for no reason, here’s the position of the part that I’m trying to teleport the player to: 103.98, 1.025, 5950.197

Here’s the script that I’m using:

Code
print(plrCharacter.PrimaryPart.Position) -- The player's primarypart position before the teleportation
print("===================================")
plrCharacter.PrimaryPart.Position = Vector3.new(workspace:FindFirstChild("StartPart",false).Position)
print(plrCharacter.PrimaryPart.Position) -- The player's primarypart position after the teleportation

And here’s the output:

output

1 Like

Try this

PlrCharacter:SetPrimaryPartCFrame(CFrame.new(workspace.StartPart.Position))) 

replacement for line 3

I fixed this issue by using the part’s position instead of referencing the part and then getting the position of it like this:

plrCharacter.PrimaryPart.Position = Vector3.new(103.98, 1.025, 5950.197)

But I still currently have no idea why it isn’t working when I reference the part and then get the part’s position instead of pasting the position directly so for people who are coming in the future who are having the same issue you just have to get the part’s position directly and then past it in like I did.

Does anyone know why this happens?

1 Like

Your method worked but mine works too, I heard that :SetPrimaryPartCFrame() has issues within it so I will just use my solution that I came up with because it’s probably better but thanks for trying to help anyways.

What issues, can I get a link? Describe the issues, I always use SetPrimaryPartCFrame, it works like magic, all it needs is a PrimaryPart, also using MoveTo can be useful

Here are some posts that talk about why it’s bad to use :SetPrimaryPartCFrame() and that you should avoid using it:

https://devforum.roblox.com/t/do-you-use-the-primarypart-property-of-models-and-if-so-for-what-purposes/673556/29?u=nerkonl This one is by @colbert2677 he says to avoid it at the end of the post and gives a reason why you should do that.

And here are people reporting issues about it:

SetPrimaryPartCFrame is only bad if you’re using it against a fully anchored model. If you have a model that’s completely unanchored or has at least one anchored part and every other part is connected together through welds, the inaccuracies issue does not occur.

I still hate SetPrimaryPartCFrame in any case and will avoid it like the plague. I prefer to directly set the HumanoidRootPart’s CFrame if I need to send the character somewhere.