EPikachu
|
  |
 |
| Joined: 28 Aug 2006 |
| Total Posts: 985 |
|
|
| 19 Jun 2009 12:12 PM |
If you want someone's name in a message, how in the world do you do that?
Lets say, for example, JJ5x5 just entered the place. You want to say "Welcome JJ5x5" in a message covering the screen. Can someone tell me how to do this? |
|
|
| Report Abuse |
|
|
Bobobob12
|
  |
| Joined: 23 Jan 2008 |
| Total Posts: 5350 |
|
|
| 19 Jun 2009 12:14 PM |
function onPlayerEntered(Player) msg=Instance.new("Message") msg.Parent=game.Workspace msg.Text="Welcome "..Player.Name game:GetService("Debris"):AddItem(msg, 2) end game.Players.ChildAdded:connect(onPlayerEntered) |
|
|
| Report Abuse |
|
|
sdfgw
|
  |
 |
| Joined: 08 Jan 2009 |
| Total Posts: 41681 |
|
|
| 19 Jun 2009 12:15 PM |
function enter(new) m = Instance.new("Message") m.Text = "Welcome " .. new.Name m.Parent = game.Workspace wait(4) m:remove() end
game.Players.ChildAdded:connect(enter)
Easeh. |
|
|
| Report Abuse |
|
|
sdfgw
|
  |
 |
| Joined: 08 Jan 2009 |
| Total Posts: 41681 |
|
| |
|
Bobobob12
|
  |
| Joined: 23 Jan 2008 |
| Total Posts: 5350 |
|
|
| 19 Jun 2009 12:16 PM |
| I advise to use my version. Sdfgw's would glich often. |
|
|
| Report Abuse |
|
|
sdfgw
|
  |
 |
| Joined: 08 Jan 2009 |
| Total Posts: 41681 |
|
|
| 19 Jun 2009 12:17 PM |
His has more lines. It's obviously better. XD
No, the Debris service handles stuff like that better than my script. |
|
|
| Report Abuse |
|
|
EPikachu
|
  |
 |
| Joined: 28 Aug 2006 |
| Total Posts: 985 |
|
|
| 19 Jun 2009 12:27 PM |
Ugh... I should have asked a better question...
Nothing against you guys... this was my fault:
What I really needed was something like this (How would you get the name in?)
if Player.leaderstats.Points.Value >= -1 then Player.Character.Humanoid.Health = 0 MSG = Instance.new("Message") MSG.Parent = game.Workspace MSG.Text = ..Player.Name " has encountered an error..." game:GetService("Debris"):AddItem(msg, 2) wait(4) MSG.Text = "Resetting " ..Player.Name " Score to 100 points" game:GetService("Debris"):AddItem(msg, 2) wait(4) MSG.Text = "Resetting" wait(1) Player.leaderstats.Points.Value = 25 MSG.Text = "Resetting." wait(1) Player.leaderstats.Points.Value = 50 MSG.Text = "Resetting.." wait(1) Player.leaderstats.Points.Value = 75 wait(1) Player.leaderstats.Points.Value = 100 MSG.Text = "Resetting..." wait(1) MSG.Text = "Reset" wait(2) MSG.Text = "Thanks again for playing" wait(3) MSG:Remove()
--How would you add the names in lines where it says "BLAH BLAH" has encountered an error.
--Here is the end of the script here:
game.Players.ChildAdded:connect(onPlayerEntered)
--As you can see, I have that. I just need to get a name in there, if the person gets -1 points or below... |
|
|
| Report Abuse |
|
|
sdfgw
|
  |
 |
| Joined: 08 Jan 2009 |
| Total Posts: 41681 |
|
|
| 19 Jun 2009 12:32 PM |
"MSG.Text = ..Player.Name " has encountered an error..." " You already do don't you?
You just concatenythingy the two strings with .. to make a longer one. And if this isn't what you want, I don't know what is... |
|
|
| Report Abuse |
|
|
EPikachu
|
  |
 |
| Joined: 28 Aug 2006 |
| Total Posts: 985 |
|
|
| 19 Jun 2009 12:35 PM |
Workspace.Touched.PointGiver:11: unexpected symbol near '..'
That's what it says in the Output... that line exactly that you copied... |
|
|
| Report Abuse |
|
|
EPikachu
|
  |
 |
| Joined: 28 Aug 2006 |
| Total Posts: 985 |
|
| |
|
|
| 19 Jun 2009 12:37 PM |
MSG.Text = ..Player.Name " has encountered an error..."
Remove the .. after the equals. You need to do this:
Player.Name.. " has encountered an error..." |
|
|
| Report Abuse |
|
|
Bobobob12
|
  |
| Joined: 23 Jan 2008 |
| Total Posts: 5350 |
|
|
| 19 Jun 2009 12:39 PM |
If you have an object as a string value leading into a string, use .. For example: Its not: ..player.Name " Text" Its: player.Name .. " Text" |
|
|
| Report Abuse |
|
|
sdfgw
|
  |
 |
| Joined: 08 Jan 2009 |
| Total Posts: 41681 |
|
|
| 19 Jun 2009 12:41 PM |
.....
*leaves slowly because of the embarrassment of not noticing that* |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2009 12:49 PM |
if Player.leaderstats.Points.Value >= -1 then Player.Character.Humanoid.Health = 0 local MSG = Instance.new("Message") MSG.Parent = game.Workspace MSG.Text = Player.Name.." has encountered an error..." game:GetService("Debris"):AddItem(msg, 2) wait(4) MSG.Text = "Resetting "..Player.Name.." Score to 100 points" game:GetService("Debris"):AddItem(msg, 2) wait(4) MSG.Text = "Resetting" wait(1) Player.leaderstats.Points.Value = 25 MSG.Text = "Reseting." wait(1) Player.leaderstats.Points.Value = 50 MSG.Text = "Reseting.." wait(1) Player.leaderstats.Points.Value = 75 wait(1) Player.leaderstats.Points.Value = 100 MSG.Text = "Reseting..." wait(1) MSG.Text = "Reseted!" wait(2) MSG.Text = "Thanks again for playing" wait(3) MSG:Remove()
game.Players.ChildAdded:connect(onPlayerEntered)
That should/will work! :) ~ DJWhizzKid
Off-Topic: What you making? |
|
|
| Report Abuse |
|
|