Advertisement
Sungmingamerpro13

DialogueScript 2

Aug 16th, 2022
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. local StarterGui = game:GetService("StarterGui")
  2.  
  3. local player = game.Players.LocalPlayer
  4. local BroadCastedMessage = game.ReplicatedStorage.DialogueRemotes:WaitForChild("BroadCastMessage")
  5. local SetMessageSpeaker = game.ReplicatedStorage.DialogueRemotes:WaitForChild("SetMessageSpeaker")
  6. local HideDialogueEvent = game.ReplicatedStorage.DialogueRemotes:WaitForChild("HideMessageSpeaker")
  7.  
  8. local DialogueFrame = player.PlayerGui.DialogueGui.DialogueFrame
  9. local TextFrame = script.Parent.DialogueFrame.TextFrame
  10.  
  11. local RichText = require(game.ReplicatedStorage.Modules:WaitForChild("RichText"))
  12.  
  13. HideDialogueEvent.OnClientEvent:Connect(function()
  14.  
  15. StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
  16.  
  17. DialogueFrame.Visible = false
  18. end)
  19.  
  20. BroadCastedMessage.OnClientEvent:Connect(function(english,spanish) -- activates when called from the Server
  21. if not player:findFirstChild("secretEnding") then
  22. if DialogueFrame.Visible == true then
  23.  
  24. StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
  25.  
  26. DialogueFrame.Visible = true
  27.  
  28. end
  29. local ln = game:GetService("LocalizationService").RobloxLocaleId
  30. local content = english
  31. if ln == "en-us" then
  32. content = english
  33. elseif ln == "es-es" then
  34. if spanish then
  35. content = spanish
  36. end
  37. end
  38. local TextFrame = RichText:New(TextFrame, content)
  39. TextFrame:Animate(true)
  40. DialogueFrame.Visible = true
  41. script.Click:Play()
  42. end
  43. end)
  44.  
  45. SetMessageSpeaker.OnClientEvent:Connect(function(name, image_id)
  46. if not player:findFirstChild("secretEnding") then
  47. DialogueFrame.ImageLabel.Image = image_id
  48. DialogueFrame.nameLabel.Text = name
  49. end
  50. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement