I want to achieve a character customization but I’ve encountered a problem. Whenever I try to add the accessory by clicking the button it will add it to my character but not stick.
I haven’t been able to find a good enough video which would be helpful.
I’ve tried the developer hub, YouTube as well as changing the code multiple times.
script.Parent.MouseButton1Up:Connect(function()
local AccessoryName = script.Parent:FindFirstChildWhichIsA("Accessory").Name
if game.Players.LocalPlayer.Character:FindFirstChild(AccessoryName) then
game.Players.LocalPlayer.Character[AccessoryName]:Destroy()
else
game.Players.LocalPlayer.Character.Humanoid:AddAccessory(script.Parent[AccessoryName])
end
end)
The code above is what I’m currently using, In the past I’ve used this code and It’s worked fine. I’m sorry if the code isn’t the best I haven’t done coding in almost half a year.
I’m stumped, is anyone able to help?