Need a bit of help with some superpowers! (Client vs Server)

Hello! I’m really happy that you clicked on this, because I need some help with something.

So I’m making a game mostly revolving around superpowers. I tried to implement quasiducks’s lightning beams module into the game to add effects, and it worked perfectly, after I followed a youtube tutorial on it. Although a problem showed up when I tried to make a fireball power. Running it on the client introduced a problem that I can’t fix. And I spent around 12 hours over the span of 3 days trying to get it to work. The problem is that I can’t make it do damage. At some point I just gave up and ran it on the server, and implemented a script in the NPCSs and players that would detect spells and check their magnitude, then damage if its the case. It worked perfectly with no delays or issues, and I was very happy.

But, recently I’ve been starting to worry if this is gonna be bad for my game. So, I want to ask 2 questions.

  1. Is there a problem running it on the server or would it just be better to run every power on the client?

  2. If I need to run it on the client, then how do I make it do damage?

Since I expect client to win, I’m really looking for an answer to 2.

EDIT: There has been a misunderstanding when I said “Running it on the client introduced a problem that I can’t fix. And I spent around 12 hours over the span of 3 days trying to get it to work. The problem is that I can’t make it do damage.” I didn’t do the damage on client, I did what you guys said (damage on server and effects on client) I also forgot to mention that I’m running the module on client side and everything else like parts is pure server side.

Important things like damage have to be handled on the server to have a secure game. If it runs fine on the server, the only thing you need to do is add something to the client when they use a super power - something that lets the user know they triggered the event while waiting for the server to process their action and replicate it back to them. To reduce replication load, you can also generate the effects on the client, but it doesn’t sound like an issue for you so I would just leave it be.

1 Like

Thank you very much! Can you be more specific about “the only thing you need to do is add something to the client when they use a super power - something that lets the user know they triggered the event while waiting for the server to process their action and replicate it back to them”? I don’t really understand what you meant by that and what I should add.

Hi.

Okay so a few things. The server is sometimes helpful for some things, but if something is too heavy for the server, then it’s best to do it on the client, hence firing all clients, and making them do the effects themselves, but you handling the damage from the server. This is a you choice, and usually something you decide on based on your performance. The server sometimes isn’t able to handle some things, and having the client do it is easier. Overall, it’s really your choice. What I recommend for your issue, is to handle damage from the server, and then effects from the client. Using a firing all clients.

2 Likes

If you choose to do the effects on the server, (or even if you don’t), you may want to have some sort of “wind up” prior to the visual/damage to take place to help cover up the latency between the clients and the server. You send the request immediately to the server and also immediately play a “wind up” on the client, so that when it actually takes place on the server, the “wind up” let the client know their input/action was recieved and being executed, even though it doesn’t immediately appear because of the delay.

There used to be a tutorial called “Fighting Lag” that explained this really well with cannons, but I’m not sure I can find it anymore. This is the game for it though: Laggy Cannons - Roblox

2 Likes

I would suggest you should always handle ‘Damage’ on the server since It makes your game more secure and Is also useful for an example if the damage is handled on the client all the damage will be made from the client and the server wont recognize that.

1 Like

Oh I have that already because my animations have wind up parts and I synchronized them perfectly

I tried making the fireball on the client but I couldn’t do the damage part, I can’t figure it out and I don’t wanna use .Touched