Roblox How to | Button that Teleports You to Other Games (2022)

Опубликовано: 28 Сентябрь 2024
на канале: OnFireRobloxScripting
57,201
1.1k

In this Roblox Studio Tutorial, I teach you guys step by step how to make a button that teleports you to other games when you click it!
Music used at the bottom of the description!

*This may be outdated, you can find the newer updated version here:    • Roblox How To | Button that Teleports...  

Script (To copy) I suggest watching the full video to understand how it works!

local teleport = game.ReplicatedStorage:WaitForChild("Teleportplayer") --Assigns a variable to the Remote Event in the Replicated Storage

script.Parent.MouseButton1Click:Connect(function() --Runs code when the button is clicked
task.wait(1) --Wait 1 second
teleport:FireServer() --Fire the Remote Event to the server
end) --End function

Script (Under the ServerScriptService)

local teleport = game.ReplicatedStorage:WaitForChild("Teleportplayer") ----Assigns a variable to the Remote Event in the Replicated Storage
local teleportservice = game:GetService("TeleportService") --Gets the teleport service in Roblox
local placeId = 6651677874 --Game Id, replace 6651677874 with your game Id
local players = game:GetService("Players") --Gets the players in the game
local player = players:GetPlayers()[1] --Gets the first player

teleport.OnServerEvent:Connect(function(player) --Code runs when the Remote Event is fired
teleportservice:TeleportAsync(placeId,{player}) --Teleports player to other game
end) --End function

My Discord server:   / discord  

Make sure to like and subscribe if you enjoyed it or if this video helped :)

Music Used:
Elektronomia - Sky High [NCS Release]
   • Elektronomia - Sky High | Progressive...  
Tobu - Candyland
   • Tobu - Candyland  

Tags: #roblox #robloxstudio #onfirerobloxscripting #tutorial