How do I go around Teleporting a player with the press of a button

So, basically the title says it all I don’t know how to teleport a player when he presses a button can anyone tell me how I can get that done?

Thanks in advance!

1 Like

First you need to get the PrimaryPart of the character or humanoid Root Part.Then you change the CFrame to the teleport position.1 insert a part.2Move that part to the teleport location.3 Make it invisible,CanCollide false and Anchored = true then create a script
If it’s a physical button(the one that use clickdetector)

script.Parent.MouseClick:Connect(function(plr)--assuming you put the script inside the click detector
   plr.Character.PrimaryPart = workspace.Teleportationpart.CFrame--Assuming you Name the teleportation part Teleportationpart and put it in the workspace
end)

What do you mean by inside the click detector?

You’ll need a click detector to check for click on a physical object

For gui button,Here’s a script

script.Parent.MouseButton1Click:Connect(function()--assuming you put the script inside a gui button
	script.Parent.Parent.Parent.Parent.Character.PrimaryPart.CFrame = workspace.Teleportationpart.CFrame--Assuming you Name the teleportation part Teleportationpart and put it in the workspace
end)

1 Like