This is my source, i believe it’s in the Bullet.CFrame line.
local function CreateBeam(Barrel, Origin, Direction)
local Bullet = Services.ReplicatedStorage.Assets.Bullet:Clone()
local BulletBeam = Bullet.Beam
local EndBeam = Bullet.EndBeam
BulletBeam.Attachment0 = Barrel.Attachment
Bullet.CFrame = CFrame.new(Origin + Direction / 2, Origin)
Bullet.Parent = workspace.Weapon.Bullets
Services.DebrisService:AddItem(Bullet, GunSystem.Configuration["LiveTime"])
end
Yeah thats what i thought, it’s probably because of the character position, and the bullet can sometimes go up because the animation moves the weapon a little bit up so thats propably why. It’s the character but it seems that this line probably fixs it
I also changed the whole logic of the gun, this is the line i added.
You’re setting the Beam to use the attachment on your gun’s barrel, which itself is attached to your character. When your character moves, your gun moves, the attachment moves and the bullet beam moves.
My suggestion is to create a temporary attachment at the position of your gun barrel at the time of the bullet’s creation. This temporary attachment should be parented to something that will never move.
local function CreateBeam(Barrel, Origin, Direction)
local Bullet = Services.ReplicatedStorage.Assets.Bullet:Clone()
local BulletBeam = Bullet.Beam
local EndBeam = Bullet.EndBeam
local TempAttachment = Instance.new("Attachment")
TempAttachment.WorldCFrame = Barrel.Attachment.WorldCFrame
-- Attachments must be parented to a Part or Terrain
TempAttachment.Parent = workspace.Terrain
BulletBeam.Attachment0 = TempAttachment -- changed
Bullet.CFrame = CFrame.new(Origin + Direction / 2, Origin)
Bullet.Parent = workspace.Weapon.Bullets
Services.DebrisService:AddItem(Bullet, GunSystem.Configuration["LiveTime"])
-- Delete temporary attachment
Services.DebrisService:AddItem(TempAttachment, GunSystem.Configuration["LiveTime"])
end