Advertisement
Sungmingamerpro13

MainScript NEW

May 20th, 2024
615
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 3.34 KB | None | 0 0
  1. -- Phantom
  2. -- If you named your things the same as in the video then you don't have to rename things.
  3.  
  4. local StarterGui = game:GetService("StarterGui")
  5. local Players = game:GetService("Players")
  6. -- No need to touch above
  7.  
  8. -- You inserted these in ReplicatedStorage
  9. local FrameVisible = game.ReplicatedStorage:FindFirstChild("FrameVisible") -- BoolValue
  10. local PlayerImage = game.ReplicatedStorage:FindFirstChild("PlayerImage") -- RemoteEvent
  11. local PlayerName = game.ReplicatedStorage:FindFirstChild("PlayerName") -- StringValue
  12. local NPCImage = game.ReplicatedStorage:FindFirstChild("NPCImage")
  13. local Text = game.ReplicatedStorage:FindFirstChild("Text") -- StringValue
  14.  
  15. local NPC = game.Workspace:FindFirstChild("NPC")
  16.  
  17. local Teleports = game.Workspace:FindFirstChild("Teleports")
  18. local Sounds = game.Workspace:FindFirstChild("Sounds")
  19. local Checkpoints = game.Workspace:FindFirstChild("Checkpoints")
  20.  
  21. -- Blank variables, do not touch
  22. local RandomPlayer
  23. local Message
  24.  
  25. function TypeSound()
  26.    local Sound = Instance.new("Sound")
  27.    Sound.Parent = game.Workspace
  28.    Sound.Name = "TypeSound"
  29.    Sound.SoundId = "http://www.roblox.com/asset/?id=3333976425" -- You can change the typing sound if you like
  30.    Sound.PlaybackSpeed = 1
  31.    Sound.Volume = 0.5
  32.    Sound:Play()
  33.    coroutine.resume(coroutine.create(function()
  34.        wait(1)
  35.        Sound:Destroy()
  36.    end))
  37. end
  38.  
  39. function SetText(word)
  40.    Message = word
  41.    for i = 1, #Message do
  42.        Text.Value = string.sub(Message, 1, i)
  43.        TypeSound()
  44.        wait(0.05) -- Time between each letter, 0.05 seconds is recommended. The smaller the faster.
  45.    end
  46. end
  47.  
  48. function SetNPCText(word)
  49.    Message = word
  50.    for i = 1, #Message do
  51.         Text.Value = string.sub(Message, 1, i)
  52.         NPCImage:FireAllClients(NPCImage)
  53.         PlayerName.Value = "Jeff" -- Put whatever you like here
  54.        TypeSound()
  55.        wait(0.05) -- Time between each letter, 0.05 seconds is recommended. The smaller the faster.
  56.    end
  57. end
  58.  
  59. function SetRandomPlayerText(word)
  60.    Message = word
  61.    RandomPlayer = nil
  62.    wait()
  63.    RandomPlayer = Players:GetChildren()[math.random(1, #Players:GetChildren())]
  64.    PlayerName.Value = RandomPlayer.Name -- Sets the PlayerName to a random player's name
  65.     PlayerImage:FireAllClients(RandomPlayer) -- Sets the image to a random player's head
  66.    for i = 1, #Message do
  67.        Text.Value = string.sub(Message, 1, i)
  68.        TypeSound() -- Plays the typing sound
  69.        wait(0.05)
  70.    end
  71. end
  72.  
  73. wait(10)
  74. FrameVisible.Value = true
  75. SetNPCText("Hello and welcome to the Camping Site!")
  76. wait(5)
  77. SetText("You will be staying here for a few nights!")
  78. wait(5)
  79. SetRandomPlayerText("Yay!")
  80. wait(5)
  81. SetNPCText("Go take a look inside that house over there.")
  82. wait(2)
  83. NPC.Humanoid:moveTo(Checkpoints.Checkpoint1.Position)
  84. NPC.Humanoid.MoveToFinished:Wait()
  85. for i, v in pairs(Players:GetChildren()) do
  86.     v.Character.Torso.CFrame = Teleports.HouseTeleport.CFrame
  87. end
  88. wait(3)
  89. SetRandomPlayerText("Looks cozy!")
  90. wait(5)
  91. SetNPCText("Ok everyone, time to go outside.")
  92. wait(5)
  93. NPC.Humanoid:moveTo(Checkpoints.Checkpoint2.Position)
  94. NPC.Humanoid.MoveToFinished:Wait()
  95. wait(0.2)
  96. NPC.Humanoid:moveTo(Checkpoints.Checkpoint3.Position)
  97. NPC.Humanoid.MoveToFinished:Wait()
  98. for i, v in pairs(Players:GetChildren()) do
  99.     v.Character.Torso.CFrame = Teleports.PathTeleport.CFrame
  100. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement