Apply hair on client

for my character creation, I need to apply hair on client. I know when you do it server side, it automatically connects to the head and positions itself. How can I do this manually since this doesn’t happen on the client?

are you applying hair to an npc or player? if its player then you have to do it by server atleast I think so

I have made a customization system which involved putting locally, hats onto a dummy, I had to position the hat handle as needed but each was different.

I’d rather do this than request the server to add to the dummy and even then I would have to clone the dummy into the vpf on server, since it wouldn’t detect client sided clone of the dummy

1 Like

The way i did it is i made 2 separate folders with 1 the normal unanchored hats and 1 with anchored ones. I use the anchored ones to attach it to the player on client (before doing that i manually put them at the right location above the head and then anchor them). When the player presses play it fires an event that makes the server put the unanchored hats on the character so everyone can see them

DISCLAIMER: This isnt the best way of doing it and there are many other ways but so far i havent come across any big issues like people wearing hats that do not exist. So as a start this should be fine :slight_smile:

1 Like

It’s just a character. It’s a character creation system where I want all th players in the server to use the same npc to customize the character that will be used in the main game so the only way to do that is do everything on client.

yea you’ll have to do it manually then.

what i did with mine was set the initial cframe of the handle = to the head or torso depending on accessory type (i had a hattype object in the hat for reference)

then with testing, you have to fiddle with the x, y, z values of this particular hat. once you get the position you want store a x, y , z object values inside the hat (in i assume replicated storage) and once you are done with fiddling every hat you can reference the x y z by:

THIS IS DONE ON R15 BTW IDK IF UPPER TORSO EXISTS ON R6

if ReplicatedStorage.HatFolder[Hat].Type.Value=="Head" then
		Dummy[Hat].Handle.CFrame = Dummy.Head.CFrame
elseif ReplicatedStorage.HatFolder[Hat].Type.Value=="UpperTorso" then
		Dummy[Hat].Handle.CFrame = Dummy.UpperTorso.CFrame
end


local x = ReplicatedStorage.HatFolder[Hat].PositionXVal.Value
local y = ReplicatedStorage.HatFolder[Hat].PositionYVal.Value
local z =ReplicatedStorage.HatFolder[Hat].PositionZVal.Value

Dummy[Hat].Handle.Position=Vector3.new(Dummy[Hat].Handle.Position.X+x,Dummy[Hat].Handle.Position.Y+y,Dummy[Hat].Handle.Position.Z+z)

note this will not work with an animated npc.

EDIT 2023: If anyone reads this, this is NOT the proper way to do this. do not waste your time with the above, you’re going to have to use client-server communications, the server must applyaccessory to the VPF humanoid, follow what I stated here:

HumanoidDescription not loading the hair on a Dummy - #12 by Juicy_Fruit

ensure the dummy is already inside playergui (so existing in studio view in the vpf in playergui)

I have an idle animation I use, it shouldn’t effect it too much. Thanks!

can i ask what animation it is? just so i can check it out

(assuming its a catalog idle animation not a custom)

It’s a custom one! All the animations I use are created by me. It’s just a simple legs moving up and down slightly. Shouldn’t be too bad

okay, if it doesn’t move too much you shouldn’t notice any visual errors (as the hats are static while body moving) however if you do run in to trouble with it consider a static idle animation instead

1 Like