How to teleport a player directly in front of another player

It’s not, for some reason. I don’t know why, sadly. I’ve tried everything.

Send me your code. wwwwwwwwwwwww

local PlayerHumanoid = player.Character:WaitForChild("Humanoid")
	local TargetHumanoid = getplr.Character:WaitForChild("Humanoid")
	PlayerHumanoid.RootPart.CFrame = TargetHumanoid.RootPart.CFrame + TargetHumanoid.RootPart.CFrame.LookVector * 5
	PlayerHumanoid.RootPart.CFrame = CFrame.new(PlayerHumanoid.RootPart.CFrame.Position, Vector3.new(TargetHumanoid.RootPart.CFrame.Position.X, PlayerHumanoid.RootPart.CFrame.Position.Y, TargetHumanoid.RootPart.CFrame.Position.Z))

Just to confirm, it does work but it teleports me to a RANDOM spot off the map which kills me.

Okay now I get it, here

local PlayerHumanoid = player.Character:WaitForChild("Humanoid")
local TargetHumanoid = getplr.Character:WaitForChild("Humanoid")

local LastTargetPosition = TargetHumanoid.RootPart.CFrame
local Length = 3 -- Length between player and target player

PlayerHumanoid.RootPart.CFrame = LastTargetPosition + LastTargetPosition.LookVector * Length
PlayerHumanoid.RootPart.CFrame = CFrame.new(PlayerHumanoid.RootPart.CFrame.Position, Vector3.new(LastTargetPosition.Position.X, PlayerHumanoid.RootPart.CFrame.Position.Y, LastTargetPosition.Position.Z))
5 Likes

THANK YOU SOOO MUCH, THIS WORKS! :heart:

1 Like