Hi mark,
the problem is you're trying to get the values through a local script. you're going to need to use a server script. Use a remote Event from the local script to tell the server script to add the points, ill demonstrate here. Put a RemoteEvent inside the ReplicatedStorage, its an addable item through right click options. then put this into the local script after the button has been pressed.
1 | game.ReplicatedStorage.RemoteEvent:FireServer() |
then add this to a server script
1 | game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect( function (plr) |
then add underneath that line to add the values to the folder. like this
1 | local myName = "TreasuresCollected" |
2 | game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect( function (plr) |
4 | local TreasuresCollected = plr.PlayerProfile:FindFirstChild(myName) |
5 | TreasuresCollected.Value = TreasuresCollected.Value + 1 |
let me know if this works!