Advertisement
Sungmingamerpro13

MainScript

Sep 24th, 2021 (edited)
552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 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. ImageValue = game.ReplicatedStorage.Message.SpeakerImage
  15. SpeakerNameValue = game.ReplicatedStorage.Message.SpeakerName
  16.  
  17. -- Setup Player Images
  18.  
  19. local RandomPlayer
  20.  
  21. PlayerImages = {}
  22.  
  23.  
  24. function MakePlayerImage(Player)
  25. local Image = ''
  26. local Success,Error = pcall(function()
  27. local ID = PlayerService:GetUserIdFromNameAsync(Player.Name)or ''
  28. local PlayerImage, IsReady = PlayerService:GetUserThumbnailAsync(ID, Enum.ThumbnailType.AvatarBust, Enum.ThumbnailSize.Size420x420)
  29. if IsReady == true then
  30. -- Ready to use image
  31. Image = tostring(PlayerImage)
  32. else
  33. -- Use alternative picture
  34. Image = ("http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username=%s"):format(Player.Name)
  35. end
  36. end)
  37. if Success == true then
  38. -- Successful
  39. else
  40. Image = ("http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username=%s"):format(Player.Name)
  41. end
  42. PlayerImages[Player.Name] = Image
  43. end
  44.  
  45.  
  46. game.Players.PlayerAdded:Connect(function(Player)
  47. MakePlayerImage(Player)
  48. end)
  49. for _, Player in pairs(game.Players:GetChildren()) do
  50. MakePlayerImage(Player) -- This is cause dosent rly activate PlayerAdded event on play testing
  51. end
  52.  
  53.  
  54.  
  55. -- Functions
  56.  
  57.  
  58. function BroadcastMessage(Text, MessageDelayTime)
  59. -- This makes the message appear like a typewriter
  60. for i = 1,#Text,1 do
  61. MessageValue.Value = string.sub(Text,1,i)
  62. for _, L in pairs(MessageWaitSigns) do
  63. if string.sub(Text,i,i) == L then
  64. wait(MessageWaitSignDelay)
  65. end
  66. end
  67. wait(LetterInvertal)
  68. end
  69. if tonumber(MessageDelayTime) ~= nil then
  70. wait(MessageDelayTime)
  71. else
  72. wait(DefaultMessageDelayTime)
  73. end
  74. MessageValue.Value = 'None'
  75. return true
  76. end
  77.  
  78.  
  79.  
  80. function SetMessageSpeaker(Name)
  81. if Name == 'Random' then
  82. RandomPlayer = game.Players:GetChildren()[math.random(1,#game.Players:GetChildren())]
  83. Name = RandomPlayer.Name
  84. end
  85. ImageValue.Value = PlayerImages[Name] or 'rbxassetid://0'
  86. SpeakerNameValue.Value = Name
  87. end
  88.  
  89. function ChangeTime(ToTime, TweenDuration)
  90. local Lightning = game.Lighting
  91. local TI = TweenInfo.new(TweenDuration,Enum.EasingStyle.Linear)
  92. local Tween = TweenService:Create(Lightning, TI, {ClockTime = ToTime})
  93. Tween:Play()
  94. end
  95.  
  96. function ChangeFogend(ChangeTo, TweenDuration,ColourOrNone)
  97. if ColourOrNone ~= 'None' then
  98. game.Lighting.FogColor = ColourOrNone
  99. end
  100. local FogendValue = Instance.new('IntValue')
  101. FogendValue.Value = game.Lighting.FogEnd
  102. FogendValue:GetPropertyChangedSignal('Value'):Connect(function()
  103. game.Lighting.FogEnd = FogendValue.Value
  104. end)
  105. local TI = TweenInfo.new(TweenDuration,Enum.EasingStyle.Linear)
  106. local Tween = TweenService:Create(FogendValue, TI, {Value = ChangeTo})
  107. Tween:Play()
  108. spawn(function()
  109. Tween.Completed:Connect(function()
  110. FogendValue:Destroy()
  111. end)
  112. end)
  113. end
  114.  
  115. function teleportPlayers(partCFrame)
  116. local players = game.Players:getPlayers()
  117. for _,player in pairs(players) do
  118. if player.Character then
  119. if player.Character.HumanoidRootPart.Anchored == false then
  120. player.Character.Humanoid.Jump = true
  121. end
  122. end
  123. end
  124. wait(.5)
  125. for _,player in pairs(players) do
  126. if player.Character then
  127. if player.Character.HumanoidRootPart.Anchored == false then
  128. player.Character:SetPrimaryPartCFrame(partCFrame)
  129. end
  130. end
  131. end
  132. end
  133.  
  134. ------------------------ MAIN SCRIPT OF STORY -------------------------------------
  135.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement