Basically, I've made a code to randomize skin color, hair, and face. Unfortunately, the hat that spawns doesnt automatically spawn on the player but far away. HOWEVER! The actual hat IS parented inside the character, and when I touch the visible hat, THEN it appears on the players head.
--Hats
local InsertService = game:GetService("InsertService")
if HatChance == 1 then
local Load = InsertService:LoadAsset(TreckyHair)
Load.Parent = player.Character
elseif HatChance == 2 then
local Load = InsertService:LoadAsset(ChestnutStyle)
Load.Parent = player.Character.Head
elseif HatChance == 3 then
local Load = InsertService:LoadAsset(Shaggy)
Load.Parent = player.Character.Head
elseif HatChance == 4 then
local Load = InsertService:LoadAsset(StylishBrownHair)
Load.Parent = player.Character.Head
elseif HatChance == 5 then
local Load = InsertService:LoadAsset(ChestnutSpikes)
Load.Parent = player.Character.Head
elseif HatChance == 6 then
local Load = InsertService:LoadAsset(BlackPigtails)
Load.Parent = player.Character.Head
elseif HatChance == 7 then
local Load = InsertService:LoadAsset(BlondePigtails)
Load.Parent = player.Character.Head
elseif HatChance == 8 then
local Load = InsertService:LoadAsset(Beard1)
Load.Parent = player.Character.Head
end
How can I make the Hat automatically spawn on the characters head?

2 comments
Thanks so much! I have a small additional question though; having watched many Data Store tutorials, it's said that you can only save values. But in another game I saw, they were able to save your hat even if you left the game. How is that possible?
According to the Wiki (http://wiki.roblox.com/index.php?title=API:Class/GlobalDataStore/SetAsync), you can only save Variants (which are ints, strings, bools, and nil values). The hat saving you've seen is probably just saving of the assetId of the hat when the player leaves/loading of the assetId when the player joins (or texture too if it's a custom made hat not from the catalog).