You can write your topic however you want, but you need to answer these questions:
- 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
- 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
- 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)
Thanks.