Advertisement
Sungmingamerpro13

TeleportScript Monster

Sep 1st, 2022
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. local TutorialMonster = script.Parent
  2. local Humanoid = TutorialMonster.Humanoid
  3. local PlayerService = game:GetService("Players")
  4.  
  5.  
  6.  
  7.  
  8. local TrackingStatus = false
  9.  
  10. local function ChoosePlayer()
  11. print("NewChoosePlayer")
  12. return PlayerService:GetPlayers()[math.random(1, #PlayerService:GetPlayers())]
  13. end
  14.  
  15. local function TrackNewPlayer(NewTarget)
  16.  
  17. for _, Player in pairs(game.Players:GetPlayers()) do
  18. if Player.Character and Player.Character.Humanoid.Health > 0 then
  19.  
  20. end
  21. end
  22. local Fire = TutorialMonster.TeleportSpirit.Fire:Clone()
  23. Fire.Parent =NewTarget.HumanoidRootPart
  24. Fire.Enabled = true
  25. TutorialMonster.TeleportSpirit.Fire.Enabled = true
  26. wait(2)
  27. TutorialMonster.HumanoidRootPart.CFrame = NewTarget.HumanoidRootPart.CFrame - Vector3.new(0,0,20)
  28. wait(2)
  29. TutorialMonster.TeleportSpirit.Fire.Enabled = false
  30. local function Track()
  31. while TrackingStatus do
  32. if not TrackingStatus then break end
  33. if NewTarget.Humanoid.Health == 0 then break end
  34. Humanoid:MoveTo(NewTarget.HumanoidRootPart.Position)
  35. wait()
  36. Fire:Destroy()
  37.  
  38.  
  39. end
  40. end
  41. coroutine.resume(coroutine.create(Track))
  42. end
  43.  
  44. while true do
  45. while #PlayerService:GetPlayers() == 0 do wait() end
  46. local NewTarget = ChoosePlayer()
  47. local Character = NewTarget.Character
  48.  
  49.  
  50. if Character then
  51. if Character.Humanoid.Health > 0 then
  52.  
  53. TrackingStatus = true
  54. TrackNewPlayer(Character)
  55. game.ReplicatedStorage.Jumpscare:FireAllClients(true)
  56. wait(3)
  57. game.ReplicatedStorage.Jumpscare:FireAllClients(false)
  58. wait(15)
  59. TrackingStatus = false
  60. end
  61. end
  62. wait()
  63. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement