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 TextButton teleport a player to another place?

I'm trying to make it so when the player presses the TextButton, they would be teleported to a different place which is a side place of my game. However, it is obviously not working since I suck at coding. I checked Roblox Wiki and this is the best that I can do:

local PortalGui = script.Parent
local PortalFrame = PortalGui.PortalFrame
local PortalScrollingFrame = PortalFrame.PortalScrollingFrame

local TeleportService = game:GetService("TeleportService")
local World1ID = 1114619171
local Test = PortalScrollingFrame.TextButton

Test.MouseButton1Down:connect(function(player)
	TeleportService:Teleport(World1ID, player)
end)

This is the Roblox Wiki that I used.

Any help is appreciated!

2 answers

✓ Accepted answer

I can't really see your error, but this always works for me :

local teleportService = game:GetService("TeleportService")

Test.MouseButton1Down:connect(function(player)
teleportService:Teleport(1143381256)
end)

1 comment

0

Thanks for the help! It actually works! I just had to change the PlaceID and viola!

Put the following script in the button:

script.Parent.MouseButton1Click:connect(function()
--//Variables.
local player = game.Players.LocalPlayer
local playername = player.Name
-------------//-------------
game.Workspace:WaitForChild(playername).Torso.CFrame = Cframe.new(POSITION HERE)
end)

--Change "Torso" to "UpperTorso" if you're using R15.

2 comments

0

he was talking about another game not a location within the game -.-

0

That makes sense.

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