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

How to properly teleport? No errors but it does not work.

Asked by 3 years ago

Hello ScriptingHelpers! I have a problem with teleport service, where I finally get no errors, but the teleportation never occurs. Here's the code. (This is in a server script, by the way.)

local ts = game:GetService("TeleportService")

local btn = script.Parent

local gameID = 6266940721

game.Players.PlayerAdded:Connect(function(player)
    plr = player
end)

local function teleporter(gameID, plr)
    local plr = game.Players:FindFirstChild(plr)
    print("Teleporting to game")
    ts:Teleport(plr, gameID)
end

btn.Activated:Connect(function()
    teleporter(gameID, plr)
end)

All help is appreciated!

0
You swapped the parameters of ts:Teleport(). The placeID comes first, then the player. Also it won't work on studio Dfzoz 489 — 3y
0
You swapped the parameters of ts:Teleport(). The placeID comes first, then the player. Also it won't work on studio Dfzoz 489 — 3y

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

Maybe you don't have it enabled on the studio settings. Try publishing your game to get access to those settings then navigate to, game settings>Security>Allow third party teleports.Enable it if its disable and test the script again. Hope this helps.

Ad

Answer this question