Player wont teleport

Hello! When I use this block of code the player wont teleport

‘’'game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
wait(1)
local cutscenecams = game.Workspace.Cameraparts
local cutscenecamevent = game.ReplicatedStorage.CutsceneCamEvent
local returncutscene = game.ReplicatedStorage.ReturnCamEvent
task.wait(1.7)

	player.Character.HumanoidRootPart.Position = Vector3.new(-1.171, 4.742, -227.654)
	player.Character.HumanoidRootPart.Orientation = Vector3.new(0, 25, 0)
	cutscenecamevent:FireAllClients(cutscenecams.Cam1.CFrame)
	task.wait(1.3)
	local animation = game.Workspace.Dummy:WaitForChild("Animation")
	local humanoid = game.Workspace.Dummy:WaitForChild("Humanoid")
	local animationplayer = humanoid:LoadAnimation(animation)
	animationplayer:Play()

	local animation2 = game.Workspace:WaitForChild("Animation")
	local humanoird = player.Character:WaitForChild("Humanoid")
	local animationplay = humanoid:LoadAnimation(animation2)
	animationplay:Play()
end)

end)
‘’’

1 Like

Try using:

local character = player.Character or player.CharacterAdded:Wait()
local rootPart = character:WaitForChild("HumanoidRootPart")

You have to wait for the rootpart. Therefore you have to use :WaitForChild()

I usually use player.Character.PrimaryPart for my teleportation stuff, it doesn’t really change the code, but it works for me so I figured I’d mention it.

1 Like

Another method I use is :PivotTo() to teleport models such as player models.

ive had this issue before, try creating an invisible part with no collision at the position you want the player to teleport and do something like

HumanoidRootPart.CFrame = PARTNAME.CFrame