torso = script.Parent.Torso
maxrange = 70
minrange = 20
target = nil
tor = nil
function findNearestTarget()
plrs = game.Players:GetChildren()
for i, plr in ipairs(plrs) do
if plr.Character ~= nil then
if plr.Character:findFirstChild("Humanoid") and plr.Character.Humanoid.Health>0 then
tor = plr.Character.Torso
if target == nil then
if ((torso.Position - tor.Position).magnitude <= maxrange) then
if ((torso.Position - tor.Position).magnitude >= minrange) then
target = plr.Character
else
target = nil
script.Parent.Zombie:MoveTo(script.Parent.Head.Position, script.Parent.Head)
end
else
target = nil
script.Parent.Zombie:MoveTo(script.Parent.Head.Position, script.Parent.Head)
end
end
end
end
end
end
head = script.Parent:WaitForChild("Head")
function Shoot ()
local ball = Instance.new("Part")
ball.Name = "Ball"
ball.BrickColor = BrickColor.new("White")
ball.Shape = "Ball"
ball.Size = Vector3.new(1,1,1)
ball.CanCollide = false
ball.CFrame = head.CFrame
ball.Velocity = tor.CFrame*20
ball.Parent = game.Workspace
end
while true do
wait(.1)
findNearestTarget()
if target ~= nil then
wait(2)
Shoot()
print ("Shooted")
end
end
So, what this is supposed to do, is that when this humanoid has a target he shoots on its direction. But he shoots downward and not on the targets direction. Help?

2 comments
hes shooting downwards
dude -_- u dont kno nothing! :P I made my Gun like a fe Days ago, I made the same Mistake :P I learned from my Mistake... the Front Surface needs to be facing forards, cos if there's no focus part, then the only choice for the system is the front surface :P try it, believe me... u dont just Thumbs Don cos u think it's rong :P try it first then Judge...