Why isn't my player data save working?

You’re doing that from Client Side?

yes, i am new to scripting, so i do not know exactly everything, what is an example of a script that would work

sorry, i just realized that sounded mean

Do it from Server Side, you can use a RemoteEvent.

Client Side:

--// Variables //--
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("REMOTE EVENT NAME")

--// Functions //--
script.Parent.MouseButton1Click:Connect(function(click)
	RemoteEvent:FireServer()
end)

Server Side: ServerScriptService

--// Variables //--
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("REMOTE EVENT NAME")

--// Functions //--
RemoteEvent.OnServerEvent:Connect(function(Player)
	local leaderstats = Player:WaitForChild("leaderstats")
	if leaderstats then
		leaderstats.Coins.Value += (VALUE TO ADD)
	end
end

Let’s try this!

REMINDER’s

  • Make sure add a Remote Event inside of Replicated Storage, and update the variables with the Remote Event name.

where would i put the script btw

that doesn’t work because when changing values from the client, the changes are not sent to the server. so only you would see that you got one more coin, but the server and other players will not. there are a few exceptions to this rule though, for specific values located in specific places.

Server Side in ServerScriptService.
Client Side in StarterGui.

what would the remote event name be

You can choose a random name, but remember change the variables of both sides.

wow it WORKS, thank everyone so much, u guys are the best

Alright! Then it’s done, make sure mark the reply as solution. Have a nice day.