The server side:
local remoteWalk = Instance.new("RemoteFunction")
local remoteRun = Instance.new("RemoteFunction")
local function Walk(client)
stats.human.WalkSpeed = 16 --stats.human refers to a player's humanoid
end
local function Run(client)
stats.human.WalkSpeed = 32
end
remoteWalk.OnServerInvoke = Walk
remoteRun.OnServerInvoke = Run
The following code is in a module script, which is required by a local script.
local requests = ActionManager.ActionRequests --A table containing the remote functions
local remoteWalk = requests["Walk"] --the "Walk" remote function from the server script
local remoteRun = requests["Run"] --the "Run" remote function from the server script
local function Walk()
remoteWalk:InvokeServer()
end
local function Run()
remoteRun:InvokeServer()
end
--The "Walk" and "Run" functions are bound to keyboard inputs
I've simplified the code a bit to make it more readable. When the remote functions are invoked by the client, I get this error:
"Trying to call method on object type: 'RemoteFunction' with incorrect arguments."
I thought that was because I previously hadn't included a "client" argument on the server side, but I still get the same error. Could it be because the code is required from a module script? It's definitely being performed on the client. Thanks for the help!
