M3dz

Untitled

Jan 4th, 2023
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | Source Code | 0 0
  1. local CurrentPart = nil
  2. local MaxInc = 16
  3.  
  4. function onTouched(hit)
  5. if hit.Parent == nil then
  6. return
  7. end
  8.  
  9. local humanoid = hit.Parent:findFirstChild("Humanoid")
  10.  
  11. if humanoid == nil then
  12. CurrentPart = hit
  13. end
  14. end
  15.  
  16. function waitForChild(parent, childName)
  17. local child = parent:findFirstChild(childName)
  18.  
  19. if child then
  20. return child
  21. end
  22.  
  23. while true do
  24. print(childName)
  25.  
  26. child = parent.ChildAdded:wait()
  27.  
  28. if child.Name==childName then
  29. return child
  30. end
  31. end
  32. end
  33.  
  34. local Figure = script.Parent
  35. local Humanoid = waitForChild(Figure, "Humanoid")
  36. local Torso = waitForChild(Figure, "Torso")
  37. local Left = waitForChild(Figure, "Left Leg")
  38. local Right = waitForChild(Figure, "Right Leg")
  39.  
  40. Humanoid.Jump = true
  41.  
  42. Left.Touched:connect(onTouched)
  43. Right.Touched:connect(onTouched)
  44.  
  45. while true do
  46. wait(math.random(2, 6))
  47.  
  48. if CurrentPart ~= nil then
  49. if math.random(1, 2) == 1 then
  50. Humanoid.Jump = true
  51. end
  52.  
  53. Humanoid:MoveTo(Torso.Position + Vector3.new(math.random(-MaxInc, MaxInc), 0, math.random(-MaxInc, MaxInc)), CurrentPart)
  54. end
  55. end
Add Comment
Please, Sign In to add comment