Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Hat will not clone into the player?

Asked by 6 years ago

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)
0
Is the hat archivable? hiimgoodpack 2009 — 6y

2 answers

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

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.

Ad
Log in to vote
0
Answered by
oSyM8V3N 429 Moderation Voter
6 years ago

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

Answer this question