CCCPaste

DialogueScript (LocalScript)

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Message = game.ReplicatedStorage:WaitForChild("Message")
local Image = Message:WaitForChild("SpeakerImage")
local Speaker = Message:WaitForChild("SpeakerName")

local player = game.Players.LocalPlayer
local DialogueFrame = player.PlayerGui:WaitForChild("DialogueGui").DialogueFrame


Message:GetPropertyChangedSignal("Value"):Connect(function()
	if Message.Value == "None" then
		DialogueFrame.Message.Visible = false
		DialogueFrame:TweenPosition(UDim2.new(0.55, 0,-1, 0), Enum.EasingDirection.In, Enum.EasingStyle.Quad, 1)
	else
		DialogueFrame.Message.Visible = true
		DialogueFrame:TweenPosition(UDim2.new(0.55, 0,0.15, 0), Enum.EasingDirection.In, Enum.EasingStyle.Quad, 1)
	end
	DialogueFrame.Message.Text = Message.Value
	script.Click:Play()
end)

Speaker:GetPropertyChangedSignal("Value"):Connect(function()
	print("New Speaker: "..Speaker.Value)
	
	DialogueFrame.ImageLabel.Image = Image.Value
	DialogueFrame.nameLabel.Text = Speaker.Value
end)