Advertisement
Guest User

Script PNJ

a guest
Oct 17th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.59 KB | None | 0 0
  1. local humanoid = script.Parent.Humanoid
  2. local torso = script.Parent.HumanoidRootPart
  3. local ps = game:GetServicePath(PathWaypoint)
  4.  
  5. while true do
  6. local path = ps:CreatePath({AgentHeight = 1, AgentRadius = 1})
  7.  
  8. wait(math.random(2,3.5))
  9. end
  10. local humanoid = script.Parent.Humanoid
  11. local torso = script.Parent.HumanoidRootPart
  12. local ps = game:GetService("PathfindingService")
  13.  
  14. while true do
  15. local pos = torso.CFrame.Position + Vector3.new(math.random(-50,50),0,math.random(-50,50))
  16. local path = ps:CreatePath({AgentHeight = 1, AgentRadius = 1})
  17. local comp = path:ComputeAsync(torso.CFrame.Position, pos)
  18.  
  19. wait(math.random(2,3.5))
  20. end
  21.  
  22. local humanoid = script.Parent.Humanoid
  23. local torso = script.Parent.HumanoidRootPart
  24. local ps = game:GetService("PathfindingService")
  25.  
  26. while true do
  27. local pos = torso.CFrame.Position + Vector3.new(math.random(-50,50),0,math.random(-50,50))
  28. local path = ps:CreatePath({AgentHeight = 1, AgentRadius = 1})
  29. local comp = path:ComputeAsync(torso.CFrame.Position, pos)
  30.  
  31. if path.Status == Enum.PathStatus.Succes then
  32. local waypoints = path:GetWaypoints()
  33.  
  34. for _,point in pairs(waypoints) do
  35. humanoid:MoveTo(point.position)
  36. local part = Instance.new("Part")
  37.  
  38. part.CanCollide = false
  39. part.Locked = true
  40. part.Anchored = true
  41. part.Material = Enum.Material.Neon
  42. part.BrickColor = BrickColor.Red()
  43. part.Size = Vector3.new(1,0.5,1)
  44. part.CFrame = CFrame.new(point.position)
  45. part.Transparency = 0.25
  46. part.Parent = workspace
  47.  
  48. humanoid.MoveToFinished:Wait()
  49.  
  50. part:Destroy()
  51. end
  52. end
  53.  
  54. wait(math.random(2,3.5))
  55. end
  56.  
  57. local humanoid = script.Parent.Humanoid
  58. local torso = script.Parent.HumanoidRootPart
  59. local ps = game:GetService("PathfindingService")
  60.  
  61. math.randomseed(tick(1))
  62.  
  63. while true do
  64. local pos = torso.CFrame.Position + Vector3.new(math.random(-50,50),0,math.random(-50,50))
  65. local path = ps:CreatePath({AgentHeight = 1, AgentRadius = 1})
  66. local comp = path:ComputeAsync(torso.CFrame.Position, pos)
  67.  
  68. if path.Status == Enum.PathStatus.Succes then
  69. local waypoints = path:GetWaypoints()
  70.  
  71. humanoid.Seated:Connect(function(seated)
  72. if seated == true then
  73. print("seated")
  74. humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
  75. end
  76. end)
  77.  
  78. path.Blocked:Connect(function()
  79. print("blocked!")
  80. humanoid:MoveTo(torso.CFrame.Position)
  81. end)
  82.  
  83. for _,point in pairs(waypoints) do
  84. humanoid:MoveTo(point.Position)
  85.  
  86. local part = Instance.new("Part")
  87.  
  88. part.CanCollide = false
  89. part.Locked = true
  90. part.Anchored = true
  91. part.Material = Enum.Material.Neon
  92. part.BrickColor = BrickColor.Red()
  93. part.Size = Vector3.new(point.Position)
  94. part.Transparency = 0.25
  95. part.Parent = workspace
  96.  
  97. if point.Action == Enum.PathWaypointAction.Jump then
  98. print("jumping")
  99. humanoid:ChangeStatus(Enum.HumanoidStateType.Jumping)
  100. end
  101.  
  102. humanoid.MoveToFinished:Wait()
  103.  
  104. part:Destroy()
  105. end
  106. end
  107.  
  108. wait(math.random(2,3.5))
  109. end
  110.  
  111. local ps = game:GetService("PathfindingService")
  112.  
  113. math.randomseed(tick())
  114.  
  115. for _,npc in pairs(workspace.NPCS:GetChildren()) do
  116. spawn(function(thread)
  117. while true do
  118. local humanoid = npc.Humanoid
  119. local torso = npc.HumanoidRootPart
  120. local pos = torso.CFrame.Position + Vector3.new(math.random(-50,50),0,math.random(50,50))
  121. local path = ps:CreatePath({AgentHeight = 1, AgentRadius = 1})
  122. local comp = path:ComputeAsync(torso.CFrame.Position, pos)
  123.  
  124. if path.Status == Enum.PathStatus.Success then
  125. local waypoints = path:GetWaypoints()
  126.  
  127. humanoid.Seated:Connect(function(seated)
  128. if seated == true then
  129. print("seated")
  130. humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
  131. end
  132. end)
  133.  
  134. path.Blocked:Conenct(function()
  135. print("blocked!")
  136. humanoid:MoveTo(torso.CFrame.Position)
  137. end)
  138.  
  139. for _,point in pairs(waypoints) do
  140. humanoid:MoveTo(point.Position)
  141.  
  142. local part = Instance.new("Part")
  143.  
  144. part.CanCollide = false
  145. part.Locked = true
  146. part.Anchored = true
  147. part.Material = Enum.Material.Neon
  148. part.BrickColor = BrickColor.Red()
  149. part.Size = Vector3.new(1,0.5,1)
  150. part.CFrame = CFrame.new(point.Position)
  151. part.Transparency = 0.25
  152. part.Parent = workspace
  153.  
  154. if point.Action == Enum.PathWaypointAction.Jump then
  155. print("jumping")
  156. humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
  157. end
  158.  
  159. humanoid.MoveToFinished:Wait()
  160.  
  161. part:Destroy()
  162. end
  163. end
  164.  
  165. wait(math.random(2,3.5))
  166. end
  167. end)
  168. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement