Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

i'm making a player joined gui, but the gui never goes away once it's there. what did i do wrong?

i'm trying to make it so when a player joins, it says "(playername) has joined!" i can do that part, but whenever i do gui.Visible = false, it doesn't go away. here's the script:

local gui = game.StarterGui.ScreenGui.TextLabel
local Players  = game:GetService("Players")
function join(player)
	gui.Text = (player.Name .. " has joined!")
	gui.Visible = true
	wait(3)
	gui.Visible = false
	gui.Text = (" ")
end
Players.PlayerAdded:connect(join)

1 comment

1 answer

✓ Accepted answer

StarterGui is the container for GUI objects. It's not actually what the player sees. You have to edit what's in the PlayerGui, because that's what the player is currently viewing. But since you need to edit the PlayerGui of every player, I recommend using a LocalScript.

local plr = game.Players.LocalPlayer
local plrGui = plr:WaitForChild("PlayerGui")
local gui = plrGui:WaitForChild("ScreenGui"):WaitForChild("TextLabel")

function join(player)
	gui.Text = (player.Name .. " has joined!")
	gui.Visible = true
	wait(3)
	gui.Visible = false
end

game.Players.PlayerAdded:connect(join)

2 comments

1

You forgot 'game' at the last line.

0

thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.