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

I tried making a teleport player to coordinates GUI and I got an error?

Asked by 5 years ago
Edited by Azarth 5 years ago

Here is the code

--Strings
local Playername = game.StarterGui.ScreenGui.Player.Text
local Coordinates = game.StarterGui.ScreenGui.Coordinates.Text
--Script
script.Parent.MouseButton1Click:Connect(function() 
    Playername.HumanoidRootPart.Position = Coordinates
end)

Also here is the UI so you get the point https://gyazo.com/439995b389db1a07c1b06a06a01bc333

And this is the error I received when I attempted to test it https://gyazo.com/4bb4174f24bbc8be9c94b203bbc7d509

0
i mean use the Vector3 thingy, try dat Clasterboy 72 — 5y
0
But it didn't say anything about the coordinates All it said that it couldn't find my Humanoid Root Part VoidKeyword 111 — 5y
0
then find the character like ; local player = game.Players.LocalPlayer ,,, local ch = player.Character Clasterboy 72 — 5y
0
I need to find any player I type though. VoidKeyword 111 — 5y
View all comments (3 more)
0
u mean a certain player or what Clasterboy 72 — 5y
0
I want to make a fill in th blank where it teleports the player I typed so It can't be local player VoidKeyword 111 — 5y
0
find the character in the workspace Clasterboy 72 — 5y

1 answer

Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

This is because you’re referencing to the Player Object, instead of the Character, your issue should easily be resolved by writing this in your Mouse Event.

script.Parent.MouseButton1Click:Connect(function()
   local Character = workspace[Playername]
   Character:MoveTo(Coordinates).p + Vector3.new(0,3,0)
end)

Hope this helps, don’t forget to accept and upvote! Something wrong? Comment!

I understand :MoveTo() might be new to you, if you’d like to learn more, see this website

0
Additionally, you won't be able to change your position in a local script. You'll need to write it into a server script and use remote functions to trigger it in the GUI clc02 553 — 5y
0
I tried in cooperating that but I got a different error. https://gyazo.com/e09de7a50803d99a785fbfacb805679f VoidKeyword 111 — 5y
0
Uhhh I don't know how to use a remote function can you explain? VoidKeyword 111 — 5y
Ad

Answer this question