Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to fix bullet lagging for less than a second right after it gets fired?

Asked by
Vid_eo 126
4 years ago

All of my guns in a game, have a script similar to this but with different bullets, and all of them are lagging for half a second right after they're fired. Some bullets are also rotating. I tried setting network owner to nil as other people said, but there was no difference. Also tested in a local server.

local HandleCFrame = Handle.CFrame
local FiringPoint = HandleCFrame.p + HandleCFrame:vectorToWorldSpace(NozzleOffset)
local ShotCFrame = CFrame.new(FiringPoint, target)

local LaserShotClone = BaseShot:Clone()
LaserShotClone.CFrame = ShotCFrame + (ShotCFrame.lookVector * (BaseShot.Size.Z / 2))
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.velocity = ShotCFrame.lookVector * Speed
BodyVelocity.Parent = LaserShotClone
LaserShotClone.Touched:connect(function(Hit)
    if not Hit or not Hit.Parent then
        return
    end
    Touched(LaserShotClone, Hit)
end)
Debris:AddItem(LaserShotClone, Duration.Value)
LaserShotClone.Parent = workspace
LaserShotClone:SetNetworkOwner(nil)

Thanks

0
what exactly do you mean by lagging? Benbebop 1049 — 4y
0
right after it fires, the bullet just stays there mid-air for like half a second then continues moving Vid_eo 126 — 4y

Answer this question