Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local larm = script.Parent:FindFirstChild("Left Arm")
- local rarm = script.Parent:FindFirstChild("Right Arm")
- function fire(spn)
- local missile = script.Parent.Rocket:clone()
- missile.CFrame = spn.CFrame * CFrame.new(0, 0, -3)
- missile.Delete.Disabled = false
- local creator_tag = Instance.new("ObjectValue")
- creator_tag.Value = game.Players.LocalPlayer
- creator_tag.Name = "creator"
- creator_tag.Parent = missile
- missile.RocketScript.Disabled = false
- missile.Parent = game.Workspace
- end
- function findNearestTorso(pos)
- local list = game.Workspace:children()
- local torso = nil
- local dist = 100
- 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
- function Hit(hit)
- local human = hit.Parent:FindFirstChild("Humanoid")
- if human ~= nil then
- human.Health = human.Health - 100
- end
- end
- larm.Touched:connect(Hit)
- rarm.Touched:connect(Hit)
- while true do
- wait(0.1)
- local target = findNearestTorso(script.Parent.Torso.Position)
- if target ~= nil then
- script.Parent.Junk:MoveTo(target.Position, target)
- wait(2)
- fire(script.Parent:findFirstChild("Gun1"))
- end
- end
- local larm = script.Parent:FindFirstChild("Left Arm")
- local rarm = script.Parent:FindFirstChild("Right Arm")
- function fire(spn)
- local missile = script.Parent.Rocket:clone()
- missile.CFrame = spn.CFrame * CFrame.new(0, 0, -3)
- missile.Delete.Disabled = false
- local creator_tag = Instance.new("ObjectValue")
- creator_tag.Value = game.Players.LocalPlayer
- creator_tag.Name = "creator"
- creator_tag.Parent = missile
- missile.RocketScript.Disabled = false
- missile.Parent = game.Workspace
- end
- function findNearestTorso(pos)
- local list = game.Workspace:children()
- local torso = nil
- local dist = 100
- 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
- function Hit(hit)
- local human = hit.Parent:FindFirstChild("Humanoid")
- if human ~= nil then
- human.Health = human.Health - 100
- end
- end
- larm.Touched:connect(Hit)
- rarm.Touched:connect(Hit)
- while true do
- wait(0.1)
- local target = findNearestTorso(script.Parent.Torso.Position)
- if target ~= nil then
- script.Parent.Junk:MoveTo(target.Position, target)
- wait(2)
- fire(script.Parent:findFirstChild("Gun2"))
- end
- end
- function fire(spn)
- local missile = script.Parent.Rocket:clone()
- missile.CFrame = spn.CFrame * CFrame.new(0, 0, -6)
- local creator_tag = Instance.new("ObjectValue")
- creator_tag.Value = game.Players.LocalPlayer
- creator_tag.Name = "creator"
- creator_tag.Parent = missile
- missile.RocketScript.Disabled = false
- missile.Parent = game.Workspace
- end
- while true do
- wait(math.random(3,5))
- fire(script.Parent.Head)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement