something like this,but by getting the gun position from the local script instead of its server position,as i have a point aim mechanic on the clients side.
this is how it fires from the client btw.
if semiDebounce == false then
semiDebounce = true
remotesFolder.Shoot:FireServer(mouse.Hit.Position, tool.Handle.Muzzle.WorldPosition, tool.Handle.CFrame)
wait(fireRate)
semiDebounce = false
end
and the server
for pellets = 1, pellets do
local randomSpread = Random.new():NextNumber(1.75, 2.25)
local direction = applySpread((mouseHitPos - localWorldPos).Unit, randomSpread)
caster:Fire(
localWorldPos,
direction,
1000
)
end
I think it’d be as simple as making the CFrame of the bullet object where the end of the gun is.
In the recent game jam I did this on the client by using a part where the end of the gun is, but ran into issues with connecting that to a modulescript for an enemy. I’m sure putting the code in a normal script instead would’ve fixed it.
Anyways, doing the spawning on there server gives a little big of lag so it makes it seem like it’s not going where it should. I recommend doing it on the client for that, but with the example I gave above, you might need to rewrite or move other code.