Need help with making bullets

So I’m trying to make a gun that shoots bullets really fast (just like a normal gun). I am using this to make the bullets (trajectory is the bullet)

		local bodyForce = Instance.new('BodyForce', trajectory)
		bodyForce.Name = 'Antigravity'
		bodyForce.Force = Vector3.new(0, trajectory:GetMass() * workspace.Gravity, 0)
		trajectory.CFrame = CFrame.new(tool.Slime.CFrame.p, position)

		trajectory.Velocity = trajectory.CFrame.lookVector * 200
		trajectory.Parent = game.Workspace

The bullet flies fast but it doesn’t start as soon as it is parented to the workspace. It stays put for a little bit before flying off. Here’s a vid

robloxapp-20210528-2126124.wmv (1.5 MB)

I’m wondering if I’m doing something wrong because it should immediately start shooting at the designated speed right?

1 Like

You should try parenting bodyForce to trajectory after trajectory is parented to workspace instead of doing it in the Instance.new function.

1 Like

That doesn’t appear to change any behaver of the bullet. Here is the propertries of the trajectory. Maybe there is something wrong with these?

		local trajectory = Instance.new("Part")
		trajectory.BrickColor = BrickColor.new("Deep blue")
		trajectory.Material = "Neon"
		trajectory.Name = player.Name .. "'s Trajectory"
		trajectory.Anchored = false
		trajectory.CanCollide = false

		trajectory.Size = Vector3.new(0.1,0.1,1)

I decided to use a very fast tween instead and that fixes the problem.

trajectory.CFrame = CFrame.new(tool.Slime.CFrame.p, position)
		
		local TweenService = game:GetService("TweenService")
		
		local tweenInfo = TweenInfo.new(
			0.3, -- Time
			Enum.EasingStyle.Linear, -- EasingStyle
			Enum.EasingDirection.Out, -- EasingDirection
			0, -- RepeatCount (when less than zero the tween will loop indefinitely)
			false, -- Reverses (tween will reverse once reaching it's goal)
			0 -- DelayTime
		)

		local tween = TweenService:Create(trajectory, tweenInfo, {Position = position})
		
		local bodyForce = Instance.new('BodyForce')
		bodyForce.Name = 'Antigravity'
		bodyForce.Force = Vector3.new(0, trajectory:GetMass() * workspace.Gravity, 0)
		bodyForce.Parent = trajectory
		trajectory.Parent = game.Workspace
		tween:Play()