gunter5
|
  |
| Joined: 15 Mar 2011 |
| Total Posts: 737 |
|
|
| 20 Nov 2016 08:42 PM |
so lets say i have this on a FE game. This would work as it should.
------[Local Script]------- local RStorage = game:GetService("ReplicatedStorage") local remote = RStorage:WaitForChild("Remote") local player = game:GetService("Players").LocalPlayer
player.Chatted:connect(function(msg) remote:FireServer(msg) end) -----------[end]-------------
------[Server Script]------ local SStorage = game:GetService("ServerStorage") local RStorage = game:GetService("ReplicatedStorage") local remote = RStorage:WaitForChild("Remote")
remote.OnServerEvent:connect(function(player, msg) if msg:sub(1,msg:len()):lower() == "test" then ---- code end end)
-----------[end]-------------
But what im wanting to do is this.
------[Local Script]------- local RStorage = game:GetService("ReplicatedStorage") local remote = RStorage:WaitForChild("Remote") local player = game:GetService("Players").LocalPlayer
character = game.Workspace:WaitForChild(player.Name) human = character:WaitForChild("Humanoid")
player.Chatted:connect(function(msg) remote:FireServer(msg, character, human) end) -----------[end]-------------
------[Server Script]------ local SStorage = game:GetService("ServerStorage") local RStorage = game:GetService("ReplicatedStorage") local remote = RStorage:WaitForChild("Remote")
remote.OnServerEvent:connect(function(player, msg, character, human) if msg:sub(1,msg:len()):lower() == "test" then ---- code end end)
-----------[end]-------------
im wanting to be able to pass multiple arguments. Any way i can do this?
#code print (string.char(73, 32, 107, 105, 108, 108, 101, 100, 32, 109, 117, 102, 97, 115, 97)) |
|
|
| Report Abuse |
|
|
|
| 20 Nov 2016 08:43 PM |
put all the arguments in a table and send the table, then use table[1] to get the first argument, table[2] to get the second, etc
|
|
|
| Report Abuse |
|
|
|
| 20 Nov 2016 08:46 PM |
It should work the way you put it;
remote:FireServer(arg1,arg2,arg3)
remote.OnServerEvent:connect(function(plr,arg1,arg2,arg3) -- code end)
But if you're just sending the server an onChatted event
You can do something like this in a server script:
game.Player.PlayerAdded:connect(function(plr) plr.Chatted:connect(function(msg) if msg:sub(1,msg:len()):lower() == "test" then -- print(plr.Character.Name) -- print(plr.Character.Humanoid.Name) end end) end) |
|
|
| Report Abuse |
|
|
gunter5
|
  |
| Joined: 15 Mar 2011 |
| Total Posts: 737 |
|
|
| 20 Nov 2016 08:59 PM |
what if i wanted to send a variable. like
character = game.Workspace:WaitForChild(player.Name) human = character:WaitForChild("Humanoid")
then send the whole variable via a table. can anyone give an ex?
#code print (string.char(73, 32, 107, 105, 108, 108, 101, 100, 32, 109, 117, 102, 97, 115, 97)) |
|
|
| Report Abuse |
|
|