TeleportService Script not working

Greetings! I have created a script for my game. It teleports you to a place, but it doesn’t seem to work.image

Script:

local TeleportService = game:GetService("TeleportService")

local Place = 5025468224

local player = game.Players.LocalPlayer

 

script.Parent.MouseButton1Click:connect(function()

TeleportService:Teleport(Place, player)

end)

Any help would be appreciated.

2 Likes

I can’t understand what’s wrong. :confused:

What happens when it runs? Do you get any output? Any error messages or dialogs?

Well, There is a problem you cant teleport in roblox studio.
Have you tried it not on roblox studio?

It gives me these:

I have tried pub;ishing it and trying it in-game, nothing happened.

I have tried pub;ishing it and trying it in-game, nothing happened.

You have to test it on a live server, not within Studio.

If you get any other errors then, post them here.

Ok, let me do it rq.
30characters

1 Like

Ok, it got me these errors. After that it said Cannot teleport to a game that is restricted.

Is the place that you are teleporting to private?

No, the game is Public.
30characters

I think this means you tried to teleport, then tried to teleport again before the first teleport was complete. You should add a check to see whether you are already teleporting, and if so, don’t try to teleport again.

I looked at the id and this was the name of the game: ₮ONIC Donation Center

Your code seems fine, so it might be a simple error on roblox’ servers.
I assume you clicked the button more than once judging from the red (IsTeleporting) error.

You might want to try again or rejoin. Teleporting sometimes takes longer than usual.
If however, you keep receiving a message on your screen saying there’s something wrong, you might want to check from where to where you’re teleporting.

\Hmm, will try it, one minute.

Correct.
30characters30characte