So, I've been experimenting with player teleportation and I ran into an issue when trying to teleport a player, it keeps teleporting me to this game https://www.roblox.com/games/988567409/Lewisrebecca59s-Place when trying to teleport a player. This is the code I'm currently using.

local TeleportService = game:GetService("TeleportService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Player = game.Players.LocalPlayer
 
local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
 
local placeId = 2735733830 
local loadingGui = ReplicatedStorage:WaitForChild("LoadingGui") 
script.Parent.MouseButton1Click:connect(function()
 

loadingGui.Parent = playerGui
loadingGui.Enabled = true
 

TeleportService:SetTeleportGui(loadingGui)
 

TeleportService:Teleport(placeId)
end)

6 comments

0

that makes no sense

0

Please disregard, realized I had another script declaring Placed as a different variable ;/

0

You can submit an answer and mark it as accepted, or delete your question if you want.

0

^ Putting [Solved] in your title makes the question show it’s answered too I think.

0

You defined Player.LocalPlayer twice, use the Variable it's already tied to

0

This is a LOCAL script!? Why not a server script?