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:
script.Parent.MouseButton1Up:Connect(function(player)
local setCashButton = script.Parent
local playerName = script.Parent.Parent.playerNameTxtBox.Text
local cashValue = script.Parent.Parent.cashValueTxtBox.Text
local playerLoc = game.Players.playerName
playerLoc.leaderstats.Cash.Value = cashValue
end)
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!

5 comments
You pass in a "player" parameter, I assume that this is a reference to the current player in Players. But if this is a localscript (considering you're taking inputs), leaderstats should only be tampered with by the server in most if not all cases. Use a remoteevent and impose the appropriate checks, I can't tell what'd they be from this script alone.
Well this sound very complicated. Any recommendations on how to start this?
yes, read api about RemoteEvents
also, you can use
[variable]to include variables values, you may need to use that on line 5Will do it tomorrow, it's getting late. Thanks for the help!