How to move welded player infront of another player

I want the hit player to be infront and facing the user, but this happens instead:

local Weld = Instance.new("WeldConstraint")
Weld.Parent = hroot
Weld.Part0 = hroot
Weld.Part1 = character.HumanoidRootPart
							
character.HumanoidRootPart.CFrame = hroot.CFrame * CFrame.new(0,0,5)

I wouldn’t use weld constraints. Just use normal welds or Motor6Ds.

--Untested
local Weld = Instance.new("Weld",TargetRoot)
Weld.Part0 = TargetRoot
Weld.Part1 = Character.HumanoidRootPart
Weld.C0 *= CFrame.new(0,0,5) -- Editing Part0's CFrame, probably not the correct alignment though.
1 Like

how would I be able to turn them 180 degrees so they face me?

local Weld = Instance.new("Weld",TargetRoot)
Weld.Part0 = TargetRoot
Weld.Part1 = Character.HumanoidRootPart
Weld.C0 *= CFrame.new(0,0,5)*CFrame.Angles(0,math.rad(180),0) -- CFrame angles use radians so you have to convert.
1 Like

Oh alr thats why the rot was being funky, thanks it works perfectly

Also even if i used the target player/npc as the parent/part0 i would use the player character instead it might cause issues with weight and gravity. (I just wanted to replicate your script as closely as possible)

local Weld = Instance.new("Weld",Character.HumanoidRootPart)
Weld.Part0 = Character.HumanoidRootPart
Weld.Part1 = TargetRoot
Weld.C1 *= CFrame.new(0,0,-2)*CFrame.Angles(0,math.rad(180),0)

just something like this but im babbling and you probably get the point.

2 Likes

oh yeah thats how it is originally, I have the script worded weird though so hroot = player and character.HumanoidRootPart = target

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