Ability System Networking Flow

I am trying to make an ability system similar to one found in mostly any game/battlegrounds. I can figure out the cooldown system and whatnot, but I am having a hard time deciding for a good flow with abilities.
Essentially, this is the current flow without network:

  • Player presses ability
  • Player gets put in animation
  • Hitbox plays at some point after a delay
  • If a player is in hitbox, the animation continues, and the victims position/rotation is changed to match animation, and an animation is played for victim.
  • At some points during animation, damage is dealt to the victim

Previously, I was thinking of having a system with animation markers that would report damage and moments where to deal them. But since client has authority over its model, it could just play whatever animation it’d want.
But what is the best flow then? I thought of having clientsided hitreg for the hitbox that’s sanitychecked by the server (current m1 system as well) and then just having server playing damage after some delays. But this could cause desync between clients, although I think it wouldn’t be that relevant since it’s only timing with animation.
I also wanted to spawn vfx at specific moments, which markers would’ve been perfect for but now I am unsure after realizing this major security flaw.

I am just posting to see if people know what the standard for this is, if there is a better way I am not seeing, etc. Please criticize my idea.

Look how PlayerModule works in server authority.
Structure keybinds using the Input Action System like in the server authority module and prepare to migrate the system to server authority the moment it comes out of beta.
I have not tested yet if ServerAuthority prevents replication of animation, though, so you could have one server dictionary per player displaying what animations it could play.
If it plays the not allowed animation track, then stop this track and task.defer(Destroy,Track)
Make this action get flagged somewhere, and if repeated, possibly kick/ban the player.

1 Like

I have just read up on Server Authority, had no clue this existed. This is really cool, thank you for letting me know!

Just be careful that it’s technically not in a usable state.
You can’t edit PlayerModule when PlayerScriptsUserInputActionSystem is enabled in the workspace right now.
It’s a really odd bug that should be fixed when server authority comes out of beta, hopefully.
I suggest you take out the script and inspect it to understand how Roblox implemented it.
I personally went for a full rewrite of it to not use OOP slop and not use shared logic for server and client and instead use dedicated logic for each.

Movement logic (for joystick and keyboard), for example, can be simplified to this (on client):

local Moving_PreSimulation = function():()
	Humanoid_Move(Humanoid::Humanoid,(MoveVector::any)::Vector3,true)
end

local Move_Func = function(var:Vector2):()
	local X,Y = GetVector2(var,"X"),GetVector2(var,"Y")
	local state = PreSimulation_Connection
	if X==0 and Y==0 and state then Disconnect(PreSimulation_Connection::RBXScriptConnection);Humanoid_Move(Humanoid::Humanoid,(Vector_Zero::any)::Vector3);PreSimulation_Connection=nil;return end
	local vec = vector.create(X,0,-Y)
	MoveVector = vec
	if not state then
		Humanoid_Move(Humanoid::Humanoid,(vec::any)::Vector3,true)
		PreSimulation_Connection = Connect(PreSimulation,Moving_PreSimulation)
	end
end

(Ignore me hyper-optimizing it.) You basically have to simulate movement on both the server and client. Input Action System does replicate Client → Server events when it is parented under Player or PlayerScripts.

1 Like