When I first started scripting, you could use a serverscript inside of StarterGui. However, that is no longer the case. Now you have to use a localscript to run any code inside of PlayerGui. The problem I have whit this is that the changes I do with a localscript seems to only happen to the client and not the server. For exaple, if I try to make a GUI where when the player clicks on it, it gives them Money, the player will recieve money after clicking on the GUI but it seems that the money only exist on the clients computer because when i try to also change the players balance with a serverscript, the players money goes back to where it was before I changed the value with a localscript. This also makes me unable to save the players progress because the DataStoreSystem cannot see the players money and can therefore, not save it.
When i try to move a object it doesn't move for everyone but only for the player that activated the localscript.
My question is, how can i fix this. Is there any way to get a localscript to make a change to the server or is there some way to use a serverscript inside of StarterGui
This is a good question, cuz like this you can learn how to use Remote Events
, which is a way to communicate between server and client. Using it is fearly easy.
https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events
And this is also used for protecting your game from exploiters
https://www.youtube.com/watch?v=C0qQ4lDa3t0&t=168s (im not sure if this has any deprecated stuff)
Happy to help!
Client/Server is a really cool mechanism that is really interesting, and I recommend learning more about it.