Table from client not correctly transferring to server

For some reason, when I try to transfer data from a table to the server it doesn’t transfer the data. Please help

Client script;

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()

local click = script.Parent.Click

local Tween = game:GetService("TweenService")

local Info = TweenInfo.new(
	0.75,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.In,
	0,
	false,
	0
)

local all = {
	FootGrain = false,
	FootItalian = false,
	HalfGrain = false,
	HalfItalian = false,
	Bacon = false,
	Baloney = false,
	Cheese = false,
	Chicken = false,
	Ham = false,
	Lettuce = false,
	Meatball = false,
	Onion = false,
	Sauce = false,
	Turkey = false,
}

local AvailableTypes = {
	"FootGrain",
	"FootItalian",
	"HalfGrain",
	"HalfItalian",
	"Bacon",
	"Baloney",
	"Cheese",
	"Chicken",
	"Ham",
	"Lettuce",
	"Meatball",
	"Onion",
	"Turkey",
}

mouse.Button1Down:Connect(function()
	local target = mouse.Target
	for i,v in pairs(AvailableTypes) do
		if target:IsA("BasePart") then
			if target.Name == v then
				print("available to click")
				if all[target.Name] == false then
					if target.Name == AvailableTypes[1] then
						all.FootItalian = false
						all.HalfGrain = false
						all.HalfItalian = false
						Tween:Create(game.Workspace.SubStation.HalfGrain, Info, {Transparency = 1}):Play()
						Tween:Create(game.Workspace.SubStation.FootItalian, Info, {Transparency = 1}):Play()
						Tween:Create(game.Workspace.SubStation.HalfItalian, Info, {Transparency = 1}):Play()
					end
					if target.Name == AvailableTypes[2] then
						all[1] = false
						all.HalfGrain = false
						all.HalfItalian = false
						Tween:Create(game.Workspace.SubStation.FootGrain, Info, {Transparency = 1}):Play()
						Tween:Create(game.Workspace.SubStation.HalfGrain, Info, {Transparency = 1}):Play()
						Tween:Create(game.Workspace.SubStation.HalfItalian, Info, {Transparency = 1}):Play()
					end
					if target.Name == AvailableTypes[3] then
						all.FootItalian = false
						all.FootGrain = false
						all.HalfItalian = false
						Tween:Create(game.Workspace.SubStation.FootGrain, Info, {Transparency = 1}):Play()
						Tween:Create(game.Workspace.SubStation.FootItalian, Info, {Transparency = 1}):Play()
						Tween:Create(game.Workspace.SubStation.HalfItalian, Info, {Transparency = 1}):Play()
					end
					if target.Name == AvailableTypes[4] then
						all.FootItalian = false
						all.HalfGrain = false
						all.FootGrain = false
						Tween:Create(game.Workspace.SubStation.FootGrain, Info, {Transparency = 1}):Play()
						Tween:Create(game.Workspace.SubStation.FootItalian, Info, {Transparency = 1}):Play()
						Tween:Create(game.Workspace.SubStation.HalfGrain, Info, {Transparency = 1}):Play()
					end
					all[target.Name] = true
					Tween:Create(target, Info, {Transparency = 0.7}):Play()
					click:Play()
				else
					all[target.Name] = false
					Tween:Create(target, Info, {Transparency = 1}):Play()
					click:Play()
				end
			end
		end
	end
end)

script.Parent.Finish.Button.MouseButton1Click:Connect(function()
	print(all)
	script.Parent.ToServer:FireServer("angpv9haw38th8ht", all)
	for i,v in pairs(AvailableTypes) do
		Tween:Create(game.Workspace.SubStation[v],Info,{Transparency = 1}):Play()
	end
end)

Server script;

local sentdata = false

script.Parent.OnServerEvent:Connect(function(plr, key, data)
	print("got request")
	if key == "angpv9haw38th8ht" and sentdata == false then
		print("valid request")
		sentdata = true
		print(data)
		if data["FootGrain"] == true then
			print("Yes")
			local bread = game.ServerStorage.FootGrain:Clone()
			if data.Bacon == true then
				for i,v in pairs(bread.Bacon:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Baloney == true then
				for i,v in pairs(bread.Baloney:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Cheese == true then
				for i,v in pairs(bread.Cheese:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Chicken == true then
				for i,v in pairs(bread.Chicken:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Ham == true then
				for i,v in pairs(bread.Ham:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Lettuce == true then
				for i,v in pairs(bread.Lettuce:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Meatball == true then
				for i,v in pairs(bread.Meatball:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Onion == true then
				for i,v in pairs(bread.Onion:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Sauce == true then
				for i,v in pairs(bread.Sauce:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Turkey == true then
				for i,v in pairs(bread.Turkey:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			bread.Parent = plr.Backpack
		end
		if data["FootItalian"] == true then
			print("Yes")
			local bread = game.ServerStorage.FootItalian:Clone()
			if data.Bacon == true then
				for i,v in pairs(bread.Bacon:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Baloney == true then
				for i,v in pairs(bread.Baloney:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Cheese == true then
				for i,v in pairs(bread.Cheese:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Chicken == true then
				for i,v in pairs(bread.Chicken:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Ham == true then
				for i,v in pairs(bread.Ham:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Lettuce == true then
				for i,v in pairs(bread.Lettuce:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Meatball == true then
				for i,v in pairs(bread.Meatball:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Onion == true then
				for i,v in pairs(bread.Onion:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Sauce == true then
				for i,v in pairs(bread.Sauce:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Turkey == true then
				for i,v in pairs(bread.Turkey:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			bread.Parent = plr.Backpack
		end
		if data["HalfGrain"] == true then
			print("Yes")
			local random = math.random(1,2)
			local bread = game.ServerStorage.HalfGrain1
			if random == 1 then
				bread = game.ServerStorage.HalfGrain1:Clone()
			else
				bread = game.ServerStorage.HalfGrain2
			end
			if data.Bacon == true then
				for i,v in pairs(bread.Bacon:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Baloney == true then
				for i,v in pairs(bread.Baloney:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Cheese == true then
				for i,v in pairs(bread.Cheese:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Chicken == true then
				for i,v in pairs(bread.Chicken:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Ham == true then
				for i,v in pairs(bread.Ham:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Lettuce == true then
				for i,v in pairs(bread.Lettuce:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Meatball == true then
				for i,v in pairs(bread.Meatball:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Onion == true then
				for i,v in pairs(bread.Onion:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Sauce == true then
				for i,v in pairs(bread.Sauce:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Turkey == true then
				for i,v in pairs(bread.Turkey:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			bread.Parent = plr.Backpack
		end
		if data["HalfItalian"] == true then
			print("Yes")
			local random = math.random(1,2)
			local bread = game.ServerStorage.HalfItalian1
			if random == 1 then
				bread = game.ServerStorage.HalfItalian1:Clone()
			else
				bread = game.ServerStorage.HalfItalian2
			end
			if data.Bacon == true then
				for i,v in pairs(bread.Bacon:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Baloney == true then
				for i,v in pairs(bread.Baloney:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Cheese == true then
				for i,v in pairs(bread.Cheese:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Chicken == true then
				for i,v in pairs(bread.Chicken:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Ham == true then
				for i,v in pairs(bread.Ham:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Lettuce == true then
				for i,v in pairs(bread.Lettuce:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Meatball == true then
				for i,v in pairs(bread.Meatball:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Onion == true then
				for i,v in pairs(bread.Onion:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Sauce == true then
				for i,v in pairs(bread.Sauce:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			if data.Turkey == true then
				for i,v in pairs(bread.Turkey:GetChildren()) do
					if v:IsA("BasePart") then
						v.Transparency = 0
					end
				end
			end
			bread.Parent = plr.Backpack
		end
		print(data.HalfGrain,data.HalfItalian,data.FootItalian,data.FootGrain)
		script.Parent.Parent:Remove()
	end
end)

Please help as soon as possible. Thank you.

Error solved, I just had to redesign the system.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.