TeleportService doesn't work due to a error in-game

local TeleportService = game:GetService("TeleportService")
local TeleportDestination = 9204606448
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Down:Connect(function()
	for i = 1,0,-0.1 do
		player:WaitForChild("PlayerGui"):WaitForChild("blackscreen").Frame.BackgroundTransparency = i
		task.wait(0.02)
		end
	task.wait(2)
	player:WaitForChild("PlayerGui"):WaitForChild("blackscreen").Frame.TextLabel.Visible = true
	task.wait(3)
	player:WaitForChild("PlayerGui"):WaitForChild("blackscreen").Frame.TextLabel.Text = ("Credits to EchoWinds , MqrioJudah and valid4593 for supporting me.")
	task.wait(3)
	player:WaitForChild("PlayerGui"):WaitForChild("blackscreen").Frame.TextLabel.Text = ("May the fun starts")
	task.wait(2)
	for i = 1,0,-0.1 do
	player:WaitForChild("PlayerGui"):WaitForChild("blackscreen").Frame.TextLabel.TextTransparency += 0.1
		task.wait(0.02)
		end
	task.wait(1)
	TeleportService:Teleport(TeleportDestination, player)
	
	
	end)

This is my script. I don’t get why it doesn’t work. However the menu works very well but everytime I get teleported , it says that


However the place where the players are getting teleported is public. Does anyone knows?

1 Like

Is the place you are getting teleported to made by you? If not you should turn on this setting in game settings - security!

Yes The place where i’m getting teleported is made by me.

I think it’s because you are trying to teleport someone from the client…? Highly doubt that possible but I could be wrong.

Teleport Service doesnt work in studio

TeleportService does not work during playtesting in Studio. To test your game’s use of TeleportService, you must publish the place and play it with the Roblox application.

1 Like

Yeah i don’t think it would be possible to teleport via localscript. I would suggest using RemoteEvents to teleport the player in a normal script in serverScriptService.

1 Like

No i’m testing it on the game , not roblox studio and its published

1 Like

Then it’s just the localscript problem i think!

1 Like

When teleporting a single player, i dont think you need to pass the player as a parameter

so just do

TeleportService:Teleport(TeleportDestination)

Also as suggested above, turn on third party teleport settings

1 Like

Teleporting can be done in a local script

2 Likes

Oh ok i didn’t know that, thanks!

2 Likes

Yup. I agree.

@UhhhhMaybeNo, I recommend this:

Create a RemoteEvent in ReplicatedStorage and name it ‘TeleportEvent’
In your localscript, type:

script.Parent.MouseButton1Click:Connect(function()
game:GetService("ReplicatedStorage").TeleportEvent:FireServer(game:GetService("Players").LocalPlayer)
end)

Create a script in ServerScriptService and type:

local TeleportService= game:GetService("TeleportService")
local id = 9204606448
game:GetService("ReplicatedStorage").TeleportEvent.OnServerEvent:Connect(function(player)
    for i = 1,0,-0.1 do
		player:WaitForChild("PlayerGui"):WaitForChild("blackscreen").Frame.BackgroundTransparency = i
		task.wait(0.02)
		end
	task.wait(2)
	player:WaitForChild("PlayerGui"):WaitForChild("blackscreen").Frame.TextLabel.Visible = true
	task.wait(3)
	player:WaitForChild("PlayerGui"):WaitForChild("blackscreen").Frame.TextLabel.Text = ("Credits to EchoWinds , MqrioJudah and valid4593 for supporting me.")
	task.wait(3)
	player:WaitForChild("PlayerGui"):WaitForChild("blackscreen").Frame.TextLabel.Text = ("May the fun starts")
	task.wait(2)
	for i = 1,0,-0.1 do
	player:WaitForChild("PlayerGui"):WaitForChild("blackscreen").Frame.TextLabel.TextTransparency += 0.1
		task.wait(0.02)
    end
	task.wait(1)
	TeleportService:Teleport(id, player)
end)

I didn’t test out this code, so it could not work. Try it out first though and hit me up if you ran into any problems.

From the roblox dev hub

The code below will teleport a player to Crossroads, assuming it’s in a LocalScript.

  1. game:GetService(‘TeleportService’):Teleport(1818)

It can be used in a local script

The place is privated. Are you sure the place is under the game?

Oh yes and what @Denz_Noviembre said.

Enable the settings in your other place too

You’re trying to teleport to another game? Games and places are 2 different things.

Anyways, it should work too. 3030303030

It still says Place is Restricted.