How to rotate this mesh

My problem is I’m trying to get a wearable vest which I already succeeded with a help of an old script I had. But then I replaced the mesh with a newer updated mesh for the vest and the only problem I have is I don’t know how to rotate the vest.
Problem:

What I tried to do was add this “p.CFrame = p.CFrame * CFrame.Angles(0, math.rad(5), 0)” but it had no effect

Script

local vest = script.Parent.Handle

script.Parent.RemoteEvent.OnServerEvent:connect(function(plr, …)
local t = {…}
if t[1] == “PutOn” then
h = Instance.new(“Hat”)
p = Instance.new(“Part”)
h.Name = “Hat” – It doesn’t make a difference, but if you want to make your place in Explorer neater, change this to the name of your hat.
p.Parent = h
p.Position = plr.Character.Torso.Position
p.Name = “Handle”
p.formFactor = 0
p.Size = Vector3.new(-0,-0,-1)
p.BottomSurface = 0
p.TopSurface = 0
p.BrickColor = BrickColor.new(“Really black”)
p.Locked = true
vest.Mesh:Clone().Parent = p
h.Parent = plr.Character
h.AttachmentPos = Vector3.new(0, 2, 0.05) – Change these to change the positiones of your hat, as I said earlier.
vest.Transparency = 1
plr.Character.Humanoid.MaxHealth = 150
end
if t[1] == “TakeOff” then
h:remove()
plr.Character.Humanoid.MaxHealth = 100
vest.Transparency = 0
end

end)

Picture of the script

1 Like

Why use hats and stuff when you can just simply change the Vest’s CFrame and then Weld it to the player? I just don’t like idea of your way since welds and CFrame would be way simpler.

I’m not sure, I didn’t create the script. It was used for a different game and I need it were you can equip it and put it on so it’s a gamepass.

Alright so let me help you out. What you do is first you adjust the vest’s position and rotation by changing its CFrame to do that you do this

vest.CFrame =
Torso.CFrame * CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))

You will have to adjust the “CFrame.new” line and “CFrame.Angles”. What that will do is set the CFrame (Rotation and position) of vest to the torso. The other two parts adjust the position and rotation. math.rad is needed to convert degrees to radians since CFrame.Angles uses radians.

Once you successfully set the position of the Vest you have to weld it. In order to do that you first create a weld by typing out this line of code

local weld = Instance.new(“WeldConstraint”)

Then you set the Part0 (main part) and Part1 (Part that has to be attached, for you its the vest)

weld.Part0 = Torso
weld.Part1 = vest

Lastly you set the parent of the weld to either the torso or the part.
weld.Parent = Torso

Make sure that the vest is not anchored. Also not really required but I tend to like to make the accessories not collidable and massless.

Also since you are new to this I suggest taking a look at CFrames and welds. Here are some useful links:

https://developer.roblox.com/en-us/api-reference/datatype/CFrame

https://developer.roblox.com/en-us/api-reference/class/WeldConstraint

1 Like

I really appreciate your help and you taking the time to try to explain this. But I have no clue what I’m doing. I’m just tryna rotate the vest lol. But thank you ALOT!

Oh well, no problem. I guess you can just change orientations since you are using Vector3.

part.Orientation = part.Orientation + Vector3.new(0,0,0)

–Change the 0s accordingly. (XYZ)

1 Like

Alright i’ll see if this works, thank you

I believe in your case it will be the Y axis by 90 degrees. So the middle would be 90. Vector3.new(0, 90,0)

1 Like

image
so like this?

If that’s how you do, I’m still having the problem. If you have discord @RoGuruu i’d love to discuss on that since I don’t want to spam this thread

Sure, I can explain on discord. Here is my tag TNFhacks#8346

1 Like

Your vest is an accessory, correct?

If so, there are three properties you can use to achieve this.
Capture d’écran, le 2020-12-24 à 01.29.00

AttachmentForward, Right and Up should allow you to orient accessories using different angles. You’d have to mess around with it, but it does work.

(Replied to wrong person, sorry about that. Meant to reply to OP)

1 Like

No problem, have a good Christmas if you celebrate

1 Like

Sorry to bump, but what was the solution?