Teleporting enemy player in front of local player without affecting welded objects

Hello. I am trying to make it so that when my skill lands, the enemy player will teleport to slightly in front of me but I don’t want to affect the welded objects. How can I achieve that?

2 Likes

When you are teleporting something with welds you have to pay attention to only using CFrame

Here is an example of a code that will teleport to the front of the target while facing it.

local function TeleportPlayer(Player, Target)
	local TargetCFrame = Target.HumanoidRootPart.CFrame
	local PlayerNewCFrame = CFrame.new(TargetCFrame * CFrame.new(0, 0, -2).Position, TargetCFrame.Position)
	
	Player.Character.HumanoidRootPart.CFrame = PlayerNewCFrame
end
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.