So currently I am working on a simple gun, but I have several problems with it
First, the bullet tracers are not loading immediately when I clone it to the workspace, this makes the bullet not come out of the barrel.
Second, the bullet seems a bit delayed when fire and don’t actually come out of the barrel of the gun
I did slow down and not move around, and the bullets did come out of the barrel if I waited for 1 second after the part with the trail is in the Workspace
Here is most of the scripts for the game guntest.rbxl (173.0 KB)
It looks like you’re handling bullet tracers on the server. There will always be a delay between when you fire the Shoot RemoteEvent and when the server processes it. You should handle all of the visuals on the client (render the bullet tracer on the client when shot, then have the server relay the action to other clients), and only have the server handle the damage.
Module scripts don’t create lag or have a performance effect? They’re just essentially scripts you require information and code from, normally a table. You can use them.
That solved one issue but the bullets still does not leave the barrel correctly when it is fired. I also fixed the code so that the bullet is completely handled by the local script(I am ignoring damage for now). The trail now renders correctly but the bullet still does not fire correctly. I wonder if this is just a visual inaccuracy since the bullet already flew out of the barrel when you move it but… Here is the video.
moved module to replicated storage and used to local script to require it
One more thing that had to be fixed, it seems that a real bullet will be with similar bullet tracers so instead, I added in a fake tracer at the muzzle of the gun so it looks like it is coming out of the barrel. Switching the rendering to local script makes the trail load immediately.