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: Remote Functions Not Returning Multiple Valuesq

Previous Thread :: Next Thread 
EchoReaper is not online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
14 Feb 2014 06:09 PM
I invoke a remote function, and it calculates two values that I need. Example:

local shoot = workspace.Shoot
local pistolDamage = 14.999999
local rifleDamage = 3

function shoot.OnServerInvoke(player, arg1, arg2)

local calculatedA = arg1%arg2
local calculatedB = arg2%arg1

print(calculatedA)
print(calculatedB)

return calculatedA,calculatedB
end

That is just an example of how my code is set up. I am not using the server to calculate remainders. However, calculatedA and calculatedB are both printed, so I know that they're not nil. Back in my local script though:

local calcA, calcB = workspace.rFunction:InvokeServer(5,8)
print(calcA)
print(calcB)

> 5
> nil

Are remote functions unable to return multiple values?
Report Abuse
dogwarrior24 is not online. dogwarrior24
Joined: 10 Nov 2010
Total Posts: 1401
14 Feb 2014 06:10 PM
No, they can't, neither can ModuleScripts, it's very annoying.
Report Abuse
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
14 Feb 2014 06:13 PM
They seem broken atm.

02:13:03.542 - OnServerInvoke is not a valid member of RemoteFunction

however they should, as the parameter is a tuple(multiple arguments)

OnServerInvoke
Parameters: Player player, Tuple arguments
Report Abuse
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
14 Feb 2014 06:14 PM
But you can simply use a table as an argument to go past this issue :)

However I recommend using RemoteEvents as they're superior.
Report Abuse
EchoReaper is not online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
14 Feb 2014 06:30 PM
Off Topic: Does anyone know if ROBLOX patched freezing your health with Cheat Engine?
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
14 Feb 2014 06:36 PM
No

OP, it should work.

t = function(a, b)
return (a..b), (b..a)
end

ab, ba = t("T", "b")
print(ab..ba)
Report Abuse
EchoReaper is not online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
14 Feb 2014 06:44 PM
FML. RemoteFunctions return the second value, but crash when the ray is pointing to the void. RemoteEvents won't return tables.
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
14 Feb 2014 06:49 PM
Modulescripts.

I know for a fact they can return multiple values
Report Abuse
EchoReaper is not online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
14 Feb 2014 06:52 PM
@lol: No they can't(a table is a single value, which is what I just used in both events/functions). Both of your posts are in contradiction with already-posted answers that are correct. If you don't know what you're talking about, then don't post.
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
14 Feb 2014 06:55 PM
It works for me.
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
14 Feb 2014 06:57 PM
http://prntscr.com/2sk7jo
Report Abuse
EchoReaper is not online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
14 Feb 2014 06:59 PM
Are you a complete idiot? Did you not even read the title? The issue is with REMOTE FUNCTIONS not being able to return multiple values.

Man -- clannies are so FREAKING STUPID these days.
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
14 Feb 2014 07:01 PM
Oh my bad, you are right regarding modulescripts. Why not a _G table?
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
14 Feb 2014 07:03 PM
What's the point of Remote Functions anyway? They seem useless anyhow.
Report Abuse
EchoReaper is not online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
14 Feb 2014 07:03 PM
Please, just go away. If I want to return multiple values with a ModuleScript, I can just use a table -- you obviously don't know what you're talking about. Just leave.
Report Abuse
nramsey is not online. nramsey
Joined: 20 Dec 2013
Total Posts: 1298
15 Feb 2014 01:16 AM
EchoReaper: Please politely express your frustrations.
Report Abuse
EchoReaper is not online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
15 Feb 2014 01:19 AM
"Please, just go away."

I did.
Report Abuse
Basswobble is not online. Basswobble
Joined: 18 Jul 2011
Total Posts: 3249
15 Feb 2014 03:51 AM
Also,

"If you don't know what you're talking about, then don't post."

Keyboard not found. Press F1 to continue.
Report Abuse
Usering is online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
16 Feb 2014 03:54 AM
This worked for me, but not functions. I sent a string through them as the first argument and it worked, then a function to be called on the receiving end and that didn't work.
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