I’ve made a gun which spawns a transparent part with a yellow trail to make interesting looking bullets. The only issue i have is that when I shoot the gun, the bullet curves at a big angle and then curves back to the mouse target. This has never happened before? Heres a clip of my friend experiencing this issue.
https://gyazo.com/0577d4be1ce75fe08b136e7722a5334a
As you can see, when my friends mouse was on the sky, the bullet performed as intended. However, when he tried shooting at a wall, the bullets make a very noticable curve. I have no idea what’s causing this. Heres my code:
local glockpos = glock.Attachment.WorldPosition
local mousepos = mouse.Hit.p
local bullet = Instance.new("Part",workspace)
local at0 = Instance.new("Attachment", bullet)
at0.Name = "AT0"
at0.Position = Vector3.new(0, 0.125, 0)
local at1 = Instance.new("Attachment", bullet)
at1.Name = "AT1"
at1.Position = Vector3.new(0, -0.125, 0)
local trail = Instance.new("Trail", bullet)
trail.Attachment0 = bullet.AT0
trail.Attachment1 = bullet.AT1
trail.Color = ColorSequence.new(Color3.fromRGB(255,255,0))
trail.WidthScale = wep.Handle.Trail.WidthScale
trail.Lifetime = 0.05
trail.FaceCamera = true
trail.TextureMode = Enum.TextureMode.Static
trail.Transparency = NumberSequence.new(0)
trail.Enabled = true
bullet.Name = "Bullet"
bullet.Material = Enum.Material.Neon
bullet.Size = Vector3.new(1,1,1)
bullet.Anchored = false
bullet.CanCollide = false
bullet.Transparency = 1
bullet.Color = Color3.fromRGB(255,255,0)
bullet.CFrame = CFrame.new(glockpos, mousepos)
local bv = Instance.new("BodyVelocity", bullet)
bv.Velocity = bullet.CFrame.lookVector * 820
debris:AddItem(bullet, 5)
This causes problems because it can sometimes completely miss the target. Does this have something to do with the trail or attachment on the bullet?