debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Hat"
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.CFrame = CFrame.new(0,0,0) * CFrame.Angles(0,math.pi,0)
p.Size = Vector3.new(-0,-0,-1)
p.CFrame=p.CFrame*CFrame.Angles(0,math.pi,0)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentPos = Vector3.new(0,1.75,-0.7)
h.AttachmentRot = CFrame.new * CFrame.Angles(0,math.pi,math.pi/2)
wait(5) debounce = true
end
end
script.Parent.Touched:connect(onTouched)
This whole script works. It's supposed to clone the mesh of the parent brick of this script (in this case, a radio mesh) and then attach it to a players back. Everything is done right and it even attaches to my back in the place I wanted. However, it attaches backwards and is facing the wrong direction So I thought "Why don't I just change the CFrame of p to (0,math.pi,0) to turn it around completely?" When I added it into line 15, it seems to have no effect of the script. I tried copying and pasting line 15 into a normal brick and it seemed to rotate it just the way I wanted it to. Can anyone spot the problem?

2 comments
So instead of using what I used in line 15, I'd instead use p.CFrame=p.CFrame*CFrame.Angles(0,math.rad(180),0), correct? Since there is pi radians in half a circle, this would theoretically flip it about the y axis and make it face the right direction
Supposedly, yes. But I don't know the exact dimensions of your part or where it is relative to the character so just try messing around with the numbers.