What would be the easiest way to script a stun effect?

Hello all!

I’m currently scripting my first sword system, and I want to put in a feature where the player can kick. And if you were to get hit by this kick, you’d get staggered. Problem is, I have no clue how I’d communicate this between the server and client. Does anyone have some ideas? Thanks in advanced!

1 Like

If you want to use UserInputService, you can monitor that in a LocalScript and if the player presses “K” for example to kick then you can run the animation and then fire a RemoteEvent that can handle slowing down the other player on the server-side, then setting their state back to normal.

1 Like

Okay, but wouldn’t that slow-down have to be done on the client side, and not server?

I would defenitely recommend making a “camera shake” effect, this is something I have also been looking into however I do not really know how to make it.

from humanoid, CameraOffset. Then to make that animation of the camera, you would have to use the TweenService

1 Like

Or you could use “EZ Camera Shaker”. It’s far better and provides a smoother effect tbh.

2 Likes

What does this mean? No, the stun shouldn’t be on the client, you should never trust the client with anything important, exploiters can screw with your game if you do.

And anyway, one of the qualities of causing an effect on the server is that everyone sees the effect. If you change the the time of day to midnight, it becomes midnight for everyone. If you use a localscript to change time of day, only you see it.

In short, if you only stun someone on the client, only you will see it (only you will see the effects of the stun, such as the player freezing in place), but in reality they’ll be able to walk around just fine, it would look very strange. If you stun them on the server instead, everyone sees them as stunned.

Also, if you play an animation on the client, only you will see the animation happen (I think). Play an animation on the server.

Anything you want everyone to see or everyone should be affected by should happen on the server.

What does this mean? No, the stun shouldn’t be on the client, you should never trust the client with anything important, exploiters can screw with your game if you do.

Not what I meant, I was asking because I thought that properties like Walkspeed is a client-sided property, that’s why exploit programs can still utilize it in games.

And anyway, one of the qualities of causing an effect on the server is that everyone sees the effect. If you change the the time of day to midnight, it becomes midnight for everyone. If you use a localscript to change time of day, only you see it.

Again, there’s no confusion on how local scripts and normal scripts work. It feels like your post is a tad argumentative, in a place where it really doesn’t need to be. Sorry you had the confusion.

Also, if you play an animation on the client, only you will see the animation happen (I think). Play an animation on the server.

If you play an animation on the Client, it gets replicated to the server. So no need to play it again on the server.

1 Like