Hats not cloning onto player correctly

I’m trying to make a character customization system for my retro game with old roblox hats and shirts and I’ve got the shirts and pants part down but that hats don’t seem to be working. The hat will clone into the player’s character but it wont appear to be on their head. Here’s a video showing what’s wrong:

Not really sure what to do. Any ideas?

Code

local MarketplaceService = game:GetService("MarketplaceService")
for _,c in pairs(game.ReplicatedStorage.CharacterStuff:GetChildren()) do
	function getThumbnail(id)

	local Success, Response = pcall(function()
		ProductInfo = MarketplaceService:GetProductInfo(id)
	end)

	if not Success then
		id = nil
		return
	end

	if ProductInfo then
		return("rbxthumb://type=Asset&id="..id.."&w=420&h=420")
	end
	end
	local clone = script.Parent.Frame.Template:Clone()
	clone.Parent = script.Parent.Frame
	clone.Image = getThumbnail(c:GetAttribute("id"))
	clone.MouseButton1Click:Connect(function()
		if c:IsA("Shirt") then
			if game.Players.LocalPlayer.Character:FindFirstChildOfClass("Shirt") then
				game.Players.LocalPlayer.Character:FindFirstChildOfClass("Shirt"):Destroy()
				c:Clone().Parent = game.Players.LocalPlayer.Character
			else
				c:Clone().Parent = game.Players.LocalPlayer.Character
			end
		end
		if c:IsA("Pants") then
			if game.Players.LocalPlayer.Character:FindFirstChildOfClass("Pants") then
				game.Players.LocalPlayer.Character:FindFirstChildOfClass("Pants"):Destroy()
				c:Clone().Parent = game.Players.LocalPlayer.Character
			else
				c:Clone().Parent = game.Players.LocalPlayer.Character
			end
		end
		if c:IsA("Accessory") then
			if game.Players.LocalPlayer.Character:FindFirstChildOfClass("Accessory") then
				game.Players.LocalPlayer.Character:FindFirstChildOfClass("Accessory"):Destroy()
				c:Clone().Parent = game.Players.LocalPlayer.Character
			else
				c:Clone().Parent = game.Players.LocalPlayer.Character
			end
		end
	end)
end
script.Parent.Frame.Template.Visible = false
``
1 Like

Have you tried putting the accessory onto the player inside of studio before you playtest and see if it positions correctly?

Hmm good idea I’ll try that. Thanks

No problem dude get back to me wit the results as soon as you can

Screen Shot 2021-01-18 at 2.08.57 PM
Nope! It worked just fine on the dummy.

Maybe in a different server script when the character is added clone the same hat that has the problem and see if that works

1 Like

Do your accessories have a part named Handle inside of them?

They already do thanks for the suggestion though!

I created a remote event to add the hat to the player and it worked! Thanks so much! (Sorry for taking so long to respond)

1 Like

its fine @heII_ish tried though