Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

[ANSWERED] How do I teleport myself to specific coordinates?

Hi, so I'm pretty new to Lua and I need help with my script. So basically I'm just trying to make it so that I can teleport myself to specific coordinates. Here's my current script that I made to try and teleport myself to specific coordinates. But it won't work, and I keep on getting an error through my output saying "21:05:04.287 - Workspace.Script:1: attempt to index nil with 'position'" And I just don't know how to fix it, can someone please help me?

game.Players.LocalPlayer.position = Vector3.new(0, 0, 0) -- The script that's giving me errors making it so that I can't make it teleport myself to specific coordinates.

4 comments

0

Also don't duplicate questions

0

Well my first question got taken down since it wasn't constructive, so I was just trying to re-make the question a little bit more better so that I can post my question without it getting taken down.

0

If you make duplicate questions then your question can also be taken down

2 answers

You cant do LocalPlayer in a script, (script = server, localscript = client) do it in a localscript instead

And you should use Position instead of position the latter has been deprecated

and player doesnt have .Position property, you need to reference the Character which has a PrimaryPart which does have .Position property

And you should CFrame property instead of Position since the character uses weldcontraints and when u change the Position it translates a new ofset for only that part, so it looks really weird

example as requested : localscript in StarterCharacterScripts

game.Players.LocalPlayer.Character.PrimaryPart.CFrame = CFrame.new(0,10000,0)

8 comments

0

You can't change the position of a Player

0

Can you give me an example on what to do? I'm still not understanding.

0

you can, it just doesnt do what you expect it to do since the character uses weldconstraints

0

Yeah I know, I'm trying to do that in a LocalScript and it still won't teleport me to the coordinates I told it to teleport me to.

0

i posted an example

0

VerdommeMan thank you so much dude. That example and you telling me where to put the script at helped me a ton.

0

you can mark your question as solved now, glad i could help

game:GetService("Players").LocalPlayer.Character:MoveTo(Vector3.new(-108.719, 4.132, -39.976))

1 comment

0

Random cords, Obviously put your own cords

This discussion is preserved as it was. New answers, comments, and votes are closed.