Hello, i made a script which teleports a player right next to the other in front, however the player faces him, i want it so the player faces exactly the opposite way
local LastTargetPosition = humanoid.RootPart.CFrame
local Length = 1 -- Length between player and target player
captorhumamnoid.RootPart.CFrame = LastTargetPosition + LastTargetPosition.LookVector * Length
captorhumamnoid.RootPart.CFrame = CFrame.new(captorhumamnoid.RootPart.CFrame.Position) Vector3.new(LastTargetPosition.Position.X, captorhumamnoid.RootPart.CFrame.Position.Y, LastTargetPosition.Position.Z))
You could try multiplying by Player 2’s orientation.
--hrp1 and hrp2 are player 1 and player 2's HumanoidRootParts, respectively
--targetPos is your target position, not CFrame
hrp1.CFrame = CFrame.new(targetPos) * CFrame.fromEulerAnglesXYZ(hrp2.CFrame:ToEulerAnglesXYZ())
That’ll keep both players facing the same direction, just like the image describes.
Hello for some reason this happens im not sure what i have done wrong
local LastTargetPosition = humanoid.RootPart.CFrame
local Length = 1 -- Length between player and target player
captorhumamnoid.RootPart.CFrame = LastTargetPosition + LastTargetPosition.LookVector * Length
character.HumanoidRootPart.CFrame = CFrame.new(LastTargetPosition) * CFrame.fromEulerAnglesXYZ(captorcharacter.HumanoidRootPart.CFrame:ToEulerAnglesXYZ())
That’s because you’re passing the entire CFrame, not the position. Pass the CFrame.Position value of your target to CFrame.new. Right now, you’re passing the entire CFrame, which is causing the error.