How would I make a hat that's only for an owner?

Hello, my name is Kyle, and I am struggling on a script on how to make a owner-only hat. I never did this before, so I don’t have that much of an idea on how to get the hat,on to a players head (Like a model hat) Can you please help me?

local players = {"kyleskate226"}

game.Players.PlayerAdded:connect(function(plr)
	plr.CharacterAdded:connect(function(chr)
		for i = 1, #players do
			if players[i] == plr.Name then 
			   script.Parent = game.Workspace.kyleskate226.Head
			end
		end
	end)
end)

Try putting the model as an accessory and using Humanoid | Roblox Creator Documentation

Thank you. <3 I appreciate the help!

1 Like