Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I want a player to get a hat when they select on a Gui. What did I do wrong?


script.Parent.MouseButton1Down:connect(function()

if player.Character:findFirstChild("Hat") then
player.Character.Pants.PantsTemplate="http://www.roblox.com/asset/?id=20372960"
else
local p = Instance.new("Hat", player.Character)
player.Character.Hat.HatTemplate="http://www.roblox.com/asset/?id=20372960"
end

I also want the hat on the characters head. And to my knowledge to make the hat the color I want, I upload a decal with the color I want.

1 answer

✓ Accepted answer

Look at the Wiki article for Hat. They have nothing like a "HatTemplate" property.

Hat objects just contain a single Part named Handle, which will contain the appropriate SpecialMesh with a MeshId. (Play in Play Solo and examine your own Hat objects)

If you don't set the TextureId of the SpecialMesh, it will use the BrickColor of the Part, allowing you to use any color.

This discussion is preserved as it was. New answers, comments, and votes are closed.