Help with plot saving system

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? A normal placement save system

  2. What is the issue?
    It doesn’t seem to save, no matter what. I enabled Studio Access to API services and it’s still not working.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? Yes, I did. I followed many tutorials on placement saving like EgoMooses and yet it still didn’t work :frowning:

2 Likes

We are going to need more information than that. Can you send some code, a video of you testing the system, output messages, etc?

3 Likes

I think he is trying to make a building system like bloxburg but it won’t save to where when you leave the system it won’t save it and your progres is gone like say I build a house and leave and rejoin it will be gone.

1 Like

I can tell, I want OP to send code so I can actually look into and help to fix the problem. Simply saying ‘it doesn’t work’ won’t get us anywhere unless I can see what’s going on.

5 Likes

Well, if I type out the code, it’ll take me 1 hour or so, but sure

1 Like

Ah. I see your point. Only thing is he probably won’t… So I guess our only option is to wait. Anyway. On a completely other topic. Love your tutorials watch them everyday.

Just take photos of it. Use a pc application to take photos like gyaso or whatever it is called.

1 Like

Can you not just copy and paste what you already have?

3 Likes

Take a screenshot with Snipping Tool so we can help you.

Also, I’d like to know how you’re saving what the player has built. You cannot just save an object located in the workspace to a data store. Are you even trying to make it save when the player leaves and joins the game?

Here’s the code:

local datastoreservice = game:GetService("DataStoreService")

local store = datastoreservice:GetDataStore("PlotStore")

game.Players.PlayerRemoving:Connect(function(player)
local data = {}

local plot = workspace[player.Name.."Plot"]
for i, object in pairs(plot:GetChildren()) do
table.insert(data, {
object.Name,
object.PrimaryPart.CFrame.X,
object.PrimaryPart.CFrame.Y,
object.PrimaryPart.CFrame.Z


})
end

store:SetAsync(player.UserId, data)
end)

game.Players.PlayerAdded:Connect(function(player)

local plot = workspace[player.Name.."Plot"]
local data = store:GetAsync(player.UserId)

for i, v in pairs(game.ReplicatedStorage.Furniture:GetChildren()) do
for i, object in pairs(data) do
if object[1] == v then
local c = v:Clone()

v.Parent = plot

v:SetPrimaryPartCFrame(CFrame.new(object[2], object[3], object[4]))
end
end
end

end)

It should work

I know that objects in the workpsace cannot be saved, but I’m trying to serialize them to do so

My computer is too laggy with everything, I can’t simply do that

1 Like

Since you’re saving the object’s name, try doing
if object[1] == v.Name then
instead of
if object[1] == v then
because v is the whole object, not the name.

I tried that, but it didn’t work

I have said it before, my computer is laggy, and for some reason, I cannot copy and paste

Someone who helped me, @Abcreator to be specific, gave me this model serializer/deserializer for a game I was working on.

local properties = {"Name", "Value", "Position", "Size", "Orientation","Material", "CanCollide", "Anchored", "Transparency", "Color", "Archivable", "Reflectance"}

function change(Object)
	local Table={Type = typeof(Object)}
	local set = false
	if typeof(Object)=="EnumItem" then
		Table["EnumType"] = Object.EnumType
		Table["Name"] = Object.Name
		Table["Value"] = Object.Value
		set = true
	elseif typeof(Object)=="Vector3" then
		Table["X"] = Object.X
		Table["Y"] = Object.Y
		Table["Z"] = Object.Z
		set = true
	elseif typeof(Object)=="Vector2" then
		Table["X"] = Object.X
		Table["Y"] = Object.Y
		set = true
	elseif typeof(Object)=="Color3" then
		Table["R"] = Object.R
		Table["G"] = Object.G
		Table["B"] = Object.B
		set = true
	elseif typeof(Object) == "BrickColor" then
		Table["Name"] = Object.Name
		set = true
	end
	return {Table, set}
end

function revert(Object)
	local Type = Object["Type"]
	local result
	if Type=="EnumItem" then
		result = Object.EnumType[Object.Name]
	elseif Type=="Vector3" then
		result = Vector3.new(Object.X, Object.Y, Object.Z)
	elseif Type=="Vector2" then
		result = Vector2.new(Object.X, Object.Y)
	elseif Type=="Color3" then
		result = Color3.new(Object.R, Object.G, Object.B)
	elseif Type=="BrickColor" then
		result = BrickColor.new(Object.Name)
	end
	return result
end

local function set(model)
	local Table = {}
	for _, object in ipairs(model:GetChildren()) do
		local current = {}
		for _, property in ipairs(properties) do
			local s, r = pcall(function()
				local TMP = object[property]
			end)
			if s then
				--print(change(object[property])[2])
				if change(object[property])[2]==false then
					current[property] = object[property]
				else
					current[property] = change(object[property])[1]
				end
			end
		end
		current["children"] = set(object)
		current["ClassName"] = object.ClassName
		table.insert(Table, current)
	end
	return Table
end

local module = {}

function module:serialise(model)
	local Table = {}
	for _, object in ipairs(model:GetChildren()) do
		local current = {}
		for _, property in ipairs(properties) do
			local s, r = pcall(function()
				local TMP = object[property]
			end)
			if s then
				--print(change(object[property])[2])
				if change(object[property])[2]==false then
					current[property] = object[property]
				else
					current[property] = change(object[property])[1]
				end
			end
		end
		current["children"] = set(object)
		current["ClassName"] = object.ClassName
		table.insert(Table, current)
	end
	return Table
end

local function getmodel(Table, newParent)
	local model = Instance.new("Folder")
	for _, object in ipairs(Table) do
		local instance = Instance.new(object.ClassName)
		--print(object)
		for name, value in pairs(object) do
			if name ~= "children" and name~="ClassName" then
				if type(value) == "table" then
					instance[name] = revert(value)
				else
					instance[name] = value
				end
			end
		end
		getmodel(object["children"], instance)
		if newParent then
			instance.Parent = newParent
		else
			instance.Parent = model
		end
	end
	return model
end

function module:deserialise(Table, Location)
	getmodel(Table).Parent = Location
end

--Just for testing...
function module:test(tester)
	print(change(tester)[1])
end

return module

It deserializes folders, but if you want it to do models, change

local model = Instance.new("Folder")

to

local model = Instance.new("Model")
2 Likes

Uhm, I needed help for my plotsave, not another serializer. I want to know why it’s not working

Does anyone else know the answer?

Nevermind, I’ve figured it out.