CCCPaste

DialogueScript 2

local StarterGui = game:GetService("StarterGui")

local player = game.Players.LocalPlayer
local BroadCastedMessage = game.ReplicatedStorage.DialogueRemotes:WaitForChild("BroadCastMessage")
local SetMessageSpeaker = game.ReplicatedStorage.DialogueRemotes:WaitForChild("SetMessageSpeaker")
local HideDialogueEvent = game.ReplicatedStorage.DialogueRemotes:WaitForChild("HideMessageSpeaker")

local DialogueFrame = player.PlayerGui.DialogueGui.DialogueFrame
local TextFrame = script.Parent.DialogueFrame.TextFrame

local RichText = require(game.ReplicatedStorage.Modules:WaitForChild("RichText"))

HideDialogueEvent.OnClientEvent:Connect(function()

StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)

DialogueFrame.Visible = false
end)

BroadCastedMessage.OnClientEvent:Connect(function(english,spanish) -- activates when called from the Server
if not player:findFirstChild("secretEnding") then
if DialogueFrame.Visible == true then

StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)

DialogueFrame.Visible = true

end
local ln = game:GetService("LocalizationService").RobloxLocaleId
local content = english
if ln == "en-us" then
content = english
elseif ln == "es-es" then
if spanish then
content = spanish
end
end
local TextFrame = RichText:New(TextFrame, content)
TextFrame:Animate(true)
DialogueFrame.Visible = true
script.Click:Play()
end
end)

SetMessageSpeaker.OnClientEvent:Connect(function(name, image_id)
if not player:findFirstChild("secretEnding") then
DialogueFrame.ImageLabel.Image = image_id
DialogueFrame.nameLabel.Text = name
end
end)