Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
vInUe96 -5
4 years ago
Edited 4 years ago

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.

0
Also don't duplicate questions User#30567 0 — 4y
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. vInUe96 -5 — 4y
0
If you make duplicate questions then your question can also be taken down User#30567 0 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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)
0
You can't change the position of a Player User#30567 0 — 4y
0
Can you give me an example on what to do? I'm still not understanding. vInUe96 -5 — 4y
0
you can, it just doesnt do what you expect it to do since the character uses weldconstraints VerdommeMan 1479 — 4y
View all comments (4 more)
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. vInUe96 -5 — 4y
0
i posted an example VerdommeMan 1479 — 4y
0
VerdommeMan thank you so much dude. That example and you telling me where to put the script at helped me a ton. vInUe96 -5 — 4y
0
you can mark your question as solved now, glad i could help VerdommeMan 1479 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
game:GetService("Players").LocalPlayer.Character:MoveTo(Vector3.new(-108.719, 4.132, -39.976))
0
Random cords, Obviously put your own cords xd_Lxcifer -3 — 4y

Answer this question