For the last couple of days I have been working on a function that converts saved bunker data to a model.
However when I test run the function it doesn’t ever load the data correctly.
I have tried arranging the for loop differently (making one for loop that changes each property, and different for loops for each property) but it would always result in an incorrect number of parts, incorrectly named parts or incorrectly positioned parts.
also sorry incapaxx i didn’t use get service
Resources:
ServerScript:
local DataStore2 = require(1936396537)
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)
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)
ServerStorage.empty_map:Clone()
ServerStorage.empty_map.Name = folder_name
ServerStorage[folder_name].Parent = Workspace
local terrain = Workspace[folder_name].terrain:WaitForChild("cubes")
for i, v in pairs(default_bunker_materials) do
Instance.new("Part",terrain)
end
for i, v in pairs(default_bunker_terrain_size) do
terrain.Part. Size = v
end
for i, v in pairs(default_bunker_terrain_position) do
terrain.Part.CFrame = v
end
for i, v in pairs(default_bunker_materials) do
terrain.Part.Name = v
end
end
save_to_model("MrGuyROBLOX's Dungeon", game.Workspace.maps,0,0,0)
Explanation of my map format: