Advertisement
Sungmingamerpro13

New TeleportScript Monster

Jan 18th, 2023
1,568
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.82 KB | Source Code | 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.     for i = 10,0,-1 do
  17.         print(i)
  18.         wait(1)
  19.     end
  20.     for _, Player in pairs(game.Players:GetPlayers()) do
  21.         if Player.Character and Player.Character.Humanoid.Health > 0 then
  22.  
  23.         end
  24.     end
  25.     local Fire = TutorialMonster.TeleportSpirit.Fire:Clone()
  26.     Fire.Parent =NewTarget.HumanoidRootPart
  27.     Fire.Enabled = true
  28.     TutorialMonster.TeleportSpirit.Fire.Enabled = true
  29.     wait(2)
  30.     TutorialMonster.HumanoidRootPart.CFrame = NewTarget.HumanoidRootPart.CFrame - Vector3.new(0,0,20)
  31.     wait(2)
  32.     TutorialMonster.TeleportSpirit.Fire.Enabled = false
  33.     local function Track()
  34.         while TrackingStatus do
  35.             if not TrackingStatus then break end
  36.             if NewTarget.Humanoid.Health == 0 then break end
  37.             Humanoid:MoveTo(NewTarget.HumanoidRootPart.Position)
  38.             wait()
  39.             Fire:Destroy()
  40.  
  41.  
  42.         end
  43.     end
  44.     coroutine.resume(coroutine.create(Track))
  45. end
  46.  
  47. while true do
  48.     while #PlayerService:GetPlayers() == 0 do wait() end
  49.     local NewTarget = ChoosePlayer()
  50.     local Character = NewTarget.Character
  51.  
  52.  
  53.     if Character then
  54.         if Character.Humanoid.Health > 0 then
  55.             TrackingStatus = true
  56.             TrackNewPlayer(Character)
  57.             game.ReplicatedStorage.Jumpscare:FireAllClients(true)
  58.             wait(5)
  59.             game.ReplicatedStorage.Jumpscare:FireAllClients(false)
  60.             TrackingStatus = false
  61.         end
  62.     end
  63.     wait()
  64. end
Tags: Roblox
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement