I want a script to spawn a new part (got that down) and give it the rotation of the body part it is spawned from. I've sorta got parts of it, so here is some of it:
fh.BrickColor = BrickColor.new("Bright yellow") fh.CFrame = CFrame.new(script.Parent.Parent.Character:FindFirstChild("Head").Position.X,script.Parent.Parent.Character:FindFirstChild("Head").Position.Y-0,script.Parent.Parent.Character:FindFirstChild("Head").Position.Z)--Edited fh.Rotation = Rotation.new(script.Parent.Parent.Character:FindFirstChild("Head").Rotation.X,script.Parent.Parent.Character:FindFirstChild("Head").Rotation.Y-0,script.Parent.Parent.Character:FindFirstChild("Head").Rotation.Z) game.Debris:AddItem(fh,0.8)
(P.S. There may be an indentation missing but that doesn't matter, I just need the parts rotation to be similar to that of the body part.)
You can set the CFrame to the head's CFrame and it will give it the same position and rotation of the head object, for example:
fh.CFrame = script.Parent.Parent.Character:FindFirstChild("Head").CFrame
This will get the CFrame of the characters head, which contains the position and rotation of it, and set it to the part 'fh'
Well I don't quite understand what your code is doing.. but to match a new part's rotation with a predefined part's rotation then you just need to make the new part's CFrame equivelant to that of the predefined part.
local old = workspace.Part --Old part local new = Instance.new('Part',workspace) --New part. new.CFrame = old.CFrame --Match CFrames, equivelant rotation
In your case, you're wanting to match fh
's CFrame with script.Parent.Parent.Character:FindFirstChild("Head")
's CFrame..
fh.CFrame = script.Parent.Parent.Character:FindFirstChild("Head").CFrame