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

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

Asked by 10 years ago
1script.Parent.MouseButton1Down:connect(function()
2 
3if player.Character:findFirstChild("Hat") then
4player.Character.Pants.PantsTemplate="http://www.roblox.com/asset/?id=20372960"
5else
6local p = Instance.new("Hat", player.Character)
7player.Character.Hat.HatTemplate="http://www.roblox.com/asset/?id=20372960"
8end

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

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

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.

Ad

Answer this question