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.Size = Vector3.new(-0,-0,-1) 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) wait(5) debounce = true end end script.Parent.Touched:connect(onTouched)
This script works perfectly. It's supposed to attach a radio to your back. However, the radio is on backwards. All I need to do to rotate it is add the new rotation coordinates (0,pi/2,pi/4) to turn it around and tilt it around the z-axis. Problem is, I don't know much about CFraming and how to convert my radians into a language Lua understands. If you could tell me an example of a script telling a part to rotate, that would be great. Also, is h.AttachmentRot a thing? I would think so since AttachmentPos is mentioned in the above script.