Why the player isn't teleporting?

I created in a local script, which is designed to teleport the player to a given point:

local Players = game:GetService("Players") 
		local Player = Players.LocalPlayer
		local Character = Player.Character or Player.Character:Wait()
		Character:MoveTo(game.Workspace.Shop.TeleportPart.Position)

Normally my script works fine, but it doesn’t work today.
I tried to teleport the player to the block’s position, but it didn’t work either.
No error is shown in output.
What should I do?

1 Like

you should try this

Character.HumanoidRootPart.CFrame = CFrame.new(game.Workspace.Shop.TeleportPart.Position)
4 Likes

Unfortunately, it did not work and no error appeared on the output. I don’t think this is a mistake.

1 Like

can i see the whole explorer? to get more understanding

You can’t teleport a player with a local script. Try using a server script for this.

It needs to not be a localscript, and I would suggest doing Character.HumanoidRootPart.CFrame = game.Workspace.Shop.TeleportPart.CFrame

local Players = game:GetService("Players") 
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
Character:PivotTo(game.Workspace.Shop.TeleportPart.CFrame)

Few notes:
1.You forgot to put Added in the or Player. part.
2.Why not teleport the player from a server script?
3.I think it’s always better to use either PivotTo or SetPrimaryPartCFrame[deprecated, but still works].

1 Like

You made a typo there (Player.Character:Wait()). It maybe effecting your script.
Change it to Player.CharacterAdded:Wait().

Another way:

You can set the character’s HumanoidRootPart.CFrame to the teleporter part CFrame.

Character.HumanoidRootPart.CFrame = game.Workspace.Shop.TeleportPart.CFrame

And also only do this on a server script.

1 Like

@DeltOof12345 @barfpillow99 @DesertedVoltron @Paysallday44
I changed the local script to server script, but it doesn’t make much difference to me. I was already doing a local script in the GUI that teleported the player and everything worked fine.

Explorer SS

Zrzut ekranu 2022-06-5 o 11.32.04

Now the message pops up in output:

  11:27:24.264  Workspace.Room.Door.Union.Script:4: attempt to index nil with 'Character'  -  Server - Script:4
  11:27:24.265  Stack Begin  -  Studio
  11:27:24.265  Script 'Workspace.Room.Door.Union.Script', Line 4  -  Studio - Script:4
  11:27:24.265  Stack End  -  Studio

What should I do now?

How do you fetch the player? are you still using local player in the server script by any chance?

furthermore it’d benefit us more if you could send us the entire script

You can use this:

wait(1)
player = game.Players.LocalPlayer
button = script.Parent
local debounce = false

function teleport()
	if not debounce then
		debounce = true
		LowerTorso = player.Character.LowerTorso
		LowerTorso.CFrame = game.Workspace.Part.Place1.CFrame
	end
end
button.MouseButton1Click:Connect(teleport)
while true do wait()
	debounce = false
	wait(1)
end

You have to get the Place1 1st.

So it can work.

thats a weird way of doing debounces you should probably do

local player = game.Players.LocalPlayer
local button = script.Parent
local debounce = false

function teleport()
	if not debounce then
		debounce = true
        local chr = player.Character or player.CharacterAdded:Wait()
		local HRP= chr.HumanoidRootPart
		HRP.CFrame = game.Workspace.Part.Place1.CFrame
        task.delay(1, function() debounce = false end)
	end
end
button.MouseButton1Click:Connect(teleport)

He needs to get a Place1 so it can work, so this is why i posted this script.

If he does not have Place1, then the TP Button will never work…

He already has a place to teleport the player to. Plus he is using a server script, i thought i’d clean up your script a little

1st of all, the thing should on StarterGui:
bandicam 2022-06-05 11-50-34-864
Then he can do it
Image:
bandicam 2022-06-05 11-49-43-454

OpenFrame’s Text: Open
OpenFrame’s script:

local open = script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Frame.Visible = true
	script.Parent.Text = "Close"
end)

CloseFrame’s Text = X
CloseFrame’s script:

local close = script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Visible = false
	script.Parent.Parent.Parent.Text = "Open"
end)

TextButton1’s Text: Place1
TextButton1’s script:

wait(1)
player = game.Players.LocalPlayer
button = script.Parent
local debounce = false

function teleport()
	if not debounce then
		debounce = true
		LowerTorso = player.Character.LowerTorso
		LowerTorso.CFrame = game.Workspace.Part.Place1.CFrame
	end
end
button.MouseButton1Click:Connect(teleport)
while true do wait()
	debounce = false
	wait(1)
end

TextButton2’s Text: Place2
TextButton2’s script:

wait(1)
player = game.Players.LocalPlayer
button = script.Parent
local debounce = false

function teleport()
	if not debounce then
		debounce = true
		LowerTorso = player.Character.LowerTorso
		LowerTorso.CFrame = game.Workspace.Part.Place2.CFrame
	end
end
button.MouseButton1Click:Connect(teleport)
while true do wait()
	debounce = false
	wait(1)
end

TextButton3’s Text: Place3
TextButton3’s script:

wait(1)
player = game.Players.LocalPlayer
button = script.Parent
local debounce = false

function teleport()
	if not debounce then
		debounce = true
		LowerTorso = player.Character.LowerTorso
		LowerTorso.CFrame = game.Workspace.Part.Place3.CFrame
	end
end
button.MouseButton1Click:Connect(teleport)
while true do wait()
	debounce = false
	wait(1)
end

The TextLabel does not have any script because there’s no script BUT the Text is: Teleporter

There we go, this is the end.

Also, you can remove the Part one.