Hi!
Recently, me and @6Marchy4 have been working on a House Building system.
We needed a way to store data on an item.
The answer - Metatables!
I set one up like this.
local Data = {
DefaultData = {
FlexPoints = 350,
Plots = {
--Starter House Plot ID would go here, or items on the plot by default.
},
DefaultInventory = {
--["item"] = {quantity = 7},
}
},
DefaultItemData = {
DisplayName = "N/A",
Model = "N/A",
CameraRotation = 0,
WallItem = false,
RoofItem = false,
Price = 0,
Description = "Not available, most likely to a game error.",
Categories = "all",
CanBePutInInventory = false
},
DefaultPlotData = {
--[[
Leave empty, will be filled automatically by the server.
Example:
["Item"] = {
PositionPlaceholder = Vector3.new(0,0,0),
RoationPlaceholder = 0
}
]]
},
["FurnitureCategories"] = {
"All",
"New",
"Example",
},
["Imposter"] = {
DisplayName = "Among Us Imposter",
Model = "Impostor",
CameraRotation = 0,
WallItem = false,
RoofItem = false,
Price = 0,
Categories = "all,new,fun",
Description = "The SUSPoster is now in FYT2! A fun little buddy to vent with.",
CanBePutInInventory = true
},
}
return Data
Now, I have a few questions.
A: How would I read the data from a script?
B: How would I set the data to be read?
Thanks!