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

DataStore script won't save GUI Buttons [STILL UNANSWERED]?

Asked by
Vid_eo 126
6 years ago
Edited 6 years ago

I'm trying to make a DataStore script that saves and loads GUI buttons and money; it saves/loads money just fine, but it doesn't save/load the GUI buttons; I think there's a problem with the loading.

SCRIPT:

01local DataStoreService = game:GetService("DataStoreService")
02local ds = DataStoreService:GetDataStore("danceSave")
03local ds2 = DataStoreService:GetDataStore("MoneySave")
04 
05game:GetService("Players").PlayerAdded:Connect(function(Player) --When the player joins the game, load value.
06 
07    local Stats = Instance.new('Folder')
08    Stats.Name = "leaderstats"
09 
10    local Money = Instance.new('NumberValue', Stats)
11    Money.Name = "Money"
12 
13    Stats.Parent = Player
14 
15 
View all 95 lines...

There are no errors.

0
Fun fact: Servers can't/don't see whats in the PlayerGui, Backpack, etc. They really only acknowledge their existence. Async_io 908 — 6y
0
So how would I use RemoteEvents to get around that? Vid_eo 126 — 6y
0
Could I use Global Variables to save the table and then add contents to the table in the LocalScript and then save the table in the serverscript? Vid_eo 126 — 6y
0
nvm, can't use _G. to share between local and server scripts Vid_eo 126 — 6y
0
If _G replicated and you actually used it on the server, this is a whole separate problem. hiimgoodpack 2009 — 6y

1 answer

Log in to vote
2
Answered by 6 years ago

It doesn't save objects. Just save the amount of points that each player has, and then have the GUI display that from the localscript; don't store and clone the objects themselves.

0
I’m trying to index the names of objects into a table and then displaying those objects as TextButtons. The buttons are not related to the money; they’re like animations. Vid_eo 126 — 6y
0
You really shouldn't have the server handle GUI. Fire remote events connected to functions in the player's local scripts that tell the player's GUI what to do. vanilla_wizard 336 — 6y
0
nice LegitimatlyMe 519 — 6y
0
What if I want the LocalScript to refer to a variable located in the DataStore script? Vid_eo 126 — 6y
View all comments (9 more)
0
Have the LocalScript send a get request by firing a remote event connected to the server so it can access the DataStore and return the amount of points to the player vanilla_wizard 336 — 6y
0
I want these GUIs: https://gyazo.com/47f1ee22660f94c4f3005ff407a578ec to move here: https://gyazo.com/fcfe1a78dd8c40233bf979122dcea331. All the variables etc. are correct. The money script works fine. I did this with tools and it also worked well. Vid_eo 126 — 6y
0
I don't think you're approaching this in a very efficient way. Why not have the GUI elements inside of the GUI and have the code that handles the GUI be inside of the GUI? If it's really necessary for the server to handle that, use remote events. Having DataStore save and load the buttons themselves is unnecessary. Save yourself time by handling the UI on the client. vanilla_wizard 336 — 6y
0
How would I check to see if players unlocked the GUIs w.out using a datastore?? Vid_eo 126 — 6y
1
Just use DataStore to save very basic data about the player's achievements (whether a true/false "unlocked" value, an integer "level" or "points", etc). Send that basic data to the client in the GUI over a remote event, and have the GUI handle the GUI from a local script. The local script can have the GUI appear or disappear, but having the server clone it into the player isn't a good idea. vanilla_wizard 336 — 6y
0
Thanks for your help! I thought about it a bit and decided to use values and then use a RemoteEvent to transfer the GUIs if the values were true, and it worked! Vid_eo 126 — 6y
0
I actually still have one more issue. I save the Values in ReplicatedStorage and then replicate those values into the player, but I think that that's breaking the DataStore with multiple people. Should I just put the values inside of the Player? Vid_eo 126 — 6y
0
Never mind, I fixed it! Sorry to bother you Vid_eo 126 — 6y
0
Never mind, it's still broken, but I'll find a way to fix it Vid_eo 126 — 6y
Ad

Answer this question