I'm trying to print the name of a player who pressed the enter button onto a SurfaceGui. Can anyone help me with that? Thanks.
I am 99% sure this will work.
game.Players.PlayerAdded:connect(function(Player) local pGUI = Player.PlayerGui -- Define the ScreenGui in PlayerGui as "local s = pGUI:WaitForChild('[the ScreenGui's name]') -- Once you define the ScreenGui, define the frame inside it as "local f = s:WaitForChild('[the name of the frame]') -- You can get any children of any defined Object by using "[variable]:WaitForChild('whatever')" -- Now, define the button. local button = f:WaitForChild("[button name]") -- You will need a TextLabel. Define it. local textLabel = button:WaitForChild("[textlabel name]") button.MouseButton1Down:connect(function() textLabel.Text = "You are " .. Player.Name .. " and you clicked the button!" end) end)
enterbutton.MouseButton1Down:connect(function() p = SurfaceGui.Parent.Parent SurfaceGui.TextLabel.Text = p.Name end)
there you go!