Good luck. Also an important thing to note (which I initially struggled with) is the parameters of the FireServer() and OnServerEvent functions. The first parameter of the OnServerEvent will be the player executing the script by default, while the second parameter will be the first of the FireServer(). So when assigning the hat, the ServerScript would look something like:
local Remote = game:GetService("ReplicatedStorage").HatRemote --Add the RemoteEvent "HatRemote" in first.
Remote.OnServerEvent:Connect(function(player,ID)
local accessory = game:GetService("InsertService"):LoadAsset(ID):GetChildren()
for i,v in pairs(accessory) do
accessory.Parent = player.Character
end
end)
And the LocalScript in the Gui will be something like:
local Remote = game:GetService("ReplicatedStorage").HatRemote
script.Parent.MouseButton1Click:Connect(function()
local ID = tonumber(script.Parent.Text) --Reference to the text inputted.
Remote:FireServer(ID)
end)