Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would i add a save feature to a sandbox tycoon?

I have been looking around the internet for a while now trying to find a way to save objects on somebodies base, but i don't know how to or where to start. I just got finished making the base game yesterday and now it works, but i have no idea how to save your base or your cash in leaderstats. Please help!

7 comments

0

Bump

0

I'm not sure how to actually type/code this but I think if you were to make a folder inside the base that all of the objects are stored in with some value holding their location, and then have the game take those objects save them in a data store and then load them back up into their locations on the base? I have no experience with this however and some one else may know how to do this.

0

Thanks, i will give it a shot

0

I quickly figured out that i still have no idea how to do that...

0

bump

0

bump

0

hi

1 answer

I have the same problem but I may have the solution. You could put every object inside of ServerStorage and put a value such as a Vector3 Value inside of each object. I would put a StringValue inside of each object as well. You can store the position and rotation in these values. The String value is used to check if the item has been purchased or not.

Here is an example of checking if the object has been purchased:

local serverStorage = game:GetService("ServerStorage")

if serverStorage.Object.StringValue.Value == "Purchased" then
	-- if the player has data load it

	serverStorage.Object:Clone().Parent = location 
	game.location:WaitForChild("Object").Position = game.location.Object.Position.Value
	-- Same goes for rotation
else
	-- Creates a new key for the player 
end

This is not a whole script just an idea. As far as storing the data just look up a Data Store tutorial. I will not be giving a script on that because there are lots of resources on that topic.

This discussion is preserved as it was. New answers, comments, and votes are closed.