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.