Part isnt welding to body

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I want to set the facepart in specific position and rotation, and then weld the part so it sets in that position and rotation

  1. What is the issue? Include screenshots / videos if possible!

When Im testing, the part is in the position and rotation I need, but it doesnt weld.
Here’s short video
P.S. Sorry for very low quality video, I dont know why is it like this

External Media

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

Yes, but there wasn’t any topics about that

Error that I got: ServerScriptService.facepart:12: invalid argument #2 (Vector3 expected, got CFrame) - Server - facepart:12

Script:

game.Players.PlayerAdded:Connect(function(player)
	if player:IsDescendantOf(game.Players) then
		local char = player.Character or player.CharacterAdded:Wait()
		local head = char:WaitForChild("Head")
		local facepart = char:WaitForChild("FacePart")

		facepart.Anchored = false

		local newCFrame = head.CFrame * CFrame.new(0, 2, -2) * CFrame.Angles(math.rad(45), 0, 0)
		facepart.CFrame = newCFrame

		local localPosition = facepart.CFrame:PointToObjectSpace(newCFrame)
		local weld = Instance.new("Weld")
		weld.Parent = facepart
		weld.Part0 = head
		weld.Part1 = facepart
		weld.C1 = CFrame.new(localPosition) * CFrame.Angles(math.rad(45), 0, 0)
	end
end)

P.S.2 I had to create a new same topic because I didnt get help from past one

Thanks.

1 Like

Changing this:
facepart.CFrame:PointToObjectSpace(newCFrame)

to this, makes any difference?
facepart.CFrame:PointToObjectSpace(newCFrame.Position)

Sorry for not replying for so long, I will try that rn.

Wow, i really had such an easy mistake to fix, tysm!

1 Like

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