Teleport gui is not working

So I am making this main menu gui with camera manipulation in it. When you tap on “Official maps” it will show the gui for all of the official maps. Then when you click on it it will disable the camera manipulation and tp you to the map. Here is my code

local plr = script.Parent.Parent.Parent.Parent.Parent
local char = plr.Character

script.Parent.MouseButton1Click:Connect(function()
	print("Tp to neon revelation")
	char.HumanoidRootPart.CFrame = workspace.Checkpoint1.CFrame
	game.StarterPlayer.StarterCharacterScripts.camera.Disabled = true
end)

it does not work, and I get Character isn’t part of player. Please help.

server script or local script?

Could try with local script it may still be the same. I ain’t sure though, you could give it a shot.

reminder Teleport Service doesn’t work in studio, so test it in game.

I put it under the gui image. I guess I’m doing that part wrong?

Im not teleporting to a different game. Im only teleporting to a different part. I’m pretty sure you can do that in studio.

Suggest looking at this:

Teleport using the Cframe of the character. You can also use the HumanRootPart

Hi there! Try this and make sure you’re using a local script when using GUIs.

local plr = game.Players.LocalPLayer
local char = plr.Character

script.Parent.MouseButton1Click:Connect(function()
	print("Tp to neon revelation")
	char.HumanoidRootPart.CFrame = workspace.Checkpoint1.CFrame
	game.StarterPlayer.StarterCharacterScripts.camera.Disabled = true
end)
1 Like

Quick quesetion can the script be under an image, or does it have to be under a button?

It has to be under the button, since that’s what your clicking.

It has to be in a button otherwise it won’t work.

Would an Image button work? Since there is an image of the map you can tp to.

An image button would work 100%.

2 Likes

Well, uh it prints, but im still fixed on the camera.

You can’t disable a camera. You have to set it to scriptable and set it back to custom when the button is clicked.

Hmmm, I’m still a little confused by this, would I set it to scriptable in the camera script or the teleport script.

I’m not sure myself since I don’t know what exactly you’re trying to do. I think set it to scriptable when you click the gui.

Well, I’m trying to make it that when you click the imagebutton, it teleports you to the map, and disables the camera manipulation on the main menu.

In the main menu, your camera would be scriptable and probably moving around or stationery in one place. Set it back to custom so it’s back to the player’s camera when you teleport them.

The camera script isn’t in the main menu, it is inside of starterplayerscripts. It would be the same thing?