How to structure movesets on the client?

Hello! Ive been working on some fighting game mechanics and Im really stuck on this one part.

So on the server when the player joins they get a controller assigned to them. The controller keeps track of cooldowns, and moves which the player can perform by using a custom method i made which binds them to the controller. Then actually when its time to perform a move it checks if the player has that move binded. Pretty simple stuff.

Example:

Controller = {
   BindedMoves = {
      Punch = {--info}
   }
}

Now this is all server sided, And usually my move framework i used to do was remote events and user inputs or context action service. Now every remote event is different between every move, “Punch” has a remote event which listens to the players mouse input. Heres the problem i want this to work on the client too. I want a system where you can bind inputs to functions kind of passed from the server. Yet i have no idea what the client should do right now, im completely lost.

Any answers or improvements would help, thanks.

I am definitely not boosting this post

1 Like

So you wish to merge multiple events into 1?

1 Like

A way for the client to know which move or function to be initiated idk how to properly explain it my post should tell you more.

1 Like

So what you want is to pass a variable with the event, and then based off of what that variable is, do a certain thing.

:FireServer("Punch",X,X,X)
:FireServer("Jump",X,X,X)

and on the client side, you check the first variable, and if is Jump, do something, but if it is Punch, do something different.

Is this what you are talking about?

1 Like

No. Basically i have a combat module which checks the players owned moves. I want client inputs to know which event to fire based in the binded move.

Server:

BindedMoves = {"Punch"}

The punch move has his own remote evenr and module doing the actual combat move. Now i want to connect the client input to the events or functions.

So just fire that event? I’m not really sure what you are trying to achieve here. can you give a clear version of how this would function in a game?

fire a remote event which sends the binded moves when the binded moves are set? Im really struggling to find what the problem your having is exactly please send more of your code

Im not on pc so im rewriting it sorry for the formatting.

local Moveset = {}
Moveset.__index = Moveset 

function Moveset.CreateProfile(player)
   local self = setmetatable({}, Moveset)
   self.Moves = {}
   --other unnecessary info
   return self
end)

function Moveset:BindMove(MoveName:string,
Cd:number)
   local Move = {}
   Move.Name = MoveName
   Move.Cooldown = Cd
   Move.LastTick = tick

   self.Moves[MoveName] = Move
end)

function Moveset:CheckMove(MoveName:string)
   if self[MoveName] then
      return true
   else
      return false
   end
end)

return Moveset

Should give you more of an idea

  • this is done in the back end (server) and i wanted to be able to bind moves on the client with the use of remote events but the clienr knows which remote event belongs to that move or which function to carry out.

still no one is responding😭