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
|
  |
| Joined: 26 Mar 2016 |
| Total Posts: 417 |
|
| |
|
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
|
  |
| 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 |
|
|
|
| 12 Mar 2017 09:35 AM |
you cant print an instance
|
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 12 Mar 2017 09:46 AM |
did you try my script, and if so, did it print?
|
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 12 Mar 2017 09:53 AM |
wait yea do what ozzy says parent to workspace or whatever
|
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|