I’m relatively new to scripting. Everything I know is basic, so I need a little help with this problem I’m experiencing right now.
I have a LocalScript in StarterCharacterScripts that is supposed to update the LocalPlayer’s GUI based on a value obtained from ServerStorage. Now, I didn’t immediately realize this but it might be obvious to you that a client is unable to see the contents of ServerStorage. What would I need to do in order to obtain a specific folder (and contents) from ServerStorage?
If it’s any help, the purpose of the script is to pull an IntValue from a player’s folder (ex. game.ServerStorage.suffixed.stats) and display it on a TextLabel. I had the folder created in ServerStorage to prevent exploiters from reaching it, but is there a better location?
You need to have remote events, so when the client the event, a script on the server will return the stats from server storage. It is more effective to use Replicated Storage.
Alrighty, thanks for the response! I’ll look into learning out to use RemoteEvents now. I was pretty sure it was something like that I needed to do, but I didn’t mention it because I didn’t want to look dumb if that wasn’t the case - haha.
I’m sure you recommended ReplicatedStorage because the following is false, but will exploiters be able to access it? Also, why is it better? Would it allow the LocalScript to obtain the values without a RemoteEvent or is that still necessary?
If you are sending the value to the client you might as-well just put it in a location where the client can just read it itself such as replicatedstorage, then just do any server-side checks as needed.
For example, say i put a value in my player object called “Money”. The client can listen to the changed event of that value and output it to a GUI or something. All the server would be doing in this case is updating the players money whenever you want it to. An exploiter could obviously update said value however, a change like that won’t replicate to the server.