|
players = game.Players:GetPlayers()
game.Players.PlayerAdded:connect(function(player)
for _,v in pairs(players) do
local s = Instance.new("ScreenGui",v.PlayerGui)
local t = Instance.new("TextLabel",s) -- position is set at top left corner at default
t.BackgroundColor3 = Color3.new(0/0/0/0) -- black
t.TextColor3 = Color3.new(1/0/0/0) -- red
t.Text = "Player joined: "..player.Name
wait(4)
s:Destroy()
end
end)
|
|
fret13103Join Date: 2010-03-15 Post Count: 881 |
Uh, there is an event already scripted just for this, make a function that is called by this event, and add your code, here I'll get you started:
function onPlayerEntered(player)
Lalalalalalalla (code)
game.Players.PlayerAdded:connect(onPlayerEntered)
onPlayerEntered(game.Players:WaitForChild("Player1"))
Just so it works for testing too. |
|
KrauzzJoin Date: 2012-09-24 Post Count: 104 |
--players = game.Players:GetPlayers()This is your problem, this returns all the players in the server and will remain that way. It does not automatically update. So when you start your server, there will be no players, thus returning a nil table. Instead, you need to define players when the player actually joins.
(So remove that part and put it in the event)
game.Players.PlayerAdded:connect(function(player)
local players = game.Players:GetPlayers()
for _,v in pairs(players) do
local s = Instance.new("ScreenGui",v.PlayerGui)
local t = Instance.new("TextLabel",s) -- position is set at top left corner at default
t.BackgroundColor3 = Color3.new(0/0/0/0) -- black
t.TextColor3 = Color3.new(1/0/0/0) -- red
t.Text = "Player joined: "..player.Name
wait(4)
s:Destroy()
end
end) |
|
cornytimeJoin Date: 2013-02-07 Post Count: 3213 |
function PlayerJoin()
for _,v in pairs(game.Players:GetChildren())) do
local s = Instance.new("ScreenGui", v.PlayerGui)
local t = Instance.new("TextLabel", s) -- position is set at top left corner at default
t.BackgroundColor3 = Color3.new(0/0/0/0) -- black
t.TextColor3 = Color3.new(1/0/0/0) -- red
t.Text = ("Player joined: "..player.Name)
wait(4)
s:Destroy()
end
end
game.Players.PlayerAdded:connect(PlayerJoin)
--
this? |
|
|
Doesn't work & I want it all for all players.
function onPlayerEntered(player)
players = game.Players:GetPlayers()
game.Players.PlayerAdded:connect(function(player)
for _,v in pairs(players) do
local s = Instance.new("ScreenGui",v.PlayerGui)
local t = Instance.new("TextLabel",s) -- position is set at top left corner at default
t.BackgroundColor3 = Color3.new(0/0/0/0) -- black
t.TextColor3 = Color3.new(1/0/0/0) -- red
t.Text = "Player joined: "..player.Name
wait(4)
s:Destroy()
end
end)
end
game.Players.PlayerAdded:connect(onPlayerEntered)
onPlayerEntered(game.Players:WaitForChild("Player1")) |
|
|
None work above my last post. |
|
rnyJoin Date: 2009-07-26 Post Count: 5079 |
game.Players.PlayerAdded:connect(function(player)
local players = game.Players:GetChildren()
for _,v in pairs(players) do
coroutine.resume(coroutine.create(function()
local s = Instance.new("ScreenGui",v.PlayerGui)
local t = Instance.new("TextLabel",s) -- position is set at top left corner at default
t.BackgroundColor3 = Color3.new(0,0,0) -- black
t.TextColor3 = Color3.new(1,0,0) -- red
t.Text = "Player joined: "..player.Name
wait(4)
s:Destroy()
end))
end
end) |
|
|
rnyJoin Date: 2009-07-26 Post Count: 5079 |
a error would help
|
|
|
it doesn't claim any errors. |
|
rnyJoin Date: 2009-07-26 Post Count: 5079 |
game.Players.PlayerAdded:connect(function(player)
for _, v in pairs(game.Players:GetChildren()) do
coroutine.resume(coroutine.create(function()
local s = Instance.new("ScreenGui",v.PlayerGui)
local t = Instance.new("TextLabel",s)
t.BackgroundColor3 = Color3.new(0,0,0)
t.TextColor3 = Color3.new(1,0,0)
t.Text = "Player joined: ".. player.Name
wait(4)
s:Destroy()
end))
end
end) |
|
|
|
This works, but I don't want it to be a hint, want it to be text on the bottom left that shows up(will change positioning when I at least get it to work, right now is postitioned at top left).
game.Players.PlayerAdded:connect(function(player)
local h = Instance.new("Hint",workspace)
h.Text = "Player connected: "..player.Name
wait(2)
h:Destroy()
end) |
|
|
fret13103Join Date: 2010-03-15 Post Count: 881 |
Well, you've just solved your own problem, instead of it being a hint, just make it a GUI.
Wave your magic wand if that doesn't work. |
|
|
Won't work though, you can see at my first post. |
|