I have this in a local script:
ReplicatedStorage:WaitForChild("ChangeParam"):FireServer(game.Players.LocalPlayer.data.has_done_intro.Value, true)
and this in the server script:
ReplicatedStorage.ChangeParam.OnServerEvent:Connect(function(player, param, new)
param = new
save_data(player)
end)
-- save_data(player) just saves the datastore.
I suppose this code doesn't work because the change is done in the local script, and not the server script (where it should be done in order for save_data to work). My goal is to be able to change the user's variables (in the folder leaderstats and a folder I created called data) from any local script, without having to make separate remote events for every single thing I want to change. Is there a way to do that? Maybe I should stick to separate remote events for each parameter (such as changing coins, level...)?

5 comments
Brilliant.
But remember something EXTREMELY IMPORTANT. That code is EXTREMELY VULNERABLE. Exploiters can destroy literally EVERYTHING AND ANYTHING in your game if you do that.
Oh! How can I make it not vulnerable?
I suppose clients can send to the remote event and therefore add coins to themselves etc...
Maybe sending some kinda encoded key that only the server can decode will work? Donno, please help.