rasm123z
(rasm123z)
February 23, 2023, 3:23pm
1
Hello. I have made a hat giver that is supposed to give you a hat, but when I click it it gives me the hat but the hat is rotated weirdly.
Here is my script
On line 16 I tried to fix this by making the hats rotation the same as the players head.
If you know a way to fix this, please respond!
1 Like
try :
newhat.Main.Rotation = char.Head.Rotation + Vector3.new(0, -90, 0)
or
newhat.Main.Rotation = char.Head.Rotation + Vector3.new(0, 90, 0)
I think one of those should work fine,
let me know if it helped you!
I’m assuming you want to rotate the hat by 90 degrees? If so your adding a cframe with a vector3 which only offsets the x, y, and z values of the cframe, not the rotational values. If you wanted to rotate a cframe you would multiply it with a cframe with no translation (a cframe with a position of (0, 0, 0)).
newhat.Main.Rotation = char.Head.Rotation * CFrame.fromOrientation(0, math.rad(90), 0) -- offsets the characters head rotation by 90 degrees on the y axis
oh yes you’r right ! I made a stupid mistake
BaseParts
don’t have a Rotation property, use Orientation or CFrame instead. And what you should do is set the weld.C0
property to rotate the hat.
weld.C0 = CFrame.Angles(0,math.pi/2,0)
1 Like
rasm123z
(rasm123z)
February 23, 2023, 4:45pm
6
I’ve tried this already. It doesnt work.
rasm123z
(rasm123z)
February 23, 2023, 4:48pm
7
Doesn’t work properly. It technically rotates the hat correctly but now it stays facing the way it was and not at the front of the face…
octernion
(octernion)
February 23, 2023, 5:16pm
8
Why are you not using accessories for this? Accessory fitting tool is way more convenient for this. You can find it in “Avatar” tab in studio.
rasm123z
(rasm123z)
February 23, 2023, 6:00pm
9
I have 2 parts, can I still make it into an accessory?
If you weld one to the other then you can make it act like 1 part.
rasm123z
(rasm123z)
February 23, 2023, 6:06pm
11
What position do I set C1 and C0 to be??
system
(system)
Closed
March 9, 2023, 6:10pm
14
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.