Should I change this attribute from server or client sided?

I am making a combat system and right now I am working on basic combat. I am unsure if I should change an attribute via client or server.

CONTEXT OF ATTRIBUTE: The attribute is called CurrentCombo and all it does is counts the current combo the player is at with their base m1 move.

The main reason why I’m asking this is because there is a module that holds cooldown data to each default move. With a move like this, I have cooldowns and other data for each combo. Example of this code below:

["Punch"] = {
		
		[1] = {HitboxDuration = .3, Cooldown = .5},
		[2] = {HitboxDuration = .3, Cooldown = .5},
		[3] = {HitboxDuration = .3, Cooldown = .5},
		[4] = {HitboxDuration = .3, Cooldown = .5},
		[5] = {HitboxDuration = .3, Cooldown = 5},
		
	}

I currently have this attribute change via client because the server would cause a delay between input touched and animation playing. If I were to send the server the current combo the player is at, would this cause any issues? And if so, would there be a patch/fix I can do?

--Client code
local combo = Char:GetAttribute("CurrentCombo") do
	combo += 1
end
	
if Char:GetAttribute("CurrentCombo") > 5 then
	Char:SetAttribute("CurrentCombo", 0)
	combo = 0 or Char:GetAttribute("CurrentCombo") --resets value
	
	combo += 1
end
2 Likes

You can handle it client-side, but you should still sanity check on the server. Even just to make sure the remote doesn’t get spammed. Combat systems can be rather complicated to balance between authenticity and fluidity. If you want more fluid combat, client-side will help with that, but your game will be more prone to exploits. You can still have loose server-side checks to prevent major exploits.

Another option is Rollback Netcode, but you have to code your entire game around it:

1 Like

As good as a Rollback Netcode sounds, its probably near impossible to make without 3rd party integrations to the game. I’ll try to think of a check the server can do to make sure the player doesn’t fully change their combo amount.

You can do it, but it requires utilizing remote events to simulate your own networking. Although, I’d wait for the upcoming less reliable remotes that they mentioned. I can’t find exactly where they mentioned it at this moment, but it’s much better for this sort of thing than the current remote system.

A fix I found was to hold the amount of “combos” the player has when they join, and the number will change with the punch function. So if the new number is way higher than it should be it will rollback to the previous combo.

Yeah, that’ll work. There are some other issues with it being client-side, but I’d rather it be that way than not make hits I think I should’ve.