I’m new to DataStore2 and I need to store lots of things. I need to store wins, moneys and bunker likes and bunker data but I am still confused on how to do that and also a bit confused on how to load data.
local DataStore2 = require(1936396537) -- I need to change this to the updated one
local ServerStorage = game.ServerStorage
local Workspace = game.Workspace
local Players = game.Players
local default omega_coins = 0
local default_likes = 0
local default_wins = 0
local default_bunker_terrain_position = {CFrame.new(26.927, -33.383, -435.507), CFrame.new(26.927, 23.365, -572.788), CFrame.new(164.479, 23.365, -434.153),
CFrame.new(-110.625, 23.365, -435.236), CFrame.new(25.844, 23.365, -297.955)}
local default_bunker_terrain_size = {Vector3.new(277.27, 8.143, 277.27), Vector3.new(277.27, 108.309, 2.708),Vector3.new(2.166, 108.309, 274.562),Vector3.new(2.166, 108.309, 272.396),Vector3.new(275.104, 108.309, 2.166)}
local default_bunker_materials = {"Mud","Rock","Rock","Rock","Rock"}
Players.PlayerAdded:Connect(function(plr)
local pointsDataStore = DataStore2("Ωmega Coins",plr) -- tried putting more things there but i don't think that is how it works
local leaderstats = Instance.new("Folder",plr) ---leaderstats folder
leaderstats.Name = "leaderstats"
local wins = Instance.new("IntValue",leaderstats) --leaderstats
wins.Name = "Wins"
local omega_coins = Instance.new("IntValue",leaderstats)
omega_coins.Name = "Ωmega $"
local likes = Instance.new("IntValue",leaderstats)
likes.Name = "Likes"
end)
function save_to_model(folder_name, target_location, xoffset, yoffset, zoffset)
local newMap = ServerStorage.empty_map:Clone()
newMap.Name = folder_name
newMap.Parent = Workspace.maps
local terrain = newMap.terrain:WaitForChild("cubes")
for i, v in pairs(default_bunker_materials) do
local part = Instance.new("Part")
part.Name = v
part.Anchored = true
part.Transparency = 1
-- new block:
part.CFrame = default_bunker_terrain_position[i]
part.Size = default_bunker_terrain_size[i]
part.Parent = terrain
end
end
save_to_model("MrGuyROBLOX's Dungeon", game.Workspace.maps,0,0,0)