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
``