Help with DataStore with strings/Attributes? (Read for info)

Hello!

While developing my game (in an office). I decided to add a silly thing.
I’ll go over this as quick as possible.
On a desk, we will have a folder, clicking it will have a GUI of info on the player. Some make sense and some are just for laughs.

  • Some are gonna be a nickname.
  • Some are gonna be what drink do you like between coffee, soda and water.
  • etc.

Now programming the GUI will be easy for me. But not the part of saving information like nicknames and favorite drink.

The thing is, I know how let’s say our default drink is water. We have a glass of water on our desk. Then we change the favorite drink to let’s say to coffee. But, please know, that I’m also trying to save the data between games and places, not just the one game/place.

Please know this is my first time using DataStore.

This is based on speculation, maybe there’s a better way or this isn’t working:
So I have a “lead” on what to do. First I know that I should add a string Attribute, but I do not know much well.

So let’s say we have our Attribute in the right place. Let’s just go over the favorite drink part.

So our code could be:

local Parent = --The Parent of our Attribute
local FavDrink = Parent:GetAttribute("FavoriteDrink")

--Now let’s say we changed the value of the Attribute.
--How I plan for drinks to change is just by order. (Water, Coffee, Soda)
Parent:GetAttributeChangedSignal("FavoriteDrink"):Connect(function()

if FavDrink == "Water" then
workspace.Soda:Destroy()
game.ServerStorage.Water:Clone().Parent = game.Workspace

elseif FavDrink = "Coffee" then
workspace.Water:Destroy()
game.ServerStorage.Coffee:Clone().Parent = game.Workspace

elseif FavDrink = "Soda" then
workspace.Coffee:Destroy() 
game.ServerStorage.Soda:Clone()


end
end)

For the name it should be more simple.

So how do I go about saving string Attributes. Not just on one place/game but on others.

As you can see I’ve never used DataStore.

If there’s any confusion, me missing/forgetting some details. Please let me know.

Thanks for reading.

1 Like

You cannot save data between different games, but you can save data between different places. You can try TeleportService:GetLocalTeleportData as a workaround.

2 Likes

That’s weird, I’ve seen phantom forces load progress from both normal and testing game. But am I on a good path of how am I doing things?

1 Like

They are probably using the workaround i told you. I am not sure if there is another one, but to my knowledge, that’s all.

2 Likes

So how could I do it? What should be the Attribute’s Parent?

I’ve never used DataStore so I asked the forum to give me instructions instead of me being lost. I could also try some tutorials.

I am pretty sure that phantom forces is using their own databases, instead of Roblox datastores

Data Store Transfer:
Note: This method uses both DataStoreService and TeleportService. If you are inexperienced in these areas, I recommend reviewing the documentation that I have linked above.
The only time I have ever seen this was in group recruiting plaza, which accomplished it (so I think) as so:
Prompt players with an interface asking if they had data on the old game, and if so, teleport them to the old game.
In the old game, change the code to load their data, and then teleport them back to the other game with the data attached to their “TeleportData” parameter.
Upon arriving into the new game, check if there is any data, and take it as their old data save.

1 Like