ok so heres a bit of my server script, so when the player removes an accessory from their character (via a gui list of all accessories in their character). the accessory gets removed from the character but not from the humanoid description?
how can i update the description to be updated with what the player is currently wearing?
btw dont mind the 2 functions, those r just to update the list and stuff.
local function getAccessoryList(character)
local accessories = {}
for _, accessory in ipairs(character:GetChildren()) do
if accessory:IsA("Accessory") then
local accessoryName = accessory.Name
local accessoryId = accessory:FindFirstChild("AccessoryId") and accessory.AccessoryId.Value or accessoryName
accessories[accessoryName] = accessoryId
end
end
return accessories
end
local function updatePlayerAccessories(player)
local character = player.Character
if character then
local accessories = getAccessoryList(character)
for accessoryName, accessoryId in pairs(accessories) do
updateWearingListEvent:FireClient(player, accessoryName, accessoryId)
end
end
end
removeAccessoryEvent.OnServerEvent:Connect(function(player, accessoryId)
local character = player.Character
if character then
for _, accessory in ipairs(character:GetChildren()) do
if accessory:IsA("Accessory") then
accessory:Destroy()
accessoryRemovedEvent:FireClient(player, accessory.Name)
break
end
end
updatePlayerAccessories(player)
end
end)