Custom index values in tables don't transfer to server?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I am trying to send a table from the client to the server for a ghost car i am making. The table has the personal best time and all the positions of the ghost car which will then put it into datastores after it gets sent to the server.
  2. What is the issue? Include screenshots / videos if possible!
    My issue is whenever I do something like
local t = {}
t.BestTime = 20 --seconds
RemoteEvent:FireServer(t)

Then on the server I will Write

RemoteEvent.OnServerEvent:Connect(function(player, info)
     print(info.BestTime)
end)

It will print nil on the server
3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve looked all over the devhub and it seems the only way I can get the time to the server is using table.insert() but then it won’t have its own index making it really difficult to grab the time

for simplicity reasons, I want to try to stay away from using two values on the :FireServer() line such as RemoteEvent:FireServer(Time, t)

Just figured out that if we don’t use both custom Index AND table.insert() then it works; but I have to use both otherwise my system will grow to be more complex

The code you provided should be functional, what does your production code look like? (Be weary of this)


Mixed table indices do indeed get lost when transfered across the client and server boundary

ah, Mixed tables is what I’m running into. I assume there is no simple solution for this and I’ll have to find some workarounds. Thank you very much!!

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