CCCPaste

DialogueScript

local camera = Instance.new("Camera", script.Parent)
local Message = game.ReplicatedStorage:WaitForChild("Message")
local Speaker = Message:WaitForChild("Speaker")

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

function UpdaterCharacter(character)
	for i, v in pairs(DialogueFrame.Icon.Character:GetDescendants()) do
		v:Destroy()
	end
	for i, v in pairs(character:GetChildren()) do
		if v:IsA("BasePart") or v:IsA("Accessory") or v:IsA("Shirt") or v:IsA("Pants") or v:IsA("ShirtGraphic") or v:IsA("BodyColors") or v:IsA("Humanoid") then
			local new = v:Clone()
			new.Parent = DialogueFrame.Icon.Character
			if v:IsA("Humanoid") then
				new.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
			end
		end
	end
	DialogueFrame.Icon.CurrentCamera = camera
	camera.CFrame = character.PrimaryPart.CFrame * CFrame.new(0, 1.5, -2) * CFrame.Angles(0, math.rad(180), 0)
end

Message:GetPropertyChangedSignal("Value"):Connect(function()
	if Message.Value == "None" then
		DialogueFrame.Visible = false
	else
		DialogueFrame.Visible = true
	end
	DialogueFrame.TextLabel.Text = Message.Value
	script.DialogueSound:Play()
end)

Speaker:GetPropertyChangedSignal("Value"):Connect(function()
	UpdaterCharacter(workspace[Speaker.Value])
	DialogueFrame.Icon.nameLabel.Text = Speaker.Value
end)