One of the strangest issues with my code that I've seen in quite awhile

Hello! So I’ve been working quite hard on a character customizer. Just recently I noticed a really weird issue. So everything works here, but when I click on a button that changes my character’s accessory (it uses AddAccessory to add the accessories to the rig.) It does remove the existing hat, but from that point forward it never actually puts the next hat in the list onto the rig. Works perfect in Studio. Almost on the urge of saying this is on Roblox’ end, but I’m gonna hold off on that thought for right now.

The whole customizer is done on the client, and I actually create a new rig on the client for that client alone, that’ll be the rendering target to show the player what will appear on their actual character when they finish. This is the rig that accessories and so forward are added upon while in the customizer.

Makes absolutely no sense. Everything works, there’s no errors with my code, I did a lot of research on the methods I’m using, not seeing any limitations with them, everything should be good.

I will send you the portion of my code, but this makes no sense. Here’s the portion where it’ll update the rig with the proper accessories:

for i,v in pairs(rig:GetChildren()) do
    if v:FindFirstChild(element.Parent.Name) then
        v:Destroy()
    end
end

local item = items[element.Parent.Name][element.Name]
humanoid:AddAccessory(item:Clone())

Sorry for the poor indentation. Roblox makes it quite hard to post your code in a clean fashion.

Thanks for reading.

EDIT: Like literally everything is in it’s proper place, 99% sure. I printed the item, and all that data is perfectly correct. Gotta make an assumption this is a bug with Filtering or something else. Can’t figure it out.

Is AddAccessory done in the local script?

1 Like

I remember having incredible INSANE problems with client-side accessories and helping people with similar problems. You should look into testing client side accessory code in isolation. It is likely not doing what you expect.

1 Like

Related?

1 Like

Yep. I assumed at first it was from using this, so I changed it to just clone it and parent it to the player. Didn’t work. If I could make an assumption here, I’d assume Accessories don’t work well under circumstances like using it client-sided only. But the weird thing is, another portion of my code uses the same thing to put accessories onto the rig, and that works. (Load the default character appearance when the player first joins into the game.) Works fine.

Really, really stupid.

Thanks for the replies, guys. I guess a workaround might be to weld the parts of the accessories to the character’s head, rather than using the Accessory class, which I think is bugged.

A bit upset about this honestly, I mean, Roblox is super greedy, can you atleast make your game engine some-what doable?

You would just have to make the welds on your own. I think last time I used a module for the weld offsets on the client side.

I am sure there is a feature request to update this o.o

1 Like

What?

In any case see this reply for some code that may help. Consider also replying on this thread with details about how this impacted your work so it ends up back on the radar.

2 Likes

Thank you for the link! Definitely will try this.