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

how do i make a player teleport to a certain spawn when a TextButton is clicked?

local waitingSpawn = game.Workspace.waitingRoom.waitingSpawn

local lobbySpawn = game.Workspace.Lobby.lobbySpawn
local textbutton = script.Parent.TextButton

i want it that when the player presses presses the textbutton you get teleported to lobbySpawn and it becomes your new spawn. Pls help me on this ;w;

Thanks!

  • Grazer022 ~ a learning scripter

1 comment

0

I would like to know if you're using ScreenGui or SurfaceGui.

1 answer

✓ Accepted answer

Changing the position of the player goes like this:

local humanoidRootPart = ect
local lobbySpawn = game.Workspace.Lobby.lobbySpawn

humanoidRootPart.Position = lobbySpawn.Position

3 comments

0

Or you could use CFrame

0

The thing with teleporting people with Vector3 is that it will kill the player. So you need to use CFrame.

0

thanks for the help!

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