I have this small casino group along with a casino I have recently made a Player Rewards program but I need the Players to be able to exchange their points for Credits below you will see my code. Warning I am not trying to get the local player! I am trying to make it where when you type into the textbox which is defined as User and then click on Button it does the function, it is a surfacegui! I use adornee so that it moves to workspace and makes the textbox works!
Button = script.Parent
User = script.Parent.Parent.Username.Text
player = game.Players.User
Button.MouseButton1Down:connect(function()
game.Player.leaderstats.Points = game.Player.leaderstats.Points - 100
wait(0.1)
game.Player.leaderstats.Credits = game.Player.leaderstats.Credits + 100
wait(0.1)
game.Player.PlayerGui.Warning.TextLabel.Text = "Customer Service has exchanged your Points for 100 Credits"
wait(5)
game.Player.PlayerGui.Warning.TextLabel.Text = ""
end)
The part that is not working is it keeps saying User is not a vaild member of Players(It does not understand I am trying to use the var above named User! I do not know how to fix I have attempted to fix it 3 times already.

2 comments
MouseButton1Click:connect(function()
Can you provide any more details, is this a local script? Where is this script located? What is the exact error? You're going to game.Players.User does not exist, or if he did how is that name sniper in your game?