Firing a table that contains numbers and strings to server removes the strings from the table

So in my combat system, I use tables to determine different values for stuff like range, damage, and stun.
The table that has been giving me the problem is below.

Stun = {
	[1] = .5;
	[2] = .5;
	[3] = .5;
	[4] = .5;
	[5] = .5;
	["KickUp"] = 1.5;
	["M2"] = 1;
};

My combat system doesn’t only have 5 hits, but it also has a guardbreak move (“M2”) and a strong kick move (“KickUp”).
My problem is that whenever I fire this table to the server, [“KickUp”] and [“M2”] disappear from the table.

--Local Script
print(combat.Stun)
CombatRE:FireServer(hum, combat, combo, spacePressed)

--[[
Prints out:
{
    [1] = 0.5,
    [2] = 0.5,
    [3] = 0.5,
    [4] = 0.5,
    [5] = 0.5,
    ["KickUp"] = 1.5,
    ["M2"] = 1
 }
]]



--Server Script

CombatRE.OnServerEvent:Connect(function(plr, hum, combat, combo, spacePressed)
	print(combat.Stun)
end)
--[[
Prints out:
{
    [1] = 0.5,
    [2] = 0.5,
    [3] = 0.5,
    [4] = 0.5,
    [5] = 0.5
 }
]]


I feel like this may be a common problem, but I’ve never experienced it before, so can someone help me by telling me why this is happening?

1 Like

bump (character limit breached)

Add quotes to your numbered table indexes

[“1”] = 0.5

1 Like

Remote Events and Callbacks | Documentation - Roblox Creator Hub

Passing a table with mixed indices as an argument for a RemoteEvent results in the loss of data as you’re experiencing in your example. You need to keep the data type of your indices consistent whenever you pass a table through a RemoteEvent.

1 Like

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