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)