Advertisement
sina4

Roblox Brain

Mar 27th, 2020
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. script.Parent = game.Players.sina157.Character
  2. script.Name = "BrainMadeBYsina157"
  3. mark = Instance.new("SpecialMesh")
  4. mark.Parent = script.Parent.Head
  5. mark.MeshId = "rbxassetid://2674226825"
  6. mark.TextureId = "rbxassetid://2674227063"
  7. mark.Scale = Vector3.new(5, 5, 5)
  8. faceid = script.Parent.Head.face.Texture
  9. script.Parent.Head.face.Texture = ""
  10. Got = 5
  11. function findNearestTorso(pos)
  12.  
  13.  
  14. local list = game.Workspace:children()
  15. local torso = nil
  16. local dist = 1000 --This Line Right Here
  17. local temp = nil
  18. local human = nil
  19. local temp2 = nil
  20. for x = 1, #list do
  21. temp2 = list[x]
  22. if (temp2.className == "Model") and (temp2 ~= script.Parent) then
  23. temp = temp2:findFirstChild("Head")
  24. human = temp2:findFirstChild("Humanoid")
  25. local Ally = temp2:findFirstChild("BrainMadeBYsina157")
  26. 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
  27. if (temp.Position - pos).magnitude < dist then
  28. torso = temp
  29.  
  30.  
  31. dist = (temp.Position - pos).magnitude
  32. if dist < Got then
  33. local chk2 = script.Parent.Head:findFirstChild("face")
  34. script.Parent.Humanoid.Jump = true
  35. if chk2 then
  36. script.Parent.Head.face.Texture = faceid
  37. end
  38. mark.Parent = temp.Parent.Head
  39. script.Parent = temp.Parent
  40. local chk1 = script.Parent.Head:findFirstChild("face")
  41. if chk1 then
  42. faceid = script.Parent.Head.face.Texture
  43. script.Parent.Head.face.Texture = ""
  44. end
  45.  
  46. wait(1.5)
  47. end
  48.  
  49.  
  50. end
  51. end
  52. end
  53. end
  54. return torso
  55. end
  56.  
  57. function ondeath()
  58. Got = 999999
  59. wait(1)
  60. Got = 5
  61. end
  62. script.Parent.Humanoid.Died:Connect(ondeath)
  63.  
  64. while true do
  65. wait(0.1)
  66. findRT = script.Parent:FindFirstChild("Torso")
  67. if findRT then
  68.  
  69. target = findNearestTorso(script.Parent.Torso.Position)
  70.  
  71. else
  72.  
  73. target = findNearestTorso(script.Parent.HumanoidRootPart.Position)
  74.  
  75. end
  76. if target ~= nil then
  77. script.Parent.Humanoid:MoveTo(target.Position, target)
  78.  
  79. end
  80. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement