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

Problem with adding a accessory to an NPC/Player?

I am trying to add an accessory to a NPC/Player and it seems to not go on the head but to its original position. It goes on the head in normal play mode but not in a server.

I then tried adding a weld called "AccessoryWeld" and link the Part0 to Handle and then Part1 to Head. It goes on the head but not in the correct way.

Workspace > PlayerCustom > Player1 > Every thing a NPC would need

ReplicatedStorage > Character > Hats > HatName > Handle > HairAttachment TouchInterest Mesh

local playername = game.Players.LocalPlayer.Name
local hat = game.ReplicatedStorage.Character.Hats[hatname]:Clone()
	
local weld = Instance.new("Weld")
weld.Name = "AccessoryWeld"
weld.Parent = hat.Handle
weld.Part0 = hat.Handle
weld.Part1 = workspace.PlayerCustom[playername].Head 

hat.Parent = workspace.PlayerCustom[playername]

It successfuly adds the hat into the player, but not on the head.

It adds the weld without me doing it in play mode. But not in a server.

I have FE enabled

1 comment

2 answers

I'd would link you to ROBLOX wiki. I think you've missed a lot.

http://wiki.roblox.com/index.php?title=API:Class/Accessory

ROBLOX scripts don't uses "hat" anymore, but "Accessory" now.

It was a suggestion. I hope it works! Try to sneek at ROBLOX wiki. They could help a bit.

See you later! Good luck on your project!

2 comments

0

It is an accessory

0

Take a look into: local hat = game.ReplicatedStorage.Character.Hats[hatname]:Clone()

Welds seem to break when moving accessorys across in FE. I had fixed this by creating a weld and doing an offset for each variable (thanks Kingdom5). This is my solution until it gets fixed.

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