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!
So what you need to do is:
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 = player.Name playerLoc.leaderstats.Cash.Value = cashValue end)