How to save a workspace?

hi im making game and tried to save workspace but chat gpt cant make it,now im dont know how to save workspace,pls help!

1 Like

Can you explain what you mean by “save workspace”?

tell chat gpt to use the save place api

save objects in workspace and their location

I need a Lua script for a Roblox game that demonstrates how to save and load a place using the game:SavePlace() and game:LoadPlace() APIs. The script should include:

  1. A function to save the current place to a specified slot.
  2. A function to load a place using a given place ID.
  3. Proper error handling to catch and log any issues during the save and load processes.
  4. Example usage of both functions.

Please provide the complete script with comments explaining each part.

this promt genarates what you want (chat gpt genarated this promt :joy::joy:)

Hi! :wave:
Could you pass more details on “saving” the workspace? Do you want to clone all objects from workspace in-game to other folder or just saving them in files?

Hello! I want clone all objects from objects in-game, like simulators

for example: player buy something and its in workspace and when player leaves this object is load

this all i want to do.

(sry for bad english)

1 Like

So, you want to save an object (tool or something else) when player will buy it and so he will keep it even when leaving?

1 Like

yep i want keep object when im buying something and leaving

here file of project just in case of something
system.rbxl (203.5 KB)

In that case, you need to learn about DataStoreService here.

But, I’ve made working (maybe) code, so you can look at that to assist:

-- here you obtain the data store itself
local DTS = game:GetService("DataStoreService")
local DTName = "GameData" -- a name for it, switching default name to another will cause data loss
local Store = DTS:GetDataStore(DTName) -- creating data store if not exists, if exists, then getting it.

local part = game.Workspace.ClickDetector

part.MouseClick:Connect(function(player)
	if not part.Visible and not Store:GetAsync("ObjSaved_" .. player.UserId) then
		part.Visible = true
		Store:SetAsync("ObjSaved_" .. player.UserId, true)
		print("Data was successfully saved!")
	end
end)

thanks! i will learn about data,i will try this code now

1 Like

hello! it i again i will search something in google about data,but thank you for help!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.