Need help with gun

I am making a gun in my game and the first issue I found was that the remote event caused too much of a delay. I read that you can get around this delay by running it on the client so I spawned the bullet in a local script. This fixed the delay but it created problems:

  1. I can’t set the network ownership since it was cloned from a local script

  2. Other players can’t see the bullet

  3. I can’t make the bullet detect hits because it was cloned from a local script

I really don’t want to use Raycasting because I would like to have the effect of the bullet moving. I would really appreciate any advice or help.


If it is a local script and you want to damage/kill the player you will need a remote event. This may help you, How to make a WORKING Gun Script in ROBLOX Studio - YouTube

I have also used this script myself so I can say for sure that it works.

that is their gun model.
(all of that was made by WackzBe)

I already used a remote event but a remote event has to wait for the server to respond, so there is a noticeable delay.

Is there any wait() lines in your script? You should use the model/video I sent you because there is no delay. I even use the script.

any delay caused by remote events shouldn’t be more than 100 ms which is barely noticeable

I just checked out the gun and it works fine while standing still but once you start running it shoots from where you were standing a second ago. Here is an old video that kind of explains what I’m talking about.

I believe that is because of that the server cannot keep up with your current position and your old position is when you clicked. The one downside about the gun that I sent you is that you damage yourself if it hits you.

That gun model and the gun models I’m having issues with have to go from client > server > client using remote events and that causes a delay since it has to wait for the server to respond. The gun script I made now only runs on the client so there is no delay.

I’m trying to figure out how I can run it visually on the client but have features of a remote event gun.

Putting it on the client makes it exploitable.

So is there a way I can run it on the client for visuals while the actual bullet is ran by the server?

I guess you can put a localscript in the gun and in serverscriptservice the bullet

Yes just have the client render it instantly then fire a remote event to other clients to render the bullet as well. That is what all shooter games with smooth projectile movement do on roblox.

Wouldn’t that make the bullet exploitable?

How would that make it exploitable?

Someone above commented that spawning the bullet from a local script will allow it to be exploited.

That will not make it exploitable?

But if it is rendered by the clients then how can I fix my other problems of the bullet not being able to detect a hit and setting the network owner.

Thought the bullet got shot from a regular script and remote fired from a local

Use raycasting for detecting a hit