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

Previous Thread :: Next Thread 
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
02 Jun 2016 06:38 PM
I want a local script to call to a server, then the server the call back.

Example


Localscript> "Files please"
Serverscript> "game.Workspace.Folder:GetChildren()"
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
02 Jun 2016 06:42 PM
Like I think RemoteFunction is for this... But like..... How would I set up an event and everything to recieve it and to send data back and forth
Report Abuse
GGGGG14 is not online. GGGGG14
Joined: 29 Jan 2012
Total Posts: 25344
02 Jun 2016 06:44 PM
--Step 1) Place a RemoteEvent into the ReplicatedStorage (both the server & client can access this service)
--Step 2) Name it something that is useful to what you are trying to do.
--Step 3) Script!

--Local Script:

local RepStore = game:GetService("ReplicatedStorage")
local event = RepStore:WaitForChild("MyEvent")

event:FireServer(string)

--Server Script:

local RepStore = game:GetService("ReplicatedStorage")
local event = RepStore:WaitForChild("MyEvent")

local onMyEvent = function(string)
print(string)
end

event.OnServerEvent:connect(onMyEvent)
Report Abuse
championbuilder is not online. championbuilder
Joined: 20 Jan 2009
Total Posts: 13544
02 Jun 2016 06:47 PM
server

workspace.RemoveFunction.OnServerInvoke:connect(function(Player)
return game.Workspace.Folder:GetChildren()
end)

localscript

local ToReturn = workspace.RemoteFunction:InvokeServer()
print(ToReturn)

--Will print a table since it returned the children.
Report Abuse
championbuilder is not online. championbuilder
Joined: 20 Jan 2009
Total Posts: 13544
02 Jun 2016 06:48 PM
WHY AM I SPELLED "REMOTE" AS "REMOVE" EVERY TIME
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
02 Jun 2016 06:56 PM
I am having trouble understanding how this would transfer back to the localscript.

I thought you needed to use returns.

Thanks guys just a little clarifications.

and ChamptionBuilder your a legend builder+coder O_O
Report Abuse
Ben1925 is not online. Ben1925
Joined: 07 Apr 2011
Total Posts: 741
02 Jun 2016 07:07 PM
You _do_ use returns. The server returns the result, the client receives it.
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
03 Jun 2016 08:32 PM
OnServerInvoke is a callback member of RemoteFunction; you can only set the callback value, get is not available

is the error
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
03 Jun 2016 08:38 PM
chamption understands i need to return it but his code is faulty :(
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
03 Jun 2016 08:46 PM
just give up
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
03 Jun 2016 08:49 PM
Your that idiot troll
Report Abuse
championbuilder is not online. championbuilder
Joined: 20 Jan 2009
Total Posts: 13544
03 Jun 2016 08:58 PM
oh do this instead

function workspace.RemoteFunction.OnServerInvoke(Player)
return --blahblah
end
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
03 Jun 2016 09:05 PM
same thing
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
03 Jun 2016 09:11 PM
Cool i figured ito out.


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