Losing Table Values

Hello! I am having a Weird problem and I need some help. For Some odd reason my Table is losing Its Indexing and a Value. Here is the Related Code:
Server Script

local Car = require(game.ServerScriptService.CarScript)--This Is a module
local Folder = game.ServerStorage.Vehicles

for i,v in pairs(Folder:GetChildren())do
	local name = Car.new(v,v.Configuration.Model.Value)
end

game.ReplicatedStorage.Events.GetCars.OnServerEvent:Connect(function(player)
	print("CarGetting")
	local Tabler = Car.GetTable()
	print(Tabler)
	game.ReplicatedStorage.Events.GetCars:FireClient(player, Tabler)
end)

A Local script In a UI:

local TS = game:GetService("TweenService")
local BlurGoal = {
	Size = 16
}
local SavedTable= {}
game.ReplicatedStorage.Events.GetCars:FireServer()
local BlurInfo = TweenInfo.new(1)
local BlurTween = TS:Create(game.Lighting.Blur, BlurInfo, BlurGoal)
script.Parent.Changed:Connect(function()
	if script.Parent.Visible == true then
		script.Parent:TweenPosition(UDim2.fromScale(0.2,0.1), "InOut",Enum.EasingStyle.Linear, 1)
		BlurTween:Play()
	end
end)
game.ReplicatedStorage.Events.GetCars.OnClientEvent:Connect(function(saveTable)
	print(saveTable)
	for i,v in pairs(saveTable)do
		table.insert(SavedTable,#SavedTable,v)
		local frame = script.Parent.ScrollingFrame.Template:Clone()
		local carName = frame:WaitForChild("CarName")
		carName.Text = v.Name
		print(v.Name)
		frame.Parent = script.Parent.ScrollingFrame
		frame.Visible = true
		frame.Name = v.Name
		
	end
	print(SavedTable)
end)

This is what is Printed out on the Server:

And here is what is Printed out on the Client:

Please note, I have the Expressive Output window Beta Enabled. That is why I can print Tables

Thank you for any Help!
Have a Great Day :smiley:

I wont claim to be an expert here, but I think the roblox network layer tries to optimize the transfers to save bandwidth. My first guess would be to try and print one of the values you don’t see.

Like, what happens if you try and print saveTable[“Name”] for example? Is it nil? Maybe the server is just not transfering over the other values because you aren’t using them?

If it indeed is nil, then I’m not 100% sure someone else with more experience here would have to chime in

The vehicles are in ServerStorage when you first reference them. Could they still be there when you FireClient? It would make sense for Model to be nil if it’s in ServerStorage, since that won’t replicate to the client. (I don’t know why [0] is getting removed, but non-array numeric indexes can be odd. Calling tostring on the numbers before making them indexes may help.)

2 Likes

Hey, So I think I found the Problem. When making an Empty Table inside of the Module Script, it is starting the Index at 0 instead of 1 like how it is supposed to be. This issue needs to be addressed as lua indexing should start at 1 and not 0. I think that while Crossing the Server-Client boundry it is trying to put it back into the standard indexing causing a value to be lost. I implemented a temporary fix of adding a random value like so: local StoreTable = {1}
Should I change this into a Bug Report?

2 Likes

Interesting, and yeah definitely