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: How do you use remotefunctions/events?

Previous Thread :: Next Thread 
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
28 Dec 2014 12:23 PM
don't link me to the wiki, because I didn't understand diddly squat from that

I have this gui that changes based on a value in workspace, and with filteringenabled on, it will not fire the changed event. how would remotefunctions/events solve this? can someone help apply this?

local val = workspace:FindFirstChild("TestVal")
local label = script.Parent
local labelval = label.RecieveVal

val.Changed:connect(function()
labelval.Value = val.Value
end)

labelval.Changed:connect(function()
label.Text = labelval.Value
end)

Like I said, it doesn't work with FE.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
28 Dec 2014 12:25 PM
That's probably because with FE, it only changes for the client that changes it.

Use RemoteFunctions or RemoteEvents.


Try re-reading it, and be patient.


http://wiki.roblox.com/index.php?title=RemoteFunction_and_RemoteEvent_Tutorial
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
28 Dec 2014 12:26 PM
I've legitimately read that four times, I just don't know how to apply it to my script
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
28 Dec 2014 12:29 PM
RemoteFunctions:
-InvokeClient (Method)
-InvokeServer (Method)
-OnServerInvoke (Callback)
-OnClientInvoke (Callback)

RemoteEvents:
-FireServer (Method)
-FireClient (Method)
-FireAllClients (Method)
-OnServerEvent (Event)
-OnClientEvent (Event)


I'm sure by now you know what an event is, so RemoteEvents would be the easiest to learn. Not that RemoteFunctions aren't easy though.
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
28 Dec 2014 12:29 PM
uhm, sir
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
28 Dec 2014 12:30 PM
k gimme a few minutes

but uhm, in studio the whole thing forks even with FE on which is a problem because I can't test what works and what doesn't
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
28 Dec 2014 12:32 PM
That's because there is no client/server boundary on Studio. Try going to Test>Start Server and test it there, and if you need a client, go to Test>Start Client (I think)
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
28 Dec 2014 12:50 PM
so if I did

game.Players.PlayerAdded:connect(function(p)
p.PlayerGui:FindFirstChild("TestGui").TestEvent:FireClient
end)

in a serverscript and

local ev = label.Parent.TestEvent
ev.OnClientEvent:connect(function()
labelval.Value = val.Value

would this work?
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
28 Dec 2014 12:55 PM
sir
Report Abuse
iiEssence is not online. iiEssence
Joined: 18 Jun 2014
Total Posts: 3467
28 Dec 2014 12:56 PM
:FireClient()
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
28 Dec 2014 12:56 PM
Yes, that is correct, but you would need to wait for the event to appear in their GUI, since it doesn't load instantly.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
28 Dec 2014 12:57 PM
Oh wait, that wouldn't.

FireClient is an event, and you also need to specify which client.

:FireClient(game.Players.ExamplePlayer, Arg1, Arg2, Arg3, Arg4, et, cetera)
Report Abuse
UnvaryingC0DER is not online. UnvaryingC0DER
Joined: 10 Aug 2014
Total Posts: 173
28 Dec 2014 12:57 PM
op is not very smart

they're ez
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
28 Dec 2014 01:01 PM
there's a difference between ignorance and idiocy, sir

so for the arguments, could I just use a for loop to loop through the players?
Report Abuse
iiEssence is not online. iiEssence
Joined: 18 Jun 2014
Total Posts: 3467
28 Dec 2014 01:05 PM
You don't put the loop as the argument, but you are close sir
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
28 Dec 2014 01:29 PM
oh god I still don't get it

can someone please help me apply this to my script
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
28 Dec 2014 04:03 PM
sersly
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
28 Dec 2014 04:14 PM
'FireClient is an event, and you also need to specify which client.'
uwot

OP think of RemoteFunctions/RemoteEvents as BindableFunctions/BindableEvents that can pass through to the server from the client or to the client from the server. When filtering is enabled, any changes the client makes won't be replicated to the server which is why, if you want others to see the changes, you have to use a RemoteFunction/RemoteEvent.

When you want the server to do something from the client, you call the appropriate method with any arguments you care to pass. For example, if I wanted the server to print Hello, world! using a RemoteEvent, I would attach a listener from the server on the RemoteEvent, like so:

remoteEvent.OnServerEvent:connect(function(client, msg)
print(client.Name, "said:", msg);
end);

And from the client I would invoke the server like this:
remoteEvent:FireServer("Hello, world!");

And my output would be PlayerName said: Hello, world!

When you FireServer, the implied first argument is the client that called it. It gives you their player and all the arguments after it are the arguments you pushed.

When you want to send something to the client, from the server, you would use:
remoteEvent:FireClient(client, "Hello, world!");

Where the first argument would be the player, and everything after it is whatever you want to pass. And a local script would handle like as such:

remoteEvent.OnClientEvent:connect(function(msg)
print(msg);
end);
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
28 Dec 2014 04:16 PM
RPCs for days.
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