Hello, I'm kinda "noobish" at scripting but could someone help with this script? I want it to make a new text box and GUI that greets the player when they enter the game. When I enter the game no GUI appears.
Thanks for reading, Leg0Brick
function onEnter(player) repeat wait() until player.Character ~= nil -- Wait for the player to spawn local m = Instance.new("ScreenGui") local TB = Instance.new("TextBox") -- Create a message m.Parent = StarterGui TB.Text = "Hello, " .. p.Name .. "!" -- Greet the player wait(10) m:remove() end game.Players.PlayerAdded:connect(onEnter)
You didn't define TB parent nor p. Also, you should clone directly to the PlayerGui, because StarterGui is for all players and it shows when the player respawn. It may look like this:
function onEnter(player) repeat wait() until player.Character ~= nil local m = Instance.new("ScreenGui") local TB = Instance.new("TextBox") m.Parent = player.PlayerGui TB.Parent = m TB.Text = "Hello, " .. player.Name .. "!" wait(10) m:Destroy() -- remove is deprecated end game.Players.PlayerAdded:connect(onEnter)
And I think you should set the textbox size too, to look better.