How can I equip layer clothes properly to NPCs?
This is what happens when I try
I obviously cant use AddAccessory on the client and this is my custom function to equip normal accessories:
local function CFrameAccessoryToCharacter(characterModel, accessory)
local accessoryAttachment = accessory:FindFirstChildWhichIsA("Attachment", true)
if not accessoryAttachment then
warn("No attachments found in accessory. Accessory was not attached.")
return
end
local attachmentName = accessoryAttachment.Name
local attachTo = characterModel:FindFirstChild(attachmentName, true)
if not attachTo or not attachTo:IsA("Attachment") then
warn(string.format("No attachment named %s found in character. Accessory was not attached.", attachmentName))
return
end
local Handle = accessory:FindFirstChild("Handle")
if not Handle then
warn("Attachment has no handle. Accessory was not attached.")
return
end
accessory.Parent = characterModel
Handle.CFrame = attachTo.WorldCFrame * accessoryAttachment.CFrame:Inverse()
local weld = Instance.new("WeldConstraint")
weld.Parent = Handle
weld.Part0 = Handle
weld.Part1 = attachTo.Parent
end```
Weird enough this is the only layered clothing accessory in my game that his this issue when being equipped via that function. All other layered coats, boots, etc equip fine with no issues.
You mean, because its not possible to use AddAccessory on ClientSide, you created a Client Side script to add accessories?
Is there a special reason for that? like, you dont want other players see what you are wearing?
Otherwise, you should handle the AddAccessory on ServerSide, or others wont see the changes.
What you mean by Layered Cloths? the real LayeredClothes that fits the avatar mesh? or just normal accessories? If those are the real Layered, then changing the Layer and Puffiness properties of the WrapLayer its maybe what you are looking for.
yes they are real layered clothes. And yea part of the reason is that I dont want other players to see also the fact that the menu screen pans into a massive palace which lets you view your characters and loads their armor and accessories. Every characters camera gets sent to the same palace which is also another reason I set the accessories on the client.
If that layered item is properly set as the others in your game, but its getting “big” or weird, its because its in the same layer as another layered item, try changing the Layer property in its WrapLayer same for puffiness.
May also be worth noting I have tried playing around with the wraplayer properties. The ONLY property that does something is the CageOrigin. When I change the position even by 0.01 it actually fixes the issue.
Why isn’t this the solution? Scripts changing CageOrigin position is forbidden.
I tried adjusting puffiness and nothing changed. Does puffiness have to be set before its “equipped” and I am assuming the “Order” property is the wrap layer? Adjusting that also didnt do anything.
Yeah, it works funny, the Order is how the Puffiness will be applied… its weird to explain.
The puffiness of a layer(order) will impact the scale of the the next layer(order)
The best you can do to get it, is place 3 layered, set its order ascending, then play with the puffiness of each one, and you’ll see how it affects the next layers but not backwards
Nope, I cant be sure if thats the issue, cause Im not testing it myself by trying to apply it into a character, could be the item itself not having the proper setup to work, as you said, its the only one item that its working funny in the game
It was inserted with insert service off the catalog though. Surely it couldn’t be messed up. Nothing seems different about it compared to other layered clothes. (No missing wraplayers or anything)
Took me a minute to find! This is the link to the accessory
I did find that I could subtract 0.01 from the cageorigins Y position manually instead of trying to do it from a script and it solves my issue. However thats kinda hacky and also very weird that very slightly adjusting the cageOrigin fixes it so I will mark this as a temporary solution but if a better one is found I will mark that.