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: Commas in a function?

Previous Thread :: Next Thread 
1Topcop is not online. 1Topcop
Joined: 09 Jun 2009
Total Posts: 6635
11 Nov 2011 07:23 PM
Can someone tell me how to use them and what they mean? Like for example:

function Chat(Message,Player) -- What does the comma do there and what is Player?
end
game.Players["1Topcop"].Chatted:connect(Chat)
Report Abuse
UFAIL2 is not online. UFAIL2
Joined: 14 Aug 2010
Total Posts: 6905
11 Nov 2011 07:28 PM
The comma separates 2 different values.
Report Abuse
1Topcop is not online. 1Topcop
Joined: 09 Jun 2009
Total Posts: 6635
11 Nov 2011 07:29 PM
Well what are the meanings in each value is what I want to know.
Report Abuse
UFAIL2 is not online. UFAIL2
Joined: 14 Aug 2010
Total Posts: 6905
11 Nov 2011 07:30 PM
Aren't they self explanatory by the name?
Report Abuse
1Topcop is not online. 1Topcop
Joined: 09 Jun 2009
Total Posts: 6635
11 Nov 2011 07:32 PM
Well, I mean, don't they have the same value with diffrent tags? like you can put

function(JIF,BOB) instead of function(Message,Player) and it would be the same values, right?
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
11 Nov 2011 07:33 PM
Anyway, those are the parameters/arguments of the function. They're variables used by the function.

function AddTheseNumbers(FirstNumber,SecondNumber)
return FirstNumber + SecondNumber
end

print(AddTheseNumbers(1,5))

>6

-[::ƧѡÎḾḠΰῩ::]-
-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
UFAIL2 is not online. UFAIL2
Joined: 14 Aug 2010
Total Posts: 6905
11 Nov 2011 07:34 PM
I pretty sure that it would be the same.
Report Abuse
1Topcop is not online. 1Topcop
Joined: 09 Jun 2009
Total Posts: 6635
11 Nov 2011 07:35 PM
Well how do I find like witch is witch?
Sorry I'm a narb :P

But I don't know how to use this :c
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
11 Nov 2011 07:37 PM
You can name your arguments anything you want.

function I_LEIK_CAKE(YAY, LOLZ)
return YAY + LOLZ
end

print(I_LEIK_CAKE(1,5))

>6

The script assigns 1 to the variable YAY and 5 to the variable LOLZ.

-[::ƧѡÎḾḠΰῩ::]-
-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
1Topcop is not online. 1Topcop
Joined: 09 Jun 2009
Total Posts: 6635
11 Nov 2011 07:39 PM
Interesting, I think I'm starting to get it, so if I put...

function Chat(Message,Player)
Chat(Message,game.Players["1Topcop"])
end
game.Players["1Topcop"].Chatted:connect(Chat)

Player would become me?
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
11 Nov 2011 07:40 PM
Well your first problem would be that your script will crash your game.

-[::ƧѡÎḾḠΰῩ::]-
-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
11 Nov 2011 07:41 PM
That would result in a stack overflow, which lags the game severely for a few seconds then breaks the script.
Report Abuse
1Topcop is not online. 1Topcop
Joined: 09 Jun 2009
Total Posts: 6635
11 Nov 2011 07:42 PM
*Twitch*
Ermmm... yeah.. I'm not gettin this o.o
More help pl0x? D:
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
11 Nov 2011 07:43 PM
You are calling the function within the function; it'll get stacked up against itself with no wait time.
Report Abuse
1Topcop is not online. 1Topcop
Joined: 09 Jun 2009
Total Posts: 6635
11 Nov 2011 07:44 PM
._.

Can you tell me then, how do I make a chat that finds who said it?
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
12 Nov 2011 06:04 PM
playerwhospoke = nil
game.Players.PlayerAdded:connect(function(p)
p.Chatted:connect(function()
playerwhospoke = p
end)
end)
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