In this GUI you input the player's name on a TextBox and when you click on a TextButton it should give the player inputted in the TextBox an economy ticket.
This is the script inside the TextButton
function o() local text = "game.Players."..script.Parent.Parent.UsernameBox.Text print(text.Name) local plr = text script.Economy:Clone().Parent = plr.Backpack end script.Parent.MouseButton1Click:Connect(o)
It does call the function, I just don't know how to make it find the player I want. Please help me!
Hey, I noticed your problem immediately. It's on line 4.
local plr = text
You set the variable 'plr' to a string ("game.Players.TEXT"). That doesn't actually locate the player here's your script fixed:
function o() local text = game.Players:FindFirstChild(script.Parent.Parent.UsernameBox.Text) -- This checks inside of game.Players for the playername that was entered. It's not a string, and the variable is a player object variable. print(text.Name) local plr = text script.Economy:Clone().Parent = plr.Backpack end script.Parent.MouseButton1Click:Connect(o)
Hope this helps and if it does be sure to accept it as the answer :)