Advertisement
Sungmingamerpro13

New MainScript (SungExetior13RBLX Style)

Jul 14th, 2024
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.28 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. HideDialogueEvent = game.ReplicatedStorage.Message.HideDialogueEvent
  16.  
  17. -- randomPlayer or NPC
  18.  
  19. local randomPlayer
  20.  
  21. -- Functions
  22.  
  23. function BroadCastMessage(Text, MessageDelayTime)
  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. end
  39.  
  40. function HideCastMessage()
  41.     HideDialogueEvent:FireAllClients()
  42. end
  43.  
  44. function SetMessageSpeaker(Name, Model)
  45.     if Name == randomPlayer then
  46.         randomPlayer = game.Players:GetChildren()[math.random(1,#game.Players:GetChildren())]
  47.         Name = randomPlayer.Name
  48.     end
  49.     SpeakerValue.Value = Name or Model
  50. end
  51.  
  52. ---- MainScript ----
  53.  
  54. wait(10)
  55.  
  56. SetMessageSpeaker(randomPlayer)
  57.  
  58. BroadCastMessage("Hello, World")
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement