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

How to add a hat, to a NPC?

Asked by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

I know how to insert a hat, and parent it to a Character. But, with NPCs, or just normal models, the Hat doesn't position correctly, and isn't visible. Tips?

game:GetService("InsertService"):LoadAsset(221290585):GetChildren()[1].Parent = game.Workspace.Model
0
Did you make joints on the Model? EzraNehemiah_TF2 3552 — 9y

2 answers

Log in to vote
2
Answered by
Dr_Doge 100
9 years ago

Thats weird.... it might be because of the humanoid...

It worked for me...

Heres a link to what I did.

http://www.roblox.com/For-Shawnyg-item?id=222610574

Hehe, If you could't get it before, I made it free/Get-able now.

0
I anchored the Head which prevented the Hat from going on. Your model made me realize my errors. Thanks! Shawnyg 4330 — 9y
Ad
Log in to vote
1
Answered by 5 years ago

There is a function on the humanoid called AddAccessory this function can help alot if you want to insert a hat into a NPC or a player.

Something like this:

local hat = game:GetService("InsertService"):LoadAsset(221290585):GetChildren()[1]
script.Parent.Humanoid:AddAccessory(hat)

You must define the Humanoid first before inserting a hat.

Answer this question