How to get a specific player from the online players?
Hey, I'm very new to coding and I want to make a script, where on a press of a button a specific player's integer value will change, here's the script I made:
1 | script.Parent.MouseButton 1 Up:Connect( function (player) |
2 | local setCashButton = script.Parent |
3 | local playerName = script.Parent.Parent.playerNameTxtBox.Text |
4 | local cashValue = script.Parent.Parent.cashValueTxtBox.Text |
5 | local playerLoc = game.Players.playerName |
7 | playerLoc.leaderstats.Cash.Value = cashValue |
The problem with this, is that I can't figure out how to search for a specific player that is in the server, the code fails at line 5 when I try to specify the given player's name. Any help would be appreciated!