Sword combat system running on studio is smoother than on actual game

Hello! I am making a sword combat system for my game and it is working great. But one of the problem I encountered is that the sword combat system runs on studio smoother than on the actual game.

I understand that on studio everything is running on my own pc and it is different from the actual game. The hitbox on the sword sometimes don’t really register the hit on the actual game unlike on studio where everything runs smoothly.

Right now I have all the visual effects and the hitbox and also the animation on the server script and I plan to make almost everything to be on local script except the hitbox. But the problem is that I don’t know if that will fix the hitbox problem or not, or will it fix the sword to run smoother or no. So I am here asking for some advice. Thanks in advance!

1 Like

Anything you move to the client will help this problem. Just be warned about exploits, the more you move to the client, the more wary you must be. What type of hitbox are you using?

1 Like

You have to watch out for things like Animations run on the client first, so for others to see it there may be lag depending on the data transfer times of all three systems. You’ve probably played games with lagging players that seem to move at a normal speed, but they lag and jump from spot to spot.
Also how much lag is your game causing? If your system works well in Studio as you say and lags in the Server it will cause these kind of issues.
Using .touched for hitboxes is also buggy. Try searching for other posts that suggest ways to counteract that by using stuff like raycasting.

I don’t really care about exploit because my game gonna be a single player game anyways, also my hitbox is just a normal part welded to the humanoid with touch event detecting the hit.

1 Like

My game is gonna be a single player game so the animation isn’t a problem for me. Right now all the visual effects works fine but the hitbox is not really. In studio the hitbox is detecting every hit and feels smooth unlike in the actual game where the hitbox sometimes don’t detect the hit.

I might also change from the normal touch event hit box to the raycast hitbox soon, feels like that will fix the buggy hitbox problem too.

2 Likes

Changed the hitbox from touch event to raycast and changed some visual effects from sever into cilent and everything work much smoother now. Thanks for all the suggestions

… Yes don’t do touched. Good to hear it went well