Revert accessories properties to default properties

So I have a code that when activated changes the skin color of a player to red and when deactivated changes the skin color back to normal. the problem is that I can’t seem to find a way to revert the accessories back from being red to normal, I’ve tried storing the accessories in a table - removing it, then cloning it but it always doesn’t seem to revert back.

the only thing that appears to work if that i use LoadCharacter() which appears to work but it just breaks my script, what steps could be done so i can solve this problem?

  local remote = game.ReplicatedStorage:WaitForChild("Transformation")

    remote.OnServerEvent:Connect(function(plr,active)
    	local char =  plr.Character

        	local bodycolor = char:FindFirstChild("Body Colors"):Clone()
        	local Humanoid = char:WaitForChild("Humanoid")
        	local Accessoies = char.Humanoid:GetAccessories()

        	

        	
        	
        	if active == false then
        		

        		for i,v in pairs(char:GetChildren())do
        			if v:IsA("Part")then
        				game:GetService("TweenService"):Create(v,TweenInfo.new(.7,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0),{Color = Color3.fromRGB(132, 8, 8)}):Play()
        				v.Material = Enum.Material.Neon
        				
        				
        			elseif v.ClassName == "Accessory" then
        				v.Handle.Mesh.TextureId = ""
        				v.Handle.Color = Color3.fromRGB(255, 255, 0) -- here i change the color
        				
        			end
        		end
        		
        		
        	elseif active == true then
        		
        		
        		char:FindFirstChild("Body Colors"):Destroy()
        		bodycolor.Parent = char

        		
        	end
        	wait(1)
        	remote:FireClient(plr)
        end)

HumanoidDescription lets you store properties of a character (accessories, body part colours, etc). Check out HumanoidDescription | Roblox Creator Documentation

2 Likes

thanks I will try this, for my code i didn’t need to store body colors as the character is already defaulted with that but ill see what i can do.

it worked thank you very much! :grinning: :grinning:

2 Likes