so i was making a settings gui with datastore saved . (i save it with values) . but then i realise it didnt save because the value is still the same . so can somebody tell me what is the most simple way to change value with local script? (pls be server-side)
I don’t really understand your issue. Can you try rewording?
what i want is to change the value with local script . i also want it to be server-side .
You should consider using a RemoteEvent. RemoteEvents allow you to send data from the client to the server, and vice-versa. The only issue with this is that exploiters can fire RemoteEvents.
I don’t understand, you want to use a local script but you want it to be server-sided… If you are trying to communicate between client and server, use remote events.
i know it needs remote events , but i dont quite know how to do it . i never change value with remote event.
i dont quite know how to do it .
I recommended checking the docs that @Volieb have included in his reply.
i can’t find any , so can you show some example script?
So, I assume you want to go client to server. So, on the client script use FireServer. On the server side use OnServerEvent. You can change the player’s value since the first parameter is the player.
thanks for the link , i will go see it now
maybe you could put those settings value in replicated storage? and each player would have their own folder that contains those values and then it can be saved when they leave
Here: add a remote event in ReplicatedStorage. For the example I will call it “ChangeValues”
Then in serverScriptService add a script like this:
local event = game.ReplicatedStorage.ChangeValues event.OnServerEvent:Connect(function(player, value, newVal) player:WaitForChild(value).Value = newVal end)
Then finally in your local script add this:
local event = game.ReplicatedStorage.ChangeValues event:FireServer(“Coins”, 10)
Change coins to the value you want to set also if you are setting values in the leaderstats then change the line in the serverScriptService script to get the value from the leaderstats
i put them in their folder . (like a leaderstats folder)
yes like a leaderstats but you put the folder in replicated storage when they join and delete the folder after they leave and you dont need remotes as putting them in replicated will basically replicate to server
is there any simple way than this?
yeah my way would be the most simplest if you want even simpler just use remotes i guess
because i often use remote events , so can you tell me what is the player, value, newVal ?
or you could use a module script since its shared sided(server and client)
remotes arent good(just saying)
fine i will use remote events .