Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 6 years ago

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!

0
Bump giantjdd 5 — 6y
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. VeryDarkDev 47 — 6y
0
Thanks, i will give it a shot giantjdd 5 — 6y
0
I quickly figured out that i still have no idea how to do that... giantjdd 5 — 6y
View all comments (3 more)
0
bump giantjdd 5 — 6y
0
bump giantjdd 5 — 6y
0
hi 123nabilben123 499 — 3y

1 answer

Log in to vote
0
Answered by
zblox164 531 Moderation Voter
6 years ago
Edited 5 years ago

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.

Ad

Answer this question