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

Can you use the localplayer when teleporting?

Asked by 5 years ago

Can you use the LocalPlayer when teleporting?

0
No. Teleporting from server to server cannot be done from the client. DeceptiveCaster 3761 — 5y

1 answer

Log in to vote
1
Answered by
VitroxVox 884 Moderation Voter
5 years ago

Well i don't really know what you meant by that but here an example hope this is what you're looking for!

local TeleportService = game:GetService("TeleportService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")

local placeId = 0 -- replace here
local loadingGui = ReplicatedStorage:FindFirstChild("LoadingGui") -- replace here

-- parent the loading gui for this place
loadingGui.Parent = playerGui

-- set the loading gui for the destination place
TeleportService:SetTeleportGui(loadingGui)

-- teleport the user
TeleportService:Teleport(placeId)

^^ From roblox's source ^^

0
I understand most of it, however i cant understand the playerGui part, can you explain it for me. I will remember to accept your answer. AndriusTheGreat 140 — 5y
1
Well that's a custom thing example as if you want them to have like an custom loading screen while getting teleported then you shall use that, if not just remove the "TeleportService:SetTeleportGui(loadingGui)" part with the "local loadinggui" and "loadingGui.Parent = playerGui" ,it will still tp but without having a custom GUI with it. VitroxVox 884 — 5y
Ad

Answer this question