Vectorforce sometimes doesn't make my bullet go in the same direction where my gun is pointing

I have a test gun and I guess you can call it a bullet but when I shoot the bullet it doesn’t go in the direction of where the gun is pointing, sometimes it will but then sometimes it’ll go right of the gun or left

here is my script, its a server script that’s placed in the gun

I tried comparing the properties of my vectorforce and by making a new once inside a random part but cant figure out why its not moving in the direction of my gun

as you see here the “bullet” flies right

local ServerStorage = game:GetService("ServerStorage")

local PinkSlime = ServerStorage.Slimes.PinkSlime

local SlimeGrabber = script.Parent
local Handle = SlimeGrabber.Handle

local Player = SlimeGrabber.Parent.Parent
local Hrp = Player.Character.HumanoidRootPart
local Hum = Player.Character.Humanoid

local PlayerFolder = Player:WaitForChild("PlayerFolder")
local SlimeGrabMode = PlayerFolder:WaitForChild("SlimeGrabMode")

local CoolDown = false

-- false (throws)
-- true (Grabs)



SlimeGrabber.Activated:Connect(function()
	
	if (CoolDown == false) then

		CoolDown = true

		if SlimeGrabMode.Value == false then

			local CreateSlime = PinkSlime:Clone()
			CreateSlime.CFrame = Handle.CFrame
			CreateSlime.Parent = workspace

			local Attachment0 = Instance.new("Attachment")
			Attachment0.Parent = CreateSlime

			local VectorForce = Instance.new("VectorForce")
			VectorForce.Force = Hrp.CFrame.LookVector * 1500
			VectorForce.ApplyAtCenterOfMass = false
			VectorForce.Attachment0 = Attachment0
			VectorForce.Parent = CreateSlime

			task.wait(0.2)

			Attachment0:Destroy()
			VectorForce:Destroy()

		end

		task.wait(0.3)

		CoolDown = false
	end
	
end)

Your vectorForce is applying the force relative to the gun’s orientation. I think you’re expecting it to be applying based on the world.
image

VectorForce.RelativeTo = Enum.ActuatorRelativeTo.World

The reason I think you’re applying it based on the world is because you wrote:

VectorForce.Force = Hrp.CFrame.LookVector * 1500
1 Like

You could alternatively change

VectorForce.Force = Hrp.CFrame.LookVector * 1500

to

VectorForce.Force = Vector3.new(0,0,-1)*1500 -- this vector might not be write depending on your Tool's orientation and attachment's orientation.

ohh ok I see, it works now, this is my first time using the vectorforce so I didn’t know I had to do that, thanks