Pretty much, except remember you can’t access DataStores on LocalScripts, which means you’ll have to use a PlayerAdded event on the server, create a variable called “data” or something and assign it to BoolValueData:GetAsync(player.UserId) or {}
. The reason why we do “or {}” is because if a new player joins, they aren’t going to have any data, so we need to just give them a blank table.
After you get the data, you could probably just use the same remote event, except fire it to the client that just joined the game by doing RemoteEvent:FireClient(player, data)
. This will send over the player’s boolvalue data from the datastore.
The only downside to this (and why I suggest doing your own research on DataStores and tables) is that you will probably have to manually assign each BoolValue value in the table you received in the LocalScript, to the corresponding BoolValue located in the GUI.
If you made your table into a dictionary with each Index in the dictionary being a unique name for each BoolValue, you could just loop through the data with a for loop, but I’m not gonna discuss that because I think it might be bit too advanced and I wouldn’t be able to explain it well.
Anyways, in your LocalScript, you can do RemoteEvent.OnClientEvent:Connect(function(data)
to receive the data, then do what I said above and set each BoolValue’s value to the corresponding data value in your data table.
For example, to set Isequipped1’s value, you could do Isequipped1.Value = data[1]
. data[1] represents whatever value is in the first index of your data table, so if the first value in the table is false
, Isequipped1’s value would be set to false.
This is kind of long and hard to explain, so if you need elaboration on certain parts, feel free to ask or look it up on the internet.