I am making a tycoon and want to use a table that stores all of the bought buttons to save their data.
Dont know how to do these
- Adding the table data to the player
- saving the table data
- Getting the table data from another script
I am making a tycoon and want to use a table that stores all of the bought buttons to save their data.
Hello, your best bet is to use ModuleScripts. You’ll be able to call the data inside the Module from other scripts in your environment.
like this? still not really sure how to store them to the player and save them and then load them when the player joins back
local module = require(script.Parent)
local OwnedPads = module.Pads
local function buyPad(padId)
table.insert(OwnedPads, padId)
end
local module = {}
module.Pads = {}
return module
You need to use a datastore to store data. Roblox’s documentation has example scripts.
By saving data he could also mean for that game session. For example, did player pick this thing up? Another script can also check tha value so i think modules for session store and datastores for just data saving after player left which can be loaded
simply, make a loop that checkes bought buttons, then make Table[“Button1”] = 1 – This is good practice of using table, if you wan’t it back make:
if Table["Button1"] then -- checks if table have this index
or
local button1 = Table["Button1"]
saving data is easy if you know data stores, watch this: https://www.youtube.com/watch?v=n1UpT2csAzo