Module script Client-Server communication passing as Nil

I’ve been trying for quite a bit now to create Client-Server communication through with Module scripts through a remote event that is fired first from the client and a normal server script recieves the information. From there the server script sends over all the variables to a server module to do whatever it got to do but no matter what I do the Server-Server communication only sends one variable and makes the other one nil no matter how much I change around the variables, or whether I send them over a table or not. This is what I’ve been trying so far.

  • First Client-Server communication | Client Module
local location = mouse.Hit -- Mouse variable exists in my actual script, it does not return nil.

actorCall:FireServer("Wire", location, "Throw") -- Firing the remote event through the client	
  • Server-Server communication | Normal server script
actorCall.OnServerEvent:Connect(function(Player : Player, Ability : string, ...)
	local chr = Player.Character
        -- Note! When printing print(...) all variables are sent correctly.
	
	local MovesetModule = require(movesets:FindFirstChild(chr:GetAttribute("Role")):FindFirstChild(chr:GetAttribute("Character")))
	MovesetModule[Ability](...) 
end)
  • What the server recieves | Server Module
function Server:Wire(Pos, Mode)
	print(Pos, Mode) -- Prints mode as nil in this instance.
	
	local chr = Player.Character
	local root : BasePart = chr:FindFirstChild("HumanoidRootPart")
	
	local direction = (Pos.Position - root.Position).Unit
        -- etc etc...
end

(post deleted by author)

Looks like your issue comes from these two lines:

--In the Server Script, you call this "like a function"
MovesetModule[Ability](...) 
--In the Server Module, you define this "like a method"
function Server:Wire(Pos, Mode)

So instead of the variables Pos and Mode containing the 1st and 2nd element of ..., self contains the 1st argument and Pos contains the 2nd (leaving Mode to be nil). You should be able to fix this by defining Wire like this:

-- Use '.' instead of ':'
function Server.Wire(Pos, Mode)

Another alternative (this is essentially just a stylistic difference) is to reorganize your module to return a table of key, function pairs:

--Server Module
return {
   Wire = function(Pos, Mode)
      --code
   end,
   --Add other "functions" below
}

This is what fixed it, thanks! I asume it’s because it was a method instead of a function, it now runs fine, thank you!