function check()
for _, v in pairs(game.Players:GetPlayers()) do
if v.Character then
if (v.Character.HumanoidRootPart.Position - script.Parent.Position).magnitude < 10 then
return v
end
end
end
end
while wait(0.1) do
local human = check()
if human ~= nil then
local bullet = Instance.new("Part")
bullet.CanCollide = false
bullet.Position = script.Parent.Position
local BV = Instance.new("BodyVelocity")
BV.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
BV.Velocity = human.Character.HumanoidRootPart.Position
bullet.Parent = workspace
BV.Parent = bullet
end
end
My code doesn't work properly. It doesn't shoot to where the humanoidrootpart is, how would i fix this?

2 comments
I believe you should change line 19 to BV.Velocity = human.Character.HumanoidRootPart.CFrame.lookVector * 50
no, that will only shoot in the direction the player is looking.