You can get the length of your table even if its an array
local t = DynamicTables("MyTable")
t.owners = 10
t.active = false
t.price = 1000
print(#t) -- Prints 3!
Your tables will replicate to clients automatically
--[[Server-Script]]
local t = DynamicTables("MyTable")
t.a = true
t.b = false
t.c = 100
--[[Local-Script]]
local t = DynamicTables("MyTable")
print(t.a, t.b, t.c) -- Prints true, false, 100
You can use signals to listen to changes that are made to the table
local t = DynamicTables("MyTable")
t.health = 100
t:Changed("health"):Connect(function(old, new)
print(`HP: {old}->{new}`)
end)
t.health = 50 -- Prints HP: 100->50
ExampleUsage:
--[["Server-script"]]
local DynamicTables = require(game.ReplicatedStorage.DynamicTables)
local myTable = DynamicTables("MyTable") -- this is how you get your table
myTable.Health = 10
myTable.Health += 250
--[["Local-script"]]
local DynamicTables = require(game.ReplicatedStorage.DynamicTables)
local myTable = DynamicTables("MyTable")
print(myTable) -- prints 260
if the module doesn’t work for you, try using this forked version which uses bytenet instead of bridgenet2, I will never be able to access studio again so I cant update this module myself.
well you’re sending a whole table to the player by doing this which will result in having a high recv, my module only sends the part of the table that is being updated
so if you care about optimization then there is nothing wrong with using my module
this looks promising, I would need support for bulk actions for optimizations. If i have a game where a player can bulk sell 500 items at once, i dont want to do 500 remotes at once for it
updates now happen every frame instead of every time the index changes
this is good for changing lots of items in the table all at once because it prevents remote event spamming
I honestly just wanted to rewrite the module but got stuck trying to make nested tables work so I gave up and just updated the module
for some reason, this simply doesn’t work for me.
I tried with both color3s and strings, and neither of them replicated. the :Changed signal didn’t even fire
i also tested by printing the length of the table every frame
on the client, it stays at 0 even though i’m changing like 2 things inside the table every frame on the server
edit: after a bit of thinking i have a hunch that it’s from parallel coding
but i can’t say for sure yet
edit 2: after testing, nope, whatever i put in gives me nil no matter what i do
are you using the 0.05 version? last time I worked on it it was working fine.
also, since Roblox studio is banned in my country I can’t update the module (I don’t remember if it is updated or not) on the marketplace so you have to get the rbxm file from the GitHub repo