So my script is suppose to rotate the hat when the hat is given but it will not rotate, I have tried CFrame.Angles, p.Rotation = Vector3.new and they do not work, Help me on this.
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = script.Parent.Parent.Hat.Helmet2:clone()
p.WeldConstraint:Destroy()
h.Name = "Helmet"
p.Parent = h
p.Rotation = Vector3.new(0,90,0)
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
h.Parent = hit.Parent
h.AttachmentPos = Vector3.new(0, 0.3, 0)
script.Parent.BrickColor = BrickColor.new("Bright red")
wait(5)
debounce = true
script.Parent.BrickColor = BrickColor.new("Bright blue")
end
end
script.Parent.Touched:connect(onTouched)
This is what it does