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: invoking client question

Previous Thread :: Next Thread 
Wowgnomes is not online. 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
phoenix53124 is not online. phoenix53124
Joined: 25 Feb 2009
Total Posts: 4889
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 is not online. 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
phoenix53124 is not online. phoenix53124
Joined: 25 Feb 2009
Total Posts: 4889
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 is not online. 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
unwarranted is not online. unwarranted
Joined: 05 Jun 2009
Total Posts: 1087
30 Jul 2016 10:03 PM
RemoteEvent - FireClient/FireServer
RemoteFunction - InvokeClient/InvokeServer


mom wheres the spaghetti | R$19,427
Report Abuse
Wowgnomes is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
30 Jul 2016 10:07 PM
that fixed it thank you
Report Abuse
TimeTicks is not online. 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 is not online. 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 is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
30 Jul 2016 10:23 PM
script.Parent.Owner.Value


Report Abuse
unwarranted is not online. unwarranted
Joined: 05 Jun 2009
Total Posts: 1087
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 is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
30 Jul 2016 10:23 PM
game.Players[script.Parent.Owner.Value] *


Report Abuse
Wowgnomes is not online. 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 is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
30 Jul 2016 10:26 PM
You shouldn't be using pcall either.


Report Abuse
unwarranted is not online. unwarranted
Joined: 05 Jun 2009
Total Posts: 1087
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 is not online. 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 is not online. 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 is not online. 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 is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
30 Jul 2016 10:29 PM
if client then

end


Report Abuse
Wowgnomes is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
30 Jul 2016 10:55 PM
bump
Report Abuse
Wowgnomes is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
30 Jul 2016 11:05 PM
bump
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