Advertisement
Sungmingamerpro13

MainScript v2

Apr 15th, 2024
2,868
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 3.20 KB | None | 0 0
  1. --- Sungmingamerpro13
  2.  
  3. -- Services
  4. PlayerService = game:GetService('Players')
  5. TweenService = game:GetService('TweenService')
  6.  
  7. -- Variables
  8. DefaultMessageDelayTime = 4
  9. LetterInvertal = 0.05
  10. MessageWaitSigns = {',', '?', '.'}
  11. MessageWaitSignDelay = 1
  12.  
  13. MessageValue = game.ReplicatedStorage.Message
  14. SpeakerValue = game.ReplicatedStorage.Message.Speaker
  15.  
  16. -- randomPlayer or NPC
  17.  
  18. local randomPlayer
  19.  
  20. -- Functions
  21.  
  22. function BroadcastMessage(Text, MessageDelayTime)
  23.     -- This makes the message appear like a typewriter
  24.     for i = 1,#Text,1 do
  25.         MessageValue.Value = string.sub(Text,1,i)
  26.         for _, L in pairs(MessageWaitSigns) do
  27.             if string.sub(Text,i,i) == L then
  28.                 wait(MessageWaitSignDelay)
  29.             end
  30.         end
  31.         wait(LetterInvertal)
  32.     end
  33.     if tonumber(MessageDelayTime) ~= nil then
  34.         wait(MessageDelayTime)
  35.     else
  36.         wait(DefaultMessageDelayTime)
  37.     end
  38.     MessageValue.Value = 'None'
  39.     return true
  40. end
  41.  
  42. function SetMessageSpeaker(Name, Model)
  43.     if Name == randomPlayer then
  44.         randomPlayer = game.Players:GetChildren()[math.random(1,#game.Players:GetChildren())]
  45.         Name = randomPlayer.Name
  46.     end
  47.     SpeakerValue.Value = Name or Model
  48. end
  49.  
  50. function ChangeTime(ToTime, TweenDuration)
  51.     local Lightning = game.Lighting
  52.     local TI = TweenInfo.new(TweenDuration,Enum.EasingStyle.Linear)
  53.     local Tween = TweenService:Create(Lightning, TI, {ClockTime = ToTime})
  54.     Tween:Play()
  55. end
  56.  
  57. function ChangeFogend(ChangeTo, TweenDuration,ColourOrNone)
  58.     if ColourOrNone ~= 'None' then
  59.         game.Lighting.FogColor = ColourOrNone
  60.     end
  61.     local FogendValue = Instance.new('IntValue')
  62.     FogendValue.Value = game.Lighting.FogEnd
  63.     FogendValue:GetPropertyChangedSignal('Value'):Connect(function()
  64.         game.Lighting.FogEnd = FogendValue.Value
  65.     end)
  66.     local TI = TweenInfo.new(TweenDuration,Enum.EasingStyle.Linear)
  67.     local Tween = TweenService:Create(FogendValue, TI, {Value = ChangeTo})
  68.     Tween:Play()
  69.     spawn(function()
  70.         Tween.Completed:Connect(function()
  71.             FogendValue:Destroy()
  72.         end)
  73.     end)
  74. end
  75.  
  76. function teleportPlayers(partCFrame)
  77.     local players = game.Players:getPlayers()
  78.     for _,player in pairs(players) do
  79.         if player.Character then
  80.             if player.Character.HumanoidRootPart.Anchored == false then
  81.                 player.Character.Humanoid.Jump = true
  82.             end
  83.         end
  84.     end
  85.     wait(.5)
  86.     for _,player in pairs(players) do
  87.         if player.Character then
  88.             if player.Character.HumanoidRootPart.Anchored == false then
  89.                 player.Character:SetPrimaryPartCFrame(partCFrame)
  90.             end
  91.         end
  92.     end
  93. end
  94.  
  95. function TransitionScreen()
  96.     for _, player in pairs(game.Players:GetChildren()) do
  97.         spawn(function()
  98.             local NewGui = game.ServerStorage.Assets.TransitionScreen:Clone()
  99.             NewGui.Parent = player.PlayerGui
  100.         end)
  101.     end
  102. end
  103.  
  104. function ObjectiveSystem(Text)
  105.     game.ReplicatedStorage.ObjectiveEvent:FireAllClients(Text)
  106. end
  107.  
  108. function Timer(Time)
  109.     for i = Time, 0, -1 do
  110.         game.ReplicatedStorage.TopText.Value = i
  111.         wait(1)
  112.     end
  113.     game.ReplicatedStorage.TopText.Value = "None"
  114. end
  115.  
  116. function MoveNPC(Location, NPCName)
  117.     local NPC = workspace[NPCName]
  118.     NPC.Humanoid:MoveTo(Location.Position)
  119.     NPC.Humanoid.MoveToFinished:Wait()
  120. end
  121.  
  122. function FaceNPC(NPCName, faceID)
  123.     local NPC = workspace[NPCName]
  124.     NPC.Head.face.Texture = "rbxassetid://"..faceID
  125. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement