✓ Accepted answer
Hello. The reason it says that is to prevent exploiters from changing values. Instead, use a RemoteEvent. You would insert a RemoteEvent in ReplicatedStorage and rename it to "ChangeData". Then change your LocalScript to this:
game:GetService("ReplicatedStorage"):WaitForChild("ChangeData"):FireServer()
This will fire the RemoteEvent for the server.
Now insert a Server/Regular Script into ServerScriptService. Insert the following code:
local DataStoreService = game:GetService("DataStoreService")
local myDataStore = DataStoreService:GetDataStore("myDataStore")
game:GetService("ReplicatedStorage"):WaitForChild("ChangeData").OnServerEvent:Connect(function(player)
myDataStore:SetAsync(script.Parent.Value)
end)
The OnServerEvent event will fire when the RemoteEvent is fired for the server. Then it changed the value. Also, the "player" parameter is automatically made when a client fires server. By the way, this would not work since you did not tell it what to save and the key to save it. Anyways, please accept and upvote this answer if it helps.
1 comment
How would you save it a key?