You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? A normal placement save system
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.
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
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.
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.
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.
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?
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)
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.
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