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: RemoteFunction unable to return with Filtering Enabled?

Previous Thread :: Next Thread 
Zylez is not online. Zylez
Joined: 26 Mar 2016
Total Posts: 417
12 Mar 2017 05:12 AM
I passed some data from a localscript to a RemoteFunction handled by a server script which returned a value that appears to be nil on the localscript. Is it true that you cannot do that when your game has filtering enabled or is it just me? According to the documentation there is no such limitation.
Report Abuse
Zylez is not online. Zylez
Joined: 26 Mar 2016
Total Posts: 417
12 Mar 2017 05:53 AM
b
Report Abuse
OzzyFin is not online. OzzyFin
Joined: 07 Jun 2011
Total Posts: 3600
12 Mar 2017 06:08 AM
"Is it true that you cannot do that when your game has filtering enabled"
No.

What is the value?
Report Abuse
Zylez is not online. Zylez
Joined: 26 Mar 2016
Total Posts: 417
12 Mar 2017 09:35 AM
I'm sending a ClassName string from a localscript to a server script where it then creates the instance and returns it to the client. It looks something like this:

-- Server

function script.Create.OnServerInvoke(_, className)
local new = Instance.new(className)

print(new) --> className
return new
end

-- Client

new = workspace.Script.Create:InvokeServer("Part")
print(new) --> nil


Report Abuse
Snowskateer is not online. Snowskateer
Joined: 06 Dec 2011
Total Posts: 4647
12 Mar 2017 09:35 AM
you cant print an instance
Report Abuse
Zylez is not online. Zylez
Joined: 26 Mar 2016
Total Posts: 417
12 Mar 2017 09:37 AM
@Snowskateer OF course you can. Try it yourself.
Report Abuse
VilgO is not online. VilgO
Joined: 15 Feb 2011
Total Posts: 518
12 Mar 2017 09:39 AM
More accurately, RemoteFunctions can only return Lua types.
http://wiki.roblox.com/index.php?title=RemoteFunction_and_RemoteEvent_Tutorial#Limitations
Report Abuse
Snowskateer is not online. Snowskateer
Joined: 06 Dec 2011
Total Posts: 4647
12 Mar 2017 09:39 AM
o wait yea nvm

- Server

function script.Create.OnServerInvoke(_, className)
local new = Instance.new(className)
return new.Name
end

-- Client

new = workspace.Script.Create:InvokeServer("Part")
print(new)

try this just to check if it prints
Report Abuse
VilgO is not online. VilgO
Joined: 15 Feb 2011
Total Posts: 518
12 Mar 2017 09:42 AM
Wait, I'm stupid and can't read. It looks like you *can* pass Roblox objects, as long as they're already present on both sides.
Report Abuse
Zylez is not online. Zylez
Joined: 26 Mar 2016
Total Posts: 417
12 Mar 2017 09:43 AM
@VilgO Oh... Well that explains everything. Thank you for pointing that out
Report Abuse
Zylez is not online. Zylez
Joined: 26 Mar 2016
Total Posts: 417
12 Mar 2017 09:45 AM
I should really start quoting posts.. but nah

@VilgO Oh okay, so I guess the client doesn't replicate in time before it returns the object. I will try to set an interval and see how it handles it.
Report Abuse
Snowskateer is not online. Snowskateer
Joined: 06 Dec 2011
Total Posts: 4647
12 Mar 2017 09:46 AM
did you try my script, and if so, did it print?

Report Abuse
Zylez is not online. Zylez
Joined: 26 Mar 2016
Total Posts: 417
12 Mar 2017 09:48 AM
@Snowskateer Surprisingly it did print... But how come not the object? Is there any logical explanation to this?
Report Abuse
Snowskateer is not online. Snowskateer
Joined: 06 Dec 2011
Total Posts: 4647
12 Mar 2017 09:49 AM
not really tbh, you could just get classname using part.ClassName and then that would give the same results
Report Abuse
OzzyFin is not online. OzzyFin
Joined: 07 Jun 2011
Total Posts: 3600
12 Mar 2017 09:52 AM
Objects parented to nil don't seem to be replicated.
Report Abuse
Zylez is not online. Zylez
Joined: 26 Mar 2016
Total Posts: 417
12 Mar 2017 09:52 AM
@Snowskateer Well, I am trying to replicate a part to the server, not a string.
Report Abuse
Snowskateer is not online. Snowskateer
Joined: 06 Dec 2011
Total Posts: 4647
12 Mar 2017 09:53 AM
wait yea do what ozzy says
parent to workspace or whatever
Report Abuse
Zylez is not online. Zylez
Joined: 26 Mar 2016
Total Posts: 417
12 Mar 2017 09:54 AM
@OzzyFin This is not the full script. Along with the classname there is a table containing all properties and values that are applied to the instance. This does work in studio Play mode, but not in Local Server.
Report Abuse
Zylez is not online. Zylez
Joined: 26 Mar 2016
Total Posts: 417
12 Mar 2017 10:06 AM
I went to studio and wrote this full script and same result. Try it yourself:

--Server
function workspace.RemoteFunction.OnServerInvoke(_, className)
local instance = Instance.new(className)

print(instance) --> instance.Name
return instance
end

-- Localscript
local re = workspace:WaitForChild("RemoteFunction"):InvokeServer("Part")
print(re) --> nil
Report Abuse
Zylez is not online. Zylez
Joined: 26 Mar 2016
Total Posts: 417
12 Mar 2017 10:14 AM
As you might seen in the script above, the part was never parented and once I did it worked. These are some dumb limits indeed.
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
12 Mar 2017 10:16 AM
that is because it exists in nil and objects with nil parents dont replicate with FE
Report Abuse
VilgO is not online. VilgO
Joined: 15 Feb 2011
Total Posts: 518
12 Mar 2017 10:19 AM
They're not dumb. Setting a parent adds the object to the workspace tree, which means the object is now replicated to all the clients.
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
12 Mar 2017 10:20 AM
if you want it to be parented to nil you could try this

local function create( class )
local obj = remote:InvokeServer( class )
obj.Parent = nil
return obj
end

print( create "Part" )
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