My goal is to be able to make a sword combo system. I want to have the game determine which combo to use depending on which way the player moves there mouse. Example if the player moves there mouse right then left then right again it would do that series of animations for the combo. How would i go about doing this? and is there an API for finding out each direction of their mouse?
I wanna explain this more, but basically it's just comparing the last mouse's coordinates with the current mouse's coordinates mathematically whenever it moves.
If currentX is greater than lastX then it's going right.
If currentX is less than lastX then it's going left.
If currentY is greater than lastY then it's going down.
if currentY is less than lastY then it's going up.
local mouse = game.Players.LocalPlayer:GetMouse() local lastx,lasty; mouse.Move:Connect(function() local x,y,dirx,diry = mouse.X,mouse.Y; if not lastx then lastx,lasty = x,y; else dirx = ((x > lastx) and "Right") or "Left"; diry = ((y < lasty) and "Up") or "Down"; lastx,lasty = x,y; end if dirx and diry then print(dirx.." | "..diry); end end)