Sasuto10Join Date: 2010-05-05 Post Count: 183 |
Every player enterd script i try doesn't work. can somebody send me a player entered script that works today? also i want to know how to make one, or i could just learn on my own by looking at the already-made one. |
|
|
game.Players.PlayerAdded:connect(function(plyr)
--Code
end)
† KMXD † |
|
Sasuto10Join Date: 2010-05-05 Post Count: 183 |
first, unsure if this works, i did mean like a gui or message or something that pops up when somebody enters. also im not a major scripter so i have no idea what this completley does |
|
|
..
local msg = Instance.new("Message")
game.Players.PlayerAdded:connect(function(p)
msg.Parent = workspace
msg.Text = p.." has joined the game"
wait(5)
msg.Parent = nil
end) |
|
Sasuto10Join Date: 2010-05-05 Post Count: 183 |
it didnt work, i also tried changing it up just a bit but it stil didn't work... |
|
miz656Join Date: 2010-07-19 Post Count: 15336 |
local msg = Instance.new("Message")
game.Players.PlayerAdded:connect(function(p)
msg.Parent = workspace
msg.Text = p.Name.." has joined the game"
wait(5)
msg.Parent = nil
end) |
|
CheaterJoin Date: 2007-06-29 Post Count: 5258 |
function PlayerEntered(player)
m = Instance.new("Message")
m.Parent = game.Workspace
m.Text = p.Name.. " has entered the game."
wait(5)
m:remove()
game.Players.PlayerAdded:connect(PlayerEntered) |
|
grimm343Join Date: 2008-09-18 Post Count: 2796 |
If the following does not work for you...You should know that .PlayerAdded only triggers in Servers. This will not work in Test, Play Solo, or Build modes.
game.Players.PlayerAdded:connect(function(np)
local t = Instance.new("Hint",Workspace)
t.Text = np.Name.." joined the game! Welcome!"
wait(2.5)
t:destroy()
end) |
|
miz656Join Date: 2010-07-19 Post Count: 15336 |
@Cheater
Wouldn't work, missing an end. |
|
Sasuto10Join Date: 2010-05-05 Post Count: 183 |
@grimm343
it worked! :D
but now i wanna try to make my own version,
how would i make a script that inserts a gui with a certain size, position, an dall that. i have made the gui and would use the script you gave me so that it inserts the gui instead of the message. but i have an idea that would be better that making the script with a bunch of lines.
how would i make it so when the script runs or whatever, it copies something from Lightning (in this case my screengui) and changes the text? i might make a new form on it later.
i tried to look at a disasters script but it didnt help me. |
|
|
game.Lighting.Gui.Parent = player
Gui.Text = "Text"
You would need to clarify player, or where you want it to go, and gui, what you want to get copyed and have the texted cahnged.
|
|
Sasuto10Join Date: 2010-05-05 Post Count: 183 |
first, not only do i not really understand what ou ment, but i need the gui to go to everyone's playergui folder or whatever it is. that i also don know how to do |
|
CrasyTrexJoin Date: 2011-03-13 Post Count: 761 |
game.Players.ChildAdded:connect(function (plr)
a = game.Lighting.WelcomeGui:clone()
for i,v in pairs(game.Players:GetChildren()) do
a.Parent = v.PlayerGui
end
wait(2)
for i,v in pairs(game.Players:GetChildren()) do
for i,c in pairs(v.PlayerGui:GetChildren()) do
if c.Name == "WelcomeGui" then
c:remove()
end
end
end) |
|
CrasyTrexJoin Date: 2011-03-13 Post Count: 761 |
I forgot to insert the text changer but you can do that =P oh yes change the places where is says WelcomeGui to what your gui is named =P. |
|
grimm343Join Date: 2008-09-18 Post Count: 2796 |
You should use .PlayerAdded, Crasy. :o
What if an object that isn't a Player gets placed in there? |
|
Sasuto10Join Date: 2010-05-05 Post Count: 183 |
Then lets welcome "Model" xD |
|
Sasuto10Join Date: 2010-05-05 Post Count: 183 |
Workspace.Script:14: unexpected symbol near ')'
thats what i got when i ran the script.
i added the text tchanger thingy and it looked like this:
game.Players.ChildAdded:connect(function (plr)
a = game.Lighting.WelcomeGui:clone()
for i,v in pairs(game.Players:GetChildren()) do
a.Parent = v.PlayerGui
a.Text = plr.. " has entered the server"
end
wait(2)
for i,v in pairs(game.Players:GetChildren()) do
for i,c in pairs(v.PlayerGui:GetChildren()) do
if c.Name == "WelcomeGui" then
c:remove()
end
end
end)
so, i dont know why, afterward i did try to do a bunch of things to fix it but nothing would work, just kept getting more errors with line 1. please fix.
|
|
CheaterJoin Date: 2007-06-29 Post Count: 5258 |
missing end
You need one end for the function
You need one end for the first "for" function (already placed)
You need two more ends for the two "for" functions and one end for the "if" function.
So all in all you need 5 ends.
You have 4. |
|
Sasuto10Join Date: 2010-05-05 Post Count: 183 |
the new script crasytrex gave me works (he gave it to me through messages) so on that im good and i'll use this script plus what i found out in roblox wiki to make a playerleft script. |
|