Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I make a hat move lower then where it is usually supposed to be?

Asked by
zValerian 108
5 years ago

I am trying to move a hat a bit lower down a players body but it does not work.

This is the script:



wait() buff = game.ReplicatedStorage.buff:Clone() -- Wherever your hat is stored. game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) buff.Parent = character buff.Handle.CFrame = buff.Handle.CFrame + Vector3.new(0,5,0) print(5) end) end)

It doesn't work and the hat stays in its original position. Please help! This is the hat I am using: https://www.roblox.com/catalog/62745127/Thug-Bandana

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Roblox hats are joined to the character's body parts via WeldConstraints. Setting the CFrame of the handle part doesn't alter the offset relation contained in the WeldConstraint.

You'll want to make these changes via properties in the Accessory instance itself (the hat)

Here's a picture of those properties where red effects position and blue effects rotation

It's worth noting that these 3 Vec3 properties exist as the resulting homogeneous CFrame components describing the weld.

Edit:

They're no longer using these properties by default, instead overriding them in situations where an attachment in the hat's Handle exists and matches the name of an attachment in one of the character's limbs. The weld offset is then positioned so that the Handle's attachment bears the identical CFrame of the limb attachment.

You'll want to assign to the Position property of the attachment that is a child of the hat's Handle part.

Here's a screenie with both matching attachments selected

0
damn i got none of that TheluaBanana 946 — 5y
0
so C0? TheluaBanana 946 — 5y
0
Yep they're combined to create the resulting C0 CFrame, altho that's maintained internally with WeldConstraints and cannot be assigned to. InfinityDesign 280 — 5y
0
This doesn't work: buff.AttachmentUp = Vector3.new(0,55,0) also, your picture does not work zValerian 108 — 5y
View all comments (6 more)
0
This doesn't work: buff.AttachmentUp = Vector3.new(0,55,0) also, your picture does not work zValerian 108 — 5y
0
Fixed the image URL. 'AttachmentUp' describes the Up unit vector component of the cframe, which describes rotation not position. As it's a unit vector, {0,55,0} is not valid and will be normalized to {0,1,0}. InfinityDesign 280 — 5y
0
how should it be? sorry im stupid zValerian 108 — 5y
0
What you're looking for is the positional component of the CFrame, AttatchmentPos in this case. InfinityDesign 280 — 5y
0
oof TheluaBanana 946 — 5y
0
this does not work also: buff.AttachmentPos = Vector3.new(0,55,0) zValerian 108 — 5y
Ad

Answer this question