Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 30 Jul 2016 07:48 PM |
does the remote function need to be in the player's directory, or can it be a shared one in storage?
I'm thinking the second is true, and when you specify which player that is what matters?
local success, result = pcall(function() return RemoteFunction:InvokeClient(player) end)
|
|
|
| Report Abuse |
|
|
|
| 30 Jul 2016 08:03 PM |
| Every time you use a Remote to invoke the client, it only goes to that one client, even if they all have access to essentially the same node. |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 30 Jul 2016 08:05 PM |
thank you, that makes sense.
I have a follow up question, for something like the line of code above/below, how is success getting defined? I understand success will show if the pcall returns something other then an error, while result is the actual return but how is this so?
local success, result = pcall(function() return RemoteFunction:InvokeClient(player) end)
|
|
|
| Report Abuse |
|
|
|
| 30 Jul 2016 08:23 PM |
| It returns two values. Success and what's returned by the function. If it errors, then it returns false and the stderr message. If it runs, then it returns true and whatever the passed function returned |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 30 Jul 2016 09:58 PM |
I'm getting this error FireClient is not a valid member of RemoteFunction
|
|
|
| Report Abuse |
|
|
|
| 30 Jul 2016 10:03 PM |
RemoteEvent - FireClient/FireServer RemoteFunction - InvokeClient/InvokeServer
mom wheres the spaghetti | R$19,427 |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
| |
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 30 Jul 2016 10:19 PM |
https://forum.roblox.com/Forum/ShowPost.aspx?PostID=193565057
|
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 30 Jul 2016 10:21 PM |
Ok last question
local success, result = pcall(function() return game.ReplicatedStorage.RemoteFunctions.NewCrew:InvokeClient(script.Parent.Owner,NewCrewMember) end) if success then print("WOW") print(result) end
this prints wow then nil, as soon as it is requested
but it should wait to continue until result is not nil. Do I just need to put a wait until result ~= nil
script.Parent.MainGui.JoinRequest.JobPick.FarmingSelect.MouseButton1Click:connect(function() script.Parent.MainGui.JoinRequest.JobPick.Visible = false script.Parent.MainGui.JoinRequest.Visible = false return "Farming" end)
|
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
| |
|
|
| 30 Jul 2016 10:23 PM |
it prints nil because there is no result when it doesn't error
mom wheres the spaghetti | R$19,427 |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 30 Jul 2016 10:23 PM |
game.Players[script.Parent.Owner.Value] *
|
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 30 Jul 2016 10:25 PM |
script.Parent.Owner.Value > ill change it but it works currently
but if success then means it didn't error? shouldn't result be the returning pcall? |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 30 Jul 2016 10:26 PM |
You shouldn't be using pcall either.
|
|
|
| Report Abuse |
|
|
|
| 30 Jul 2016 10:26 PM |
nope, if there are no errors, it just returns true, if there are errors, it returns false w/ the error message
mom wheres the spaghetti | R$19,427 |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 30 Jul 2016 10:26 PM |
| Shouldn't I be using pcall in case it errors? |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 30 Jul 2016 10:27 PM |
No, you make sure the value exists before doing anything.
|
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 30 Jul 2016 10:28 PM |
| what if the client disconnects from the game |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
| |
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 30 Jul 2016 10:31 PM |
Can you help me understand how the wiki is wrong? http://wiki.roblox.com/index.php?title=RemoteFunction_and_RemoteEvent_Tutorial
|
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 30 Jul 2016 10:32 PM |
Like I said in my thread. Wiki is pretty cancerous.
|
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 30 Jul 2016 10:34 PM |
local rf = game.ReplicatedStorage.Remotes:WaitForChild('RemoteFunction')
function rf.OnServerInvoke(plr,msg) print(msg) return 'Hello' end
local rf = game.ReplicatedStorage.Remotes:WaitForChild('RemoteFunction')
local msg = rf:InvokeServer('Hi')
if msg then print(msg) end
|
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 30 Jul 2016 10:41 PM |
local result = game.ReplicatedStorage.RemoteFunctions.NewCrew:InvokeClient(script.Parent.Owner,NewCrewMember) if result ~= nil then print(result) end print("wow")
I removed the pcall, it still doesn't print the result? |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
| |
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
| |
|