I am attempting to pass a color3 as three values in a table then retrieve those values to color my character on the server, problem is I cannot get variable B to equate to N
-- Local Script
RE.OnClientEvent:Connect(function(playerdata)
--print("Recieved")
UI.Enabled = true
camera.CameraType = "Custom"
--camera.CFrame =
-- Skin Color Picker
local skin = {}
for i,v in pairs(CustomScreen:WaitForChild("SkinColorPanel"):GetChildren()) do
if v:IsA("TextButton") then
v.MouseButton1Click:Connect(function()
for a,b in pairs(playerrig:GetChildren()) do
if b:IsA("Part") or b:IsA("MeshPart") then
if b.Name == "Head" or b.Name == "Left Arm" or b.Name == "Right Arm" then
b.Color = v.BackgroundColor3
skin[b.Name] = {b.Color.R,b.Color.G,b.Color.B}
end
end
end
RE:FireServer(skin)
end)
end
end
-- Clothing Color Picker
local clothing = {}
for i,v in pairs(CustomScreen:WaitForChild("ClothingColorPanel"):GetChildren()) do
if v:IsA("TextButton") then
v.MouseButton1Click:Connect(function()
for a,b in pairs(playerrig:GetChildren()) do
if b:IsA("Part") or b:IsA("MeshPart") then
if b.Name == "Torso" or b.Name == "Left Leg" or b.Name == "Right Leg" then
b.Color = v.BackgroundColor3
clothing[b.Name] = {b.Color.R,b.Color.G,b.Color.B}
end
end
end
RE:FireServer(clothing)
end)
end
end
end)
-- Server script
RE.OnServerEvent:Connect(function(player, colors)
print("BEFORE")
print(colors)
print(playerdata[player]["playercolors"])
for i,v in pairs(colors) do
for l,n in pairs(v) do
for x,y in pairs(playerdata[player]["playercolors"]) do
if x == i then
y = v
for a,b in pairs(y) do
b = n -- WHY DOESNT THIS WORK???
end
end
end
end
end
print("AFTER")
print(playerdata[player]["playercolors"])
SetColors(player)
end)
function SetColors(player) -- SET LAST SAVED COLOR SCHEME OF PLAYER
for i,v in pairs(player.Character:GetChildren()) do
for a,b in pairs(playerdata[player]["playercolors"]) do
if v.Name == a then
--print(b)
v.Color = Color3.new(b[1],b[2],b[3])
end
end
end
end
