✓ Accepted answer
I find it easier to make the function and connect it on the same line, it just makes more sense when you have a script which does multiple things and end up with a load of connection lines at the bottom.
Solutions
This script 'broadcasts': "Player {PlayerName} has joined the game"
game.Players.PlayerAdded:connect(function(plr)
local name = plr.Name
msg = Instance.new("Message", game.Workspace)
msg.Text = "Player "..name.." has joined the game"
wait(3)
msg:Destroy()
end)
If you wanted to make it so custom messages appear for specific people, like in your question then you'd do;
game.Players.PlayerAdded:connect(function(plr)
local name = plr.Name
if name == "Djinous" then
msg = Instance.new("Message", game.Workspace)
msg.Text = "The commander has joined the game"
wait(3)
msg:Destroy()
end
end)
Conclusion
If this has answered your question please accept with the box on the right ->
If it doesn't work (I didn't test this) then please do let me know and I'll fix it.
Finally, if you want a better explanation please do ask!
3 comments
Could also do instead of name, creatorId
Thank you, this works!
I've already accepted it, but do you know how to also get it to play music?