Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- Sungmingamerpro13
- -- Services
- PlayerService = game:GetService('Players')
- TweenService = game:GetService('TweenService')
- -- Variables
- DefaultMessageDelayTime = 4
- LetterInvertal = 0.05
- MessageWaitSigns = {',', '?', '.'}
- MessageWaitSignDelay = 1
- MessageValue = game.ReplicatedStorage.Message
- SpeakerValue = game.ReplicatedStorage.Message.Speaker
- HideDialogueEvent = game.ReplicatedStorage.Message.HideDialogueEvent
- -- randomPlayer or NPC
- local randomPlayer
- -- Functions
- function BroadCastMessage(Text, MessageDelayTime)
- for i = 1,#Text,1 do
- MessageValue.Value = string.sub(Text,1,i)
- for _, L in pairs(MessageWaitSigns) do
- if string.sub(Text,i,i) == L then
- wait(MessageWaitSignDelay)
- end
- end
- wait(LetterInvertal)
- end
- if tonumber(MessageDelayTime) ~= nil then
- wait(MessageDelayTime)
- else
- wait(DefaultMessageDelayTime)
- end
- end
- function HideCastMessage()
- HideDialogueEvent:FireAllClients()
- end
- function SetMessageSpeaker(Name, Model)
- if Name == randomPlayer then
- randomPlayer = game.Players:GetChildren()[math.random(1,#game.Players:GetChildren())]
- Name = randomPlayer.Name
- end
- SpeakerValue.Value = Name or Model
- end
- ---- MainScript ----
- wait(10)
- SetMessageSpeaker(randomPlayer)
- BroadCastMessage("Hello, World")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement