Advertisement
Sungmingamerpro13

DialogueScript (Ponchokings Style)

Mar 31st, 2024
1,038
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.26 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. local CreateDialogueEvent = game.ReplicatedStorage.CreateDialogueEvent
  3. local DialogueFrame = player.PlayerGui.DialogueGui.DialogueFrame
  4.  
  5. local function playSound(sound_id) -- Plays typing sound
  6.     local sound = Instance.new("Sound",game.ReplicatedStorage)
  7.     sound.SoundId = sound_id
  8.     sound.Volume = .1
  9.     sound.PlayOnRemove = true
  10.     sound:Destroy()
  11. end
  12.  
  13. local function textAnimate(content) -- Animates each letter
  14.     for i=1,string.len(content) do
  15.         DialogueFrame.TextLabel.Text = string.sub(content,1,i)
  16.         playSound("rbxassetid://915576050")
  17.         if string.sub(content,i,i) == "!" or string.sub(content,i,i) == "." or string.sub(content,i,i) == "?" then
  18.             wait(1)
  19.         elseif     string.sub(content,i,i) == "," then
  20.             wait(.5)
  21.         else
  22.             wait(.05)
  23.         end
  24.     end
  25. end
  26.  
  27. CreateDialogueEvent.OnClientEvent:Connect(function(name, image_id, content) -- activates when called from the Server
  28.     if not player:findFirstChild("secretEnding") then
  29.         DialogueFrame.nameLabel.Text = name
  30.         DialogueFrame.ImageLabel.Image = image_id
  31.         DialogueFrame.TextLabel.Text = ""
  32.         DialogueFrame.Visible = true
  33.         textAnimate(content)
  34.     end
  35. end)
Tags: Roblox
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement