generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Getting Someone's name in a message

Previous Thread :: Next Thread 
EPikachu is not online. EPikachu
Top 100 Poster
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 is not online. 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 is not online. sdfgw
Top 50 Poster
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 is not online. sdfgw
Top 50 Poster
Joined: 08 Jan 2009
Total Posts: 41681
19 Jun 2009 12:15 PM
Dangit, late post -.-
Report Abuse
Bobobob12 is not online. 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 is not online. sdfgw
Top 50 Poster
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 is not online. EPikachu
Top 100 Poster
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 is not online. sdfgw
Top 50 Poster
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 is not online. EPikachu
Top 100 Poster
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 is not online. EPikachu
Top 100 Poster
Joined: 28 Aug 2006
Total Posts: 985
19 Jun 2009 12:36 PM
"concatenythingy"

What?
Report Abuse
DingDong272 is not online. DingDong272
Top 100 Poster
Joined: 08 Dec 2007
Total Posts: 9860
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 is not online. 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 is not online. sdfgw
Top 50 Poster
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
djwhizzkid is not online. djwhizzkid
Joined: 16 Nov 2008
Total Posts: 638
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image