Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Humanoid = Instance.new("Model", game.Workspace)
- Torso = Instance.new("Part", Humanoid)
- HumanoidRootPart = Instance.new("Part", Humanoid)
- HumanoidRootPart.Transparency = 1
- Hum = Instance.new("Humanoid", HumanoidRootPart)
- Hum.RigType = "R6"
- Torso.Size = Vector3.new(2,2,1)
- RightArm = Instance.new("Part", Humanoid)
- RightArm.Size = Vector3.new(1,2,1)
- RightArm1 = Instance.new("Motor6D")
- RightArm1.Parent = Torso
- RightArm1.Part0 = Torso
- RightArm1.Part1 = RightArm
- LeftArm = Instance.new("Part", Humanoid)
- LeftArm.Size = Vector3.new(1,2,1)
- LeftArm1 = Instance.new("Motor6D")
- LeftArm1.Parent = Torso
- LeftArm1.Part0 = Torso
- LeftArm1.Part1 = LeftArm
- LeftLeg = Instance.new("Part", Humanoid)
- LeftLeg.Size = Vector3.new(1,2,1)
- LeftLeg1 = Instance.new("Motor6D")
- LeftLeg1.Parent = Torso
- LeftLeg1.Part0 = Torso
- LeftLeg1.Part1 = LeftLeg
- RightLeg = Instance.new("Part", Humanoid)
- RightLeg.Size = Vector3.new(1,2,1)
- RightLeg1 = Instance.new("Motor6D")
- RightLeg1.Parent = Torso
- RightLeg1.Part0 = Torso
- RightLeg1.Part1 = RightLeg
- Head = Instance.new("Part", Humanoid)
- Head.Size = Vector3.new(1,1,1)
- Neck = Instance.new("Motor6D")
- Neck.Parent = Torso
- Neck.Part0 = Torso
- Neck.Part1 = Head
- RightLeg.Position = Vector3.new(0.5,0,0)
- LeftLeg.Position = Vector3.new(-0.5,0,0)
- Torso.Position = Vector3.new(0,2,0)
- HumanoidRootPart.Position = Vector3.new(0,2,0)
- Head.Position = Vector3.new(0,3.5,0)
- RightArm.Position = Vector3.new(1.5,2,0)
- LeftArm.Position = Vector3.new(-1.5,2,0)
- HumanoidRootPart1 = Instance.new("Weld")
- HumanoidRootPart1.Parent = HumanoidRootPart
- HumanoidRootPart1.Part0 = HumanoidRootPart
- HumanoidRootPart1.Part1 = Torso
- HumanoidRootPart1.part1 = Torso
- HumanoidRootPart.Name = "HumanoidRootPart"
- Humanoid.PrimaryPart = owner.Character.HumanoidRootPart
- part1 = HumanoidRootPart
- local bg = Instance.new("BodyGyro",part1)
- bg.D = 100
- bg.P = 100000
- bg.MaxTorque = Vector3.new(1000000,1000000,1000000)
- local velocitylol = Instance.new("BodyVelocity", part1)
- coroutine.wrap(function()
- while true do
- task.wait()
- velocitylol.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- velocitylol.Velocity = part1.CFrame.LookVector * -32
- end
- end)()
- function move(target)
- local dir = (part1.Position - target.Position).unit
- local spawnPos = part1.Position
- local pos = spawnPos + (dir * 1)
- bg.cframe = CFrame.new(pos, pos + dir)
- end
- function findNearestTorso(pos)
- local list = game.Workspace:GetChildren()
- local torso = nil
- local dist = 1000
- 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("Head")
- 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
- local torso = findNearestTorso(part1.Position)
- if torso~=nil then
- move(torso)
- end
- task.wait()
- end
Add Comment
Please, Sign In to add comment