So what I'm trying to do is make a type of machine that gives you tickets. What you would do is type your username or someone else's into a TextBox and click a TextButton to finish the process. The ticket is supposed to be given to the player that has the username which you inserted. The problem I'm having is that it won't work when you're trying to give the ticket to another player. Instead, it would only work when you would give the Ticket to yourself. I've already tried both Local and Regular scripts.
-----The only way I am able to type the username into the TextBox is by using this script: script.Parent.SurfaceGui.Adornee = script.Parent script.Parent.SurfaceGui.Parent = game.StarterGui -------This is the script that I used for giving the ticket to the player and getting its username. -------------------------------Getting Player's Name and Giving Ticket script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.StringValue.Value = script.Parent.Parent.TextBox.Text -----Getting username inserted in the TextBox into a StringValue wait() local Name = script.Parent.Parent.PlayerName.Value --- Getting the value from the StringValue local TicketToGive = game.Players:WaitForChild(Name) --- Finding Player local Clone = game.ReplicatedStorage.Ticket:Clone() ---Cloning the Ticket from Replicated Storage Clone.Parent = TicketToGive.Backpack ---Giving the Cloned Ticket to the Player. end)