Hello, I am trying to put a players skintone inside a table, and then use it afterwards, but I cant seem to extract the value from a table. Basically whenever a player presses E, then their whole character will be the material forcefeild, and the color white. Then when they press E again, their materials turn into plastic and their skintone turns into their own original skintone, however table.concat is not working for me. Is there anything wrong with this script? Any help is appreciated, Thanks!
heres the error code when I press E again to change back to my normal state:
invalid value (userdata) at index 1 in table for ‘concat’
local color1 = {}
table.insert(color1, char.Head.BrickColor) --Skintone of player
local function Visiblity(Var)
if Var then
for i, Part in pairs(char:GetDescendants()) do
if Part:IsA("BasePart") or Part:IsA("MeshPart") then
Part.Material = Enum.Material.Plastic
char.Head.Material = Enum.Material.Plastic
char.HumanoidRootPart.Material = Enum.Material.Plastic
Part.BrickColor = table.concat(color1)
char.Head.Brickcolor = table.concat(color1)
char.HumanoidRootPart.Brickcolor = table.concat(color1)
end
end
else
for i, Part in pairs(char:GetDescendants()) do
if Part:IsA("BasePart") or Part:IsA("MeshPart") then
Part.Material = Enum.Material.ForceField
char.Head.Material = Enum.Material.ForceField
Part.BrickColor = BrickColor.new("Institutional white")
char.Head.BrickColor = BrickColor.new("Institutional white")
end
end
end
end