✓ Accepted answer
I'll assume you have the leaderstats already set up, but if you don't, I have attached a link at the bottom of this answer that will help you do that.
Player = game.Players:GetPlayers()
Player.leaderstats[Currency].Value = Player.leaderstats[Currency].Value + 30
The problem here is that the variable "Player" is referring to a table of players, which is what :GetPlayers() returns. It then tries to search that table for a value "leaderstats," but does not find it. In order to change each player's stats, you'll have to loop through the table of players. Here is a solution that will add to each player's stat.
local Players = game.Players:GetPlayers()
for i = 1, #Players do
Players[i].leaderstats[Currency].Value = Player[i].leaderstats[Currency].Value + 30
end
If you want to give stats to a specific player:
local Player = game.Players.PlayerNameHere
Player.leaderstats[Currency].Value = Player.leaderstats[Currency].Value + 30
Here are some resources on loops and creating leaderstats:
https://developer.roblox.com/articles/Roblox-Coding-Basics-Loops
https://developer.roblox.com/articles/Leaderboards
4 comments
When you press play, or test a local server, does your player or do the players have an object called "leaderstats" in them?
nvm someone already answered
@Cvieyra2test yes it have but until now I still can't figure out even thought there is answer but I still can't locate the player correctly
@Cvieyra2test I want it to be locating the player that is playing the game.