|
| 27 Sep 2017 01:30 PM |
I have a variable 'key' that I send to a remote event, at the remote events side of things 'key' is always nil.
-- Code in the remote event script.Parent.OnServerEvent:connect(function(player,key) print(player, key) end)
-- Code in local script that triggers the remote event game:GetService("UserInputService").InputBegan:connect(function(key,gp) if not gp then game.Workspace.RemoteEvent:FireServer(key) end end)
-- what do
|
|
|
| Report Abuse |
|
|
| 27 Sep 2017 01:39 PM |
First of all, you should be using Connect() not connect()
UserInputService passes on InputObject, not a key. If you want to get the key you need to use key.KeyCode
-- Code in the remote event script.Parent.OnServerEvent:Connect(function(player, key) print(player, key) end)
-- Code in local script that triggers the remote event game:GetService("UserInputService").InputBegan:Connect(function(inputObject, gp) if not gp then game.Workspace.RemoteEvent:FireServer(inputObject.KeyCode) end end)
|
|
|
| Report Abuse |
|