So, I am trying to make an Anarchy game inspired by Minecraft's Famous 2B2T. The main effect I am trying to get here is for people's creations (with f3x or btools preferably ) to stay in the server forever, even with no server running. Having tried / having failed multiple different ways, attempting to get the ruins effect (building / greifing over time to make a vast world) I am almost giving up, can't find something working on the RBLX DevForum either.. (Can't even post there). How can I make this work? (Posting the code for the script directly would be preferred by me, so I can just copy it but it is alright if not, suggestions welcome!)
This is my current code:
local ds = game:GetService("DataStoreService")
DataStore = ds:GetDataStore("worldparts")
function save(a)
DataStore:SetAsync("mySavedModel", {Id = "MyModel", Position = {X = 10, Y = 0.5, Z = -6}})
end
--loader test
if workspace.atld.Value == false then
workspace.atld.Value = true
local data = DataStore:GetAsync("mySavedModel")
local newModel = game.ReplicatedStorage.Models:FindFirstChild(data.Id):Clone() -- Clones the template model. data.Id is 'MyModel'
newModel:SetPrimaryPartCFrame(CFrame.new(data.Position.X, data.Position.Y, data.Position.Z)) -- Moves the cloned model somewhere defined by our saved data.
newModel.Parent = workspace
end
game.Workspace.workspacestuff.Changed:Connect(save)
Also, workspacestuff is a model (located in the workspace)