Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script.Parent = game.Players.sina157.Character
- script.Name = "BrainMadeBYsina157"
- mark = Instance.new("SpecialMesh")
- mark.Parent = script.Parent.Head
- mark.MeshId = "rbxassetid://2674226825"
- mark.TextureId = "rbxassetid://2674227063"
- mark.Scale = Vector3.new(5, 5, 5)
- faceid = script.Parent.Head.face.Texture
- script.Parent.Head.face.Texture = ""
- Got = 5
- function findNearestTorso(pos)
- local list = game.Workspace:children()
- local torso = nil
- local dist = 1000 --This Line Right Here
- 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")
- local Ally = temp2:findFirstChild("BrainMadeBYsina157")
- if (temp ~= nil) and (human ~= nil) and (human.Health > 0) and (Ally == nil) or (temp ~= nil) and (human ~= nil) and (human.Health > 0) and ( not Ally) then
- if (temp.Position - pos).magnitude < dist then
- torso = temp
- dist = (temp.Position - pos).magnitude
- if dist < Got then
- local chk2 = script.Parent.Head:findFirstChild("face")
- script.Parent.Humanoid.Jump = true
- if chk2 then
- script.Parent.Head.face.Texture = faceid
- end
- mark.Parent = temp.Parent.Head
- script.Parent = temp.Parent
- local chk1 = script.Parent.Head:findFirstChild("face")
- if chk1 then
- faceid = script.Parent.Head.face.Texture
- script.Parent.Head.face.Texture = ""
- end
- wait(1.5)
- end
- end
- end
- end
- end
- return torso
- end
- function ondeath()
- Got = 999999
- wait(1)
- Got = 5
- end
- script.Parent.Humanoid.Died:Connect(ondeath)
- while true do
- wait(0.1)
- findRT = script.Parent:FindFirstChild("Torso")
- if findRT then
- target = findNearestTorso(script.Parent.Torso.Position)
- else
- target = findNearestTorso(script.Parent.HumanoidRootPart.Position)
- end
- if target ~= nil then
- script.Parent.Humanoid:MoveTo(target.Position, target)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement