KOzero
|
  |
| Joined: 11 May 2010 |
| Total Posts: 1411 |
|
|
| 18 Sep 2014 04:08 AM |
How do I send argument such as strings, numbers, objects from Server> Client or the opposite? I've attempted to do it several times and I'm getting no where, I checked the wiki but it seems I'm still doing something wrong. Please write an example and explain every line of code so I will be able to do it right when I'm on my own... |
|
|
| Report Abuse |
|
|
Locard
|
  |
| Joined: 13 Apr 2014 |
| Total Posts: 3516 |
|
|
| 18 Sep 2014 05:22 AM |
From Server to client...
SERVER game:GetService'ReplicatedStorage'.RemoteEvent:FireClient(PLAYERNAME,tuple arguments)
CLIENT game:GetService'ReplicatedStorage'.RemoteEvent.OnClientEvent:connect(function(tuple arguments) end)
From client to server...
CLIENT game:GetService'ReplciatedStorage'.RemoteEvent:FireServer(tuple arguments)
SERVER game:GetService'ReplicatedStorage'.RemoteEvent.OnServerEvent:connect(function(PLAYER,tuple arguements) --Keep in mind that the argument PLAYER will always be the player's instance from which the :FireServer() method was fired. end) |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2014 06:05 AM |
I prefer RemoteFunctions.
RemoteFunction:FireServer(Args) RemoteFunction.OnServerInvoke = function(Player, Args) print(Player, Args) end |
|
|
| Report Abuse |
|
|
KOzero
|
  |
| Joined: 11 May 2010 |
| Total Posts: 1411 |
|
|
| 18 Sep 2014 07:05 AM |
What I wanted to do is send the args from the client to all the other clients,so it would be like this Client>Server>AllClients. Module Scripts can't do this because a client can't access the Playerguiof another client.
Now here is my problem, Why are my arguments nil here? I didn't bother, writing the property changes that were made
LocalScript: local Remotes = game.ReplicatedStorage.Remotes Remotes.SendMsg:FireServer(Test.Text,Player.Name,Msg) Remotes.MessageReceived.OnClientEvent:connect(function(...) end)
ServerScript: local Remotes = game.ReplicatedStorage.Remotes game.ReplicatedStorage.Remotes.SendMsg.OnServerEvent:connect(function(Player,...) print(1)--This prints game.ReplicatedStorage.Remotes.MessageReceived:FireAllClients(...) end) |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2014 07:21 AM |
Modulescripts only run once, so they wouldn't help anyways. I'm not sure what's wrong with the script, I always use RemoteFunctions, and I am not too familiar with the ellipsis operator. |
|
|
| Report Abuse |
|
|
KOzero
|
  |
| Joined: 11 May 2010 |
| Total Posts: 1411 |
|
|
| 18 Sep 2014 07:28 AM |
| Mind explaining what the ellipsis operator is? |
|
|
| Report Abuse |
|
|
KOzero
|
  |
| Joined: 11 May 2010 |
| Total Posts: 1411 |
|
| |
|
KOzero
|
  |
| Joined: 11 May 2010 |
| Total Posts: 1411 |
|
|
| 18 Sep 2014 09:04 AM |
| I'm not the only person having this problem, I checked lua-users the website and found the exact same problem. |
|
|
| Report Abuse |
|
|