I've tried and tried but I can't seem to get it right, either that or I don't have enough knowledge to do this. Basically, this script needs to be edited so that the red ray is shot out of the humanoid [the enemie's] mouth, or near the mouth. Here's the script;
b = false
a = false
function Hado31(v)
missile = Instance.new("Part")
missile.Parent = game.Workspace
missile.Size = Vector3.new(3,3,150)
missile.BrickColor = BrickColor.new("Bright red")
missile.Shape = "Block"
missile.CFrame = script.Parent.Torso.CFrame
missile.BottomSurface = 0
missile.TopSurface = 0
missile.Name = "Paintball"
missile.Elasticity = 0
missile.Reflectance = 0
missile.Friction = .3
missile.Transparency = .3
missile.CanCollide = false
missile.Anchored = true
game.Debris:AddItem(missile, 0.5)
missile.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= script.Parent.Humanoid then
x = hit.Parent:FindFirstChild("Humanoid")
if x then
if not b then
b = true
x.Health = x.Health - 5
wait(.5)
b = false
end
end
end
end)
end
function findNearestTorso(pos)
local list = game.Workspace:children()
local torso = nil
dist = 10
if script.Parent.Humanoid.Health < script.Parent.Humanoid.MaxHealth then
dist = 9999
end
local temp = nil
local human = nil
local temp2 = nil
for x = 1, #list do
temp2 = list[x]
if (temp2.className == "Model") and (temp2 ~= script.Parent) then
temp = temp2:findFirstChild("Torso")
human = temp2:findFirstChild("Humanoid")
if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
if (temp.Position - pos).magnitude < dist then
torso = temp
dist = (temp.Position - pos).magnitude
end
end
end
end
return torso
end
while true do
wait(0.2)
local target = findNearestTorso(script.Parent.Torso.Position)
if target ~= nil then
script.Parent.Humanoid:MoveTo(target.Position, target)
r = math.random(1,12)
wait(0.9)
if r <= 3 then
Hado31(target.Position)
end
if r <= 2 then
script.Parent:MoveTo(target.Position + Vector3.new(math.random(-10,10),0,math.random(-10,10)))
end
if r >= 3 then
script.Parent.Humanoid.Jump = true
end
end
end
`
