Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Hat will not clone into the player?

Just need it so when you click this Gui the hat clones. No output errors just nothing happens at all, any reasons why?

local pl = script.Parent.Parent.Parent.Parent.Parent.Character

script.Parent.MouseButton1Click:connect(function()
	local h = game.ReplicatedStorage.Morphs.SithA.EyeciesHat:Clone()
	h.Parent = pl
end)

1 comment

0

Is the hat archivable?

2 answers

All hats have been converted to use the new Accessory class.

Additional information

Blog

dev forum

The new system uses Attachments which connect to the same attachment name in the players character model.

To add an accessory we should use the new system available in the humanoid called AddAccessory which will add the accessory to the character model.

A small example

local hat = game:GetService('ReplicatedStorage'):WaitForChild('Morphs'):WaitForChild('SithA'):WaitForChild('EyeciesHat')

script.Parent.MouseButton1Click:connect(function()
	local humanoid = [some path to the humanoid]
	humanoid:AddAccessory(hat:Clone())
end)

I hope this helps please comment if you have any questions about this code.

You have to use weld to fully position it onto the player's head. Then make sure the hat isn't anchored or it will stay in its original position

This discussion is preserved as it was. New answers, comments, and votes are closed.