Answered by
5 years ago Edited 5 years ago
By using .plr1
, you’re trying to ascend into the Players
container, to verify two things: Is there a Player Object called "plr1", or is there a property called "plr1"? Both of which effectively are false which is raising your invalid
exception. To actively filter for something as an Object, you have to concatenate it in via square braces.
But the issue doesn't stop here, :GetPlayers()
returns an array of Player Objects, meaning you're trying to look for a table as a Player. Instead—and since it's a table, we can use a pairs
loop to iterate over each Player Object within the array, and manipulate them one-by-one
01 | local Teams = game:GetService( "Teams" ) |
02 | local Playing = Teams.Playing:GetPlayers() |
05 | for _,Player pairs (Playing) do |
06 | local Wins = Player.leaderstats.wins |
07 | local Coins = Player.leaderstats.coins |
08 | Wins.Value,Coins.Value = (Wins.Value + 1 ), (Coins.Value + 100 ) |