Why won't this work? Is the PlayerAdded right? Have I used the PlayerAdded right?
local plr = game.Players.PlayerAdded:connect(function(plr) if plr.Name == "jaxxcoolboy" then script.Parent.Text = "The founder jaxxcoolboy is in the game!" end end)
Your issue seems to be an obscure one which not even I knew about until now; when a player first enters (at least in Play Solo; not entirely sure), their name is set to Player1 before being set to the correct username. I found that simply adding a wait()
fixed this.
game.Players.PlayerAdded:connect(function(plr) wait() if plr.Name == "jaxxcoolboy" then script.Parent.Text = "The founder jaxxcoolboy is in the game!" end end)
No on PlayerAdded
you don't want a variable so instead of
local plr = game.Players.PlayerAdded:connect(function(plr)
you'll want to do this
game.Players.PlayerAdded:connect(function(plr)
a function cannot be a variable if you want it to run. or you could do this
function onPlayerEntered() --code end game.Players.PlayerAdded:connect(onPlayerEntered)
And always remember to put an end)
if you're doing the first one