I'm using remote functions for combat. Is this a good idea?

Remote functions allow the game to be clean, and animations to be played on the client. It also supports skill based games, as the return to the function will yield till something is retrieved.

Remote events though fire to the server, and you can’t check if the server has retrieved the fired remote event from the client.

I guess what I’m trying to say is that if I want to play animations on the client for a skill based game with m1 combos, and heavies I think my best bet is to use remote functions. But I’m not entirely sure whether this is a good decision or not.

If I remember correctly from the Laggy Cannons tutorial. Splitting the workload on client and server approximately equally with your own discretion should be fine. Avoid allowing the client too much freedom to the point where exploits can manipulate it.

Let the animations be handled by client only and the combat mechanic like damage calculation is on server.

Why do you think RemoteFunctions “allow animations to be played on the client”? Either you do checks on the client for the animations, or play them on the server, but that can be done by RemoteEvents too. If you are thinking about sending a function and make it return if the animations can be played or not, you still have to account the delay between the time the function has been fired and the ping of the player so I don’t think that’d change much.

How do I check if the server is ready for a player to attack though? What if there’s a server spike on someones pc, I don’t want them to think that they were still clicking because their animations were playing while this was happening.

I don’t think they allow animations to be played on the client, but the best way to make a combat system where you click on the client side and retrieve an animation from a combo number would be remotefunctions. At least that’s just what I think I’m not entirely sure how to do this properly.

e.g

local rem = script.Remotefunction
local combo = rem:InvokeServer()
local combos = {
	[1]="animationid",
	[2]="animationid", -- etc.
}
if combo and combos[combo] then
	-- make animation play on client
end

I’m not quite certain about it, but if I reckon it correctly, the client is handling most of the “cooldowns” on that side and that the server hinders all the nasty exploits where the client’s cooldowns were to be modified. You can simply cancel the damage from what could be an illegal move(in chess, it would be easier to spot an illegal move).

Yeah this is the same system I used in a very old project. However, you have to do checks on the client which can be easily exploited. I guess animations being exploited wouldn’t be that bad, but they can become a problem when used to confuse other players in competitive matches. Either way it’s your choice.

1 Like

Well I could load animations on the server, but they’d look choppy when you first join. That’s the main reason I want to switch to client animations.

1 Like