Body Velocity Projectile Curves

So i had a issue where my projectile will be a little off where my mouse was but i solved it. But now my projectile curves for some reason?

local script code in tool:

local Tool = script.Parent

local Folder = game.ReplicatedStorage:WaitForChild("Pistol")

local Bullet = Folder.Bullet

local Cooldown = false

local DebrisService = game:GetService("Debris")

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

Tool.Activated:Connect(function()
	
	if Cooldown == true then
		return true
	else
		Cooldown = true
			
		local NewBullet = Bullet:Clone()
		NewBullet.Parent = Tool
		NewBullet.Position = Tool.Handle.Position

		local Velocity = Instance.new("BodyVelocity")
		Velocity.Parent = NewBullet
		Velocity.Velocity = (Mouse.Hit.Position - Tool.Handle.Position).Unit * 1000

		DebrisService:AddItem(NewBullet, 10)
		
		task.wait(1)
		Cooldown = false
	end
end)

Example:

robloxapp-20240626-2144213.wmv (442.5 KB)

if anyone knows how to fix this i would be greatful and can anyone explain a little about body velocity as im still learning

I would highly recommend switching over to something like LinearVelocity instead. However, for you solution, try setting the MaxForce to something extremely high:

Velocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
-- if it's still an issue, I'm not sure if this will make a difference
-- since BodyVelocity is deprecated
Velocity.P = math.huge
1 Like

Thanks so much that solved it but can you explain about max force i read its the limit on each axis im guessing the force was more than the limit causing it to curve? or am i wrong

Gravity exists, so it needs a higher max force value to fully counteract that force.’

Edit: Remember, MaxForce only only dictates the maximum amount of force it can set to a BasePart to reach the goal Velocity. They work together. So if your MaxForce is infinite, it will put as much force as possible to hit it’s goal.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.