Can I make it that I can use teleportservice in studio?

I want to test out a teleporting script but it gives me this error:

20:47:09.200 - exception while signaling: Cannot Teleport in the Roblox Studio.

Is there some kind of setting I can change so this would work in studio? I really don’t have to go in-game to test it.

This is my script:

local TeleportService = game:GetService("TeleportService")

script.Parent.MouseButton1Click:Connect(function()
	local Player = script.Parent.Parent.Parent.Parent.Parent
	TeleportService:Teleport(5135683567, Player)
end)

Unfortunately no. You need to test in-game. It doesn’t make sense to go into another game in studio from the same window.

Btw script.Parent.Parent.Parent.Parent.Parent is redundant. Use Players.LocalPlayer. Don’t reinvent the wheel.

2 Likes

You can’t test it out of game…

Well this is a server script so I can’t use LocalPlayer to get the player. Although I guess if you can use teleportservice in a local script I would make it one.

You should make it a local script. Server should never be handling GUI input. And teleportservice works on a localscript.

1 Like