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: how2remotefunctions

Previous Thread :: Next Thread 
Deafgift100 is not online. Deafgift100
Joined: 09 May 2010
Total Posts: 3958
07 Nov 2015 03:07 PM
How do I use them and what do they do? I didn't properly understand the wiki.
Report Abuse
Deafgift100 is not online. Deafgift100
Joined: 09 May 2010
Total Posts: 3958
07 Nov 2015 03:09 PM
nevermind im stupid
Report Abuse
FloweryMonkeyboy5 is not online. FloweryMonkeyboy5
Joined: 19 Sep 2012
Total Posts: 528
07 Nov 2015 03:19 PM
Remotefunctions are used to communicate between the server and the client.

Remotefunctions have 2 main yieldfunctions and 2 main callbacks

Yieldfunctions:
InvokeClient will call a given players client with certain arguments to the function.
InvokeServer will call the server from the local client.

Callbacks:
You can see the callbacks sort of like events. As soon as you invoke the client or server the function on the other side will trigger and do it's job, you can also return values if you so wish.

The example that the roblox wiki gives is the following:

Codebit on the server (Script):
--
function RemoteFunction.OnServerInvoke(player, name)
print("Hi, my name is", name, "and this invocation came from", player.Name)
return player.Name
end
--

Output: Hi, my name is John Doe and this invocation came from Player1

Codebit on the server (Script):
--
print(RemoteFunction:InvokeServer("John Doe"))
--

Output: Player1

Let's break this code down.
The server script defines a function called Remotefunction and there is a serverinvoke assigned to it with takes 2 arguments: Player and name. If the function is called it will print out the given sentence and it will return the name of the player who called the function.

On the client side you see someone call this:
print(RemoteFunction:InvokeServer("John Doe"))

You might be thinking "What, I thought u said the function took 2 ARGUMENTS!". This is right, however when invoking the server from a client you do not need to supply the first player argument, roblox assigns this argument for you automatically. In this case you just have to supply the second argument Name.
What the code itself does it basically prints out the returned value from the script that is located on the serverside by using the invokeserver command.

I hope this cleared up at least something for you. I am not that great at explaining things very detailed.

.Net, C#, C++, Java and much more.
Report Abuse
FloweryMonkeyboy5 is not online. FloweryMonkeyboy5
Joined: 19 Sep 2012
Total Posts: 528
07 Nov 2015 03:20 PM
Just typed this entire nonsense to see that you already figured it out as soon as I was done. Well played.


.Net, C#, C++, Java and much more.
Report Abuse
Deafgift100 is not online. Deafgift100
Joined: 09 May 2010
Total Posts: 3958
07 Nov 2015 03:27 PM
that's a shame
Report Abuse
ThisUserSecret is not online. ThisUserSecret
Joined: 29 Sep 2012
Total Posts: 1094
07 Nov 2015 03:28 PM
FloweryMonkeyboy5,

You helped me as I was also stuck on this, so thank you! :)


~~Head of Moderation and Application at F3X~~
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