I am making a gun and I need a bullet system. I made a simple one but it seems like the bullet just wont fly. It gets stuck mid-air. I tried to unanchor it, nothing. Maybe its a ROBLOX bug?
It wont work in studio and in-game.
function GetBullet() local p = Instance.new("Part", workspace) p.Size = Vector3.new(.5,.5,.5) p.Shape = Enum.PartType.Ball p.BrickColor = BrickColor.new("Bright yellow") p.Material = "Neon" p.CanCollide = false p.Anchored = false Instance.new("BodyVelocity", p) return p end mouse.Button1Down:connect(function() if canShoot == true and isInspecting == false and isSprinting == false then local mH = mouse.Hit local bullet = GetBullet() bullet.CFrame = cam:FindFirstChild("MOSINNAGANT").MOSINNAGANT.Fire.CFrame * CFrame.new(character.Torso.CFrame.lookVector * 2) bullet.CFrame = CFrame.new(bullet.Position, mH.p) bullet.BodyVelocity.velocity = bullet.CFrame.lookVector * 120 bullet.Touched:connect(function(hit) local huma = hit.Parent:FindFirstChild("Humanoid") if huma then huma:TakeDamage(10) bullet:Destroy() end end) --The end thing is correct, dont bother correcting it. I have a script after this that makes the gun flash and everything. Dont want to post too much about my gun lol