generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Equipping a Hat to an NPC.

Previous Thread :: Next Thread 
Xaerium is not online. 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 is not online. 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 is not online. Xaerium
Joined: 25 Apr 2009
Total Posts: 126
02 Apr 2015 07:49 AM
Bump
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image