Hello, I recently when testing a basic gun when I came across a problem. As you can see in this video, the bullet lags for a split second before moving. Here is my code, thanks for reading!
spawn(function()
local clone = game.ReplicatedStorage.Clones.Bullet:Clone()
clone.Position = plr.Character:FindFirstChildWhichIsA("Tool").Spawn.Position
local vel = Instance.new("BodyVelocity", clone)
vel.Velocity = CFrame.new(clone.Position, pos).LookVector * 150
clone.Parent = workspace[plr.Name.." Bullets"]
clone:SetNetworkOwner(nil)
end)
This is likely due to the physics of the bullet being handled by the server. Unfortunately under your current implementation, this lag is largely unavoidable. One way you can get around this delay is by rendering the bullet on the client. You can do this by either setting the network ownership of the bullet to the player that fired it or by manually updating the position of the bullet within a loop such as RunService:BindToRenderStep (roblox.com).