Xaerium
|
  |
| Joined: 25 Apr 2009 |
| Total Posts: 126 |
|
|
| 01 Apr 2015 05:19 PM |
I made a hat module: It works really good In test mode, I can equip it to myself, to NPCs and it works Fine but when I play in-game, I can use it to equip a hat to myself. It does it perfectly, but when I do it on NPCs. It just spawns the hat, and doesn't place it properly
local Hatmodule = {} function Hatmodule.EquipHat(Player,Hat,Color) asset = game:GetService("InsertService"):LoadAsset(Hat) give = game:GetService("InsertService"):Insert(asset) local children = asset:GetChildren() for i = 1, #children do children[i].Parent = Player children[i].Handle.Mesh.TextureId = "" children[i].Handle.BrickColor = Color end end return Hatmodule |
|
|
| Report Abuse |
|
|
Xaerium
|
  |
| Joined: 25 Apr 2009 |
| Total Posts: 126 |
|
|
| 01 Apr 2015 05:27 PM |
local Hatmodule = {} function Hatmodule.EquipHat(Player,Hat,Color) asset = game:GetService("InsertService"):LoadAsset(Hat) give = game:GetService("InsertService"):Insert(asset) local children = asset:GetChildren() for i = 1, #children do children[i].Parent = Player local handle = children[i].Handle local hat = children[i] handle.Mesh.TextureId = "" handle.BrickColor = Color hatWeld = Instance.new("Weld", handle) hatWeld.Part0 = handle hatWeld.Part1 = Player.Head hatWeld.C1 = CFrame.new(hat.AttachmentPos) --<<-- end end return Hatmodule
I tried that now, but it doesn't equip the hat properly, why? |
|
|
| Report Abuse |
|
|
Xaerium
|
  |
| Joined: 25 Apr 2009 |
| Total Posts: 126 |
|
| |
|