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 » Scripters
Home Search
 

Re: Inserting other arguments in function called by an event

Previous Thread :: Next Thread 
BlockCrusader is not online. BlockCrusader
Joined: 23 Jun 2013
Total Posts: 76
29 Jun 2017 02:58 PM
For example, I have a brick that calls a function in a script (the script is inside of the brick) when touched, but the function is as follows:

function changeColor(color)
script.Parent.BrickColor = color
end

script.Parent.Touched:Connect(changeColor(color))

The problem is that if I put an argument in a function that is called by an event, the script mistakes the argument as an argument that is going to be used by the event, while in reality I simply want the function easy to modify by changing its arguments. Any ideas?
Report Abuse
Wrathsong is online. Wrathsong
Joined: 05 Jul 2012
Total Posts: 22393
29 Jun 2017 03:00 PM
script.Parent.Touched:Connect(function(hit)
changeColor(BrickColor.new("Bright red"))
end)


Report Abuse
BlockCrusader is not online. BlockCrusader
Joined: 23 Jun 2013
Total Posts: 76
29 Jun 2017 03:01 PM
Thank you
Report Abuse
Wrathsong is online. Wrathsong
Joined: 05 Jul 2012
Total Posts: 22393
29 Jun 2017 03:04 PM
np


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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