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

How to announce when a certain player joined the game?

I'm trying to find a script where is a certain user was to join the server, there will be a pop up on the screen saying "User joined the game!"

For some reason, the script isn't working though.

I found the script on an outdated youtube video and I'm trying to get it to work, here's what I have.

function OnPlayerEntered(player)
	if player.userId == game.CreatorId then --for the game owner, might remove it
		local msg = Instance.new("Message")
		msg.Parent = game.Workspace
		msg.Text = "The creator has joined the server!"
		wait(2)
		msg:remove()
	elseif player.Name == "Aprilsaurus" then --what I'm trying to work on
		local msg = Instance.new("Message")
		msg.Parent = game.Workspace
		msg.Text = "The Dev has joined this server!" --the text
		wait(10)
		msg:remove()
	end
end

game.Players.ChildAdded:connect(OnPlayerEntered)

I don't see any errors in the output so I'm not sure why it's not working, any help is appreciated.

3 comments

1

Try to use "PlayerAdded" and not "ChildAdded"; Players.PlayerAdded:Connect(OnPlayerEntered)

0

hold on it suddenly started working just now and i didn't even do anything

0

Okay that worked, thank you!

1 answer

✓ Accepted answer

You should be using .PlayerAdded instead of .ChildAdded

Try this:

local Players = game:GetService("Players")

local function playerAdded(Player)
	-- Rest of code here.
end
Players.PlayerAdded:Connect(playerAdded)

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