The title basically explains my problem.
What I’m trying to achieve:
The client chooses Ice-cream flavor and toppings and sends a table of data(about the chosen ice-cream) to the server.
The problem:
The server is outputting nil when trying to edit the Ice Cream that will be given to the player.
The Code:
Client:
local sendData = {
cherry = false,
glaze = false,
sprinkles = false,
OreoTop = false,
OreoBottom = false,
LayerTop = false, -- color for top layer
LayerBottom = false -- color for bottom layer
}
--- for the purpose of being concise Im gonna show
--he values changing and firing the table
sendData[4] = true
sendData[7] = v.BackgroundColor3
sendData[3] = true
sendData[5] = false
sendData[6] = v.BackgroundColor3
sendData[1] = true
sendData[2] = true
sendData[3] = true
Server:
IEvent.OnServerEvent:Connect(function(player, data)
local cone = player.Backpack:FindFirstChild('Cone')
cone.Name = 'IceCream'
local data2 = {
baseColor = data[7],
secondaryColor = data[6],
oreoBottom = data[5],
oreoTop = data[4],
sprinkles = data[3],
glaze = data[2],
cherry = data[1]
}
local l1 = data.layer1Base
local l2 = data.layer2Base
cone.Layer1Base.Color = data2.baseColor
cone.Layer1Main.Color = data2.baseColor
cone.Layer2Base.Color = data2.secondaryColor
cone.Layer2Main.Color = data2.secondaryColor
cone.Layer1Base.Transparency = 0
cone.Layer1Main.Transparency = 0
cone.Layer2Base.Transparency = 0
cone.Layer2Main.Transparency = 0
if data2.oreoTop== true then
for i,v in pairs(cone.ChipsT) do
v.Transparency = 0
end
end
if data2.oreoBottom == true then
for i,v in pairs(cone.ChipsB) do
v.Transparency = 0
end
end
if data2.glaze == true then
cone.Glaze.Transparency = 0.45
end
if data2.cherry == true then
cone.CherryOnTop.Transparency = 0
end
if data2.sprinkles == true then
for i,v in pairs(cone.Sprinkles:GetChildren()) do
v.Transparency = 0.9
end
end
end)