I've recently started making a gun script and everything seems to be working fine, but whenever I click on something that isn't the empty void, the bullet goes in a slightly different direction.
local re = script.Parent.RE re.OnServerEvent:Connect(function(player, mouse) local h = mouse.Hit local p = h.p local s = script.Parent.Barrel.Position local b = Instance.new("Part", workspace) b.Size = Vector3.new(.25,.25,.25) b.Transparency = 1 b.Position = s b.CanCollide = false local t = Instance.new("Trail", b) t.FaceCamera = true t.Lifetime = .75 t.MinLength = .15 t.LightEmission = 0.25 local aa = Instance.new("Attachment", b) aa.Position = Vector3.new(0.35, 0, 0) aa.Name = "Attachment1" local ab = Instance.new("Attachment", b) ab.Position = Vector3.new(-0.35, 0, 0) ab.Name = "Attachment1" t.Attachment0 = aa t.Attachment1 = ab local bv = Instance.new("BodyVelocity", b) bv.MaxForce = Vector3.new(9e9, 9e9, 9e9) bv.Velocity = (p*100) wait(3) if b then b:Destroy() end end)
This is my first time making a gun, so any help is appreciated!