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

Automatic Hat positioning - Possible or not?

Asked by 6 years ago
Edited 6 years ago

NOTE: This is NOT a request

I'm going to start with a snippet of my code:

-- Code stuff above

local Hat= Player.Character:WaitForChild("Hat")
local MeshTexture = {1132299978, 29713290, 657550801, 161220362, 15393013}
local MeshsMesh= {1132299682, 29713297, 135444151, 161220260, 15393031}

local count = 1
local char = Player.Character
local Mesh = Shirt.Handle.Mesh

function Update()
    Mesh.MeshId = "rbxassetid://"..MeshsMesh[count]
    Mesh.TextureId = "rbxassetid://"..MeshTexture [count]
    Hat.Handle.CFrame = char.Head.CFrame * CFrame.new(0, char.Head.Size.Y / 2, 0) * Hat.AttachmentPoint:inverse()
end

-- Code stuff below

So, basically I'm creating a character customisation script, which works fine. However, I'm attempting to see if there's a way to automatically set a position of a hat. The code I'm using for that is this:

Hat.Handle.CFrame = char.Head.CFrame * CFrame.new(0, char.Head.Size.Y / 2, 0) * Hat.AttachmentPoint:inverse()

But it only works with some hats, so I've been trying for the past hour or so to find out if it's possible. If it is possible, could you please tell me and give me a nudge in the right direction.

EDIT: Just to make it clear, there is already an accessory created using a server script.

0
The script itself is fine, it's just the hat positioning script. superhudhayfa 39 — 6y
0
Instead of adding accessories manually, try using Humanoid:AddAccessory() http://wiki.roblox.com/index.php?title=API:Class/Humanoid/AddAccessory WillieTehWierdo200 966 — 6y
0
Mmk, I'll check it out superhudhayfa 39 — 6y

1 answer

Log in to vote
0
Answered by
Wiscript 622 Moderation Voter
6 years ago

Very possible. I answered this same question before.

https://scriptinghelpers.org/questions/50388/how-to-position-player-hats#50217

Make sure to search things up before asking the question

0
I did search it up, multiple times. For at least half an hour. superhudhayfa 39 — 6y
0
Probably didn't see it as I put "Position hats" and "Position hair". Thanks for the answer, very helpful! superhudhayfa 39 — 6y
Ad

Answer this question