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: How to have multiple REs but only using one RE object?

Previous Thread :: Next Thread 
Pejorem is not online. Pejorem
Joined: 10 Apr 2012
Total Posts: 637
02 Jan 2017 11:55 AM
Would one way to do it maybe:

--SERVER
event.OnServerEvent:connect(function(plr, option)
if option == "event one" then
--do stuff
end
end)
event.OnServerEvent:connect(function(plr, option)
if option == "event two" then
--do stuff
end
end)

--CLIENT
local plr = game.Players.LocalPlayer
clickDetector.MouseClick:connect(function(hit)
game.Workspace.MyServerEvent:FireServer(plr, "event one")
end)

clickDetector2.MouseClick:connect(function(hit)
game.Workspace.MyServerEvent:FireServer(plr, "event two")
end)


Is there a better way?


Google "Scripting Helpers" to find a "better" forum - http://wiki.roblox.com/index.php?title=AllTutorials - http://wiki.roblox.com/index.php?title=API:Class_reference - Google "Programming in Lua" for The book
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
02 Jan 2017 12:03 PM
phantom forces did it

you can prob find the code somewhere



Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
Pejorem is not online. Pejorem
Joined: 10 Apr 2012
Total Posts: 637
02 Jan 2017 12:04 PM
ahmk, ty.


Google "Scripting Helpers" to find a "better" forum - http://wiki.roblox.com/index.php?title=AllTutorials - http://wiki.roblox.com/index.php?title=API:Class_reference - Google "Programming in Lua" for The book
Report Abuse
GearMechs is not online. GearMechs
Joined: 01 Dec 2010
Total Posts: 1220
02 Jan 2017 12:05 PM
You could insert multiple module scripts under the server script, and have the RE call whichever module you specify.


Project Leader for OKS - GearMechs
Report Abuse
Pejorem is not online. Pejorem
Joined: 10 Apr 2012
Total Posts: 637
02 Jan 2017 12:07 PM
So basically just using arguments to specify what I want processing?


Google "Scripting Helpers" to find a "better" forum - http://wiki.roblox.com/index.php?title=AllTutorials - http://wiki.roblox.com/index.php?title=API:Class_reference - Google "Programming in Lua" for The book
Report Abuse
Crimsonal is not online. Crimsonal
Joined: 23 Apr 2011
Total Posts: 1795
02 Jan 2017 12:07 PM
--SERVER
event.OnServerEvent:connect(function(plr, option)
if option == "event one" then
--do stuff
elseif option == "event two" then
-- do stuff
end
end)

Report Abuse
Pejorem is not online. Pejorem
Joined: 10 Apr 2012
Total Posts: 637
02 Jan 2017 12:09 PM
So basically using an argument to specify what is to be processed?


Google "Scripting Helpers" to find a "better" forum - http://wiki.roblox.com/index.php?title=AllTutorials - http://wiki.roblox.com/index.php?title=API:Class_reference - Google "Programming in Lua" for The book
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
02 Jan 2017 12:25 PM
thats how your suppose to do it anyways because you need to verify the values

re.OnServerEvent:connect(function(player,reason,...)
if reason == 'blah' then

elseif reason == 'blah2' then

end
end)


Report Abuse
Pejorem is not online. Pejorem
Joined: 10 Apr 2012
Total Posts: 637
02 Jan 2017 12:27 PM
o crap. Ye. Erm. I totally knew that 0.0 Just saved my soul and my skins, ty.
If only my thought capacity went beyond level potato.


Google "Scripting Helpers" to find a "better" forum - http://wiki.roblox.com/index.php?title=AllTutorials - http://wiki.roblox.com/index.php?title=API:Class_reference - Google "Programming in Lua" for The book
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