Like The Mad Murder.
First of all, storing instances in Lighting is not recommended, consider using ServerStorage instead.
You create a table and fill it with references to the hats, then you select a random item from the table, clone it and insert it in player's character.
hats = game.ReplicatedStorage.Hats:GetChildren() --Getting the references to the hats game.Players.PlayerAdded:connect(function(ply)--Just handling the events ply.CharacterAdded:connect(function(char) local hat = hats[math.random(#hats)]:Clone()--Getting a random hat from the table and cloning it hat.Parent = char --Inserting it in the character end end))