Still have questions? Join our Discord server and get real time help.
0

# Help with GUI messages!?

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.

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

0
Next time you ask something, give the output. Tesouro 407 — 6y

0
Tesouro 407
6 years ago

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