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

Teleport surface gui?

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.

4 comments

0

Derp, sorry for putting the final message in a lua script box : )

0

Is there a part named 'Part' in workspace with a SurfaceGui named 'SurfaceGui' that has a text button named 'TextButton' ?

0

I think so, ill check

0

Hmmmm, still not working, and I dont know what else to do.

1 answer

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!

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