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

Teleport surface gui?

Asked by 9 years ago

I tried a script I got from a youtuber (https://www.youtube.com/watch?v=-WBIcg-RDeE&safe=active) that allowed my character to teleport to a certain spot in my game. I put the following script in the StarterGui location:

local player = game.Players.LocalPlayer
workspace.Part.SurfaceGui.TextButton.MouseButton1Click: connect (function()
    if player.Character and player.Character:FindFirstChild("Torso") then
        player.Character.Torso.CFrame = CFrame.new(15, 15, 15)
    end
end)

Any bugfixes?

                            thanks a ton,
                                    A Nooby Scripter

Anything else I must add just comment.

0
Derp, sorry for putting the final message in a lua script box : ) kaiguy242 10 — 9y
0
Is there a part named 'Part' in workspace with a SurfaceGui named 'SurfaceGui' that has a text button named 'TextButton' ? ZeroBits 142 — 9y
0
I think so, ill check kaiguy242 10 — 9y
0
Hmmmm, still not working, and I dont know what else to do. kaiguy242 10 — 9y

1 answer

Log in to vote
-1
Answered by
Vid_eo 126
9 years ago

First up, put a new screen GUI into starter GUI. Then, put a Text Button into the screen GUI, and after that put a script into the TextButton. In the script, put this (Make sure you are teleporting to a spawn, and name the spawn SpawnLocation1.)

spawn = game.Workspace.SpawnLocation2 player = script.Parent.Parent.Parent.Parent

function onClicked() player.Character:MoveTo(spawn.Position) end

script.Parent.MouseButton1Down:connect(onClicked)

When you click on the GUI, the computer finds the position of the spawn, and moves the character to it.

I know this is a different GUI, but it's easier to type and you can easily make multiple of them (To make multiple, put a new spawn where you want to teleport, and name the spawn something else like SPawnLocation2, and just change the name of the spawn in the script.)

Hope it helps!

Ad

Answer this question