Bwc904
|
  |
| Joined: 16 Nov 2011 |
| Total Posts: 184 |
|
|
| 17 Oct 2016 04:53 PM |
[TRIGGER WARNING] (Ik, I'm so funny -_-)
-- Sup yall! I was wondering I can make it so When one of the clients presses a button, it triggers a function on all clients. I would use a remote function normally but I can't have it going to the server due to lag.
I tried making it so the Client would trigger a remote function(The Instance) and then everyone's local script would do their thing onServerInvoke/OnInvoke but it looks like local scripts can't do that.
Then I tried doing InvokeClient but That'll only invoke one person, and it gets messy with all the "arguments" I'm trying to carry around.
PLEASE HELP MEH! If I need to explain anything more, let me know! |
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Oct 2016 04:58 PM |
also why are you even using remotes boi
use something called a bindable event
then fire something like a table of players that you want to run the code when it fires or something
example with a bindable in the workspace:
--every local script:
function dothis() --code end
bindable.Event:connect(function(list) for _,item in list do if item.Name == game.Players.LocalPlayer.Name then dothis() end end end)
--in one local script or command bar:
bindable:Fire({game.Players.Player1}) |
|
|
| Report Abuse |
|
|
Bwc904
|
  |
| Joined: 16 Nov 2011 |
| Total Posts: 184 |
|
|
| 17 Oct 2016 05:01 PM |
| So if I fired it from on client (With FE Enabled) it would be fired for all? |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2016 05:02 PM |
Yes because a bindable event is for server-server or client-client communication
The event will not be the same for the server or on the client which means each one fires on their own sides
Any clients connected to the bindable will run on the event or function when fired from a local script
Same idea with server scripts except without client interaction or interference |
|
|
| Report Abuse |
|
|
Bwc904
|
  |
| Joined: 16 Nov 2011 |
| Total Posts: 184 |
|
|
| 17 Oct 2016 05:06 PM |
Sweet! Thank's m8, I'll see what I can do with that!
The only reason I didn't use them before was that I read on Roblox wiki that they don't communicate Server-Client, which I automatically (And wrongly) assumed that it wouldn't work client-client with FE.
Thanks once again. |
|
|
| Report Abuse |
|
|
Bwc904
|
  |
| Joined: 16 Nov 2011 |
| Total Posts: 184 |
|
|
| 17 Oct 2016 05:33 PM |
So I'm having a problem, The Bindable Event works with the client who triggers it, but not with any other (I'm testing it with a Roblox studio server)
The "Trigger'ers'" script:
Mouse.Button1Down:connect(function() local lawl = script.Parent.Name game.Workspace.Test:Fire(lawl) end)
-------------------------- The "Triggered" Clients script.
game.Workspace.Test.Event:connect(function(lawl) print("yoyo, its working! This guy is cool: "lawl) end)
---
|
|
|
| Report Abuse |
|
|
|
| 17 Oct 2016 05:35 PM |
That should work just fine but:
print("yoyo, its working! This guy is cool: "lawl)
print("yoyo, its working! This guy is cool: " .. lawl)
concatenation
|
|
|
| Report Abuse |
|
|
Bwc904
|
  |
| Joined: 16 Nov 2011 |
| Total Posts: 184 |
|
|
| 17 Oct 2016 05:47 PM |
Yea, It was good in my studio just frogot the .. while pasting into the forum.
I just tried making it so it even made a brick, and once again it works for the client, but not with the other. (No Errors, Or any prints) Thanks again fro your time. |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2016 05:49 PM |
make sure that every client is connecting to the bindable
if for some reason that does not work then you could try sending to server with remotes then back to client with remotes |
|
|
| Report Abuse |
|
|
Bwc904
|
  |
| Joined: 16 Nov 2011 |
| Total Posts: 184 |
|
|
| 17 Oct 2016 05:55 PM |
| The local scripts are the same for all the clients, Unless you mean something else by connected |
|
|
| Report Abuse |
|
|