Teleport Function Doesn't Work

So iv’e been woking on a teleportation script and every time it gives me an
Bildschirmfoto 2020-10-03 um 00.39.58
error
iv’e tried changing it up and and tried switching from LocalScript to Normal and nothing works
so now iv’e just have an local script wich gives me an error iv’e never heard off

--tp buttons
local CTFTP = script.Parent
--tp shenanigans
local Players = game:GetService("Players")
local TeleportService = game:GetService('TeleportService')
local userid = Players.LocalPlayer
local Place_CTF = 5773875970
local Place_Main = 5773869554

function tpClick()
	TeleportService:Teleport(Place_CTF, userid)
end
CTFTP.MouseButton1Down:connect(tpClick)

Make sure the script is a local script, as a local player call won’t work in a normal script. It says source not available because it’s a local script inside a player which is “deleted” every time you stop the game because the player is deleted.

it is a local script and still it gives me this weird error

The user id isn’t specified.

Call Localplayer.UserId inside your teleport function.

Is the script.Parent instance a Part in workspace? If so, you will want to add a ClickDetector and then detect a click through that. If it’s a GUI button, perhaps look at the “userid” variable. I am not that experienced with teleporting players to other games, but I am pretty sure the userid would be the Player instance.

iv’e changed it to


TeleportService:Teleport(Place_CTF, Players.Localplayer.UserId)

end

CTFTP.MouseButton1Down:connect(tpClick)

but still same error

and I still don’t know what they mean with source not available

Instead of hovering over the Output message, can you show the entire output window? That’d be more helpful to me and possibly some other people as well.

3 Likes

Then that would be your answer. You can’t teleport to other games within Studio until you play it via the website.

1 Like

iv’e tried in game cause I was thinking the same and nope still didn’t do anything

Could you go into the game and press F9 to see the error there?

ok it worked I just had to make the games public wow that was surprisingly easy

1 Like