this is script in gui

local StarterGui = game:GetService("StarterGui")

local createDialogueEvent = game.ReplicatedStorage.Remotes.createDialogueEvent
local hideDialogueEvent = game.ReplicatedStorage.Remotes.hideDialogueEvent
local setDialogueImageEvent = game.ReplicatedStorage.Remotes.setDialogueImageEvent

local richText = require(game.ReplicatedStorage.Modules.RichText)

local player = game.Players.LocalPlayer
local dialogueFrame = player.PlayerGui.MainGui.DialogueFrame

local function swooshSound()
	local sound = Instance.new("Sound",game.ReplicatedStorage)
	sound.PlaybackSpeed = 1
	sound.Volume = 1
	sound.PlayOnRemove = true
	sound.SoundId = "rbxassetid://4845387138"
	sound:Destroy()
end

hideDialogueEvent.OnClientEvent:Connect(function()
	
	StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
	
	swooshSound()
	dialogueFrame:TweenPosition(UDim2.new(0.5,0,2,0),.1)
end)

createDialogueEvent.OnClientEvent:Connect(function(english,spanish)
	if dialogueFrame.Position ~= UDim2.new(0.5,0,0.85,0) then
		
		StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
		
		dialogueFrame:TweenPosition(UDim2.new(0.5,0,0.85,0),.1)
		
	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 textObject = richText:New(dialogueFrame.textFrame, content)
	textObject:Animate(true)
end)

-- Viewport Script Starts Here

local function cleanVPF()

	if dialogueFrame.ViewportFrame:FindFirstChildOfClass("Model") then
		dialogueFrame.ViewportFrame:FindFirstChildOfClass("Model"):Destroy()
	end

	if dialogueFrame.ViewportFrame:FindFirstChildOfClass("Camera") then
		dialogueFrame.ViewportFrame:FindFirstChildOfClass("Camera"):Destroy()
	end

end

setDialogueImageEvent.OnClientEvent:Connect(function(charName,color)
	dialogueFrame.nameLabel.Text = charName
	dialogueFrame.nameLabel.TextColor3 = color
	
	local vpCharacter = game.Workspace:FindFirstChild(charName)

	if vpCharacter then
		
		cleanVPF()
		
		local obj = vpCharacter:Clone()
		obj.Parent = dialogueFrame.ViewportFrame
		
		local cam = Instance.new("Camera")
		cam.Parent = dialogueFrame.ViewportFrame
		
		cam.CFrame = CFrame.new(obj.Head.Position + (obj.PrimaryPart.CFrame.lookVector*2), obj.Head.Position)
		
		dialogueFrame.ViewportFrame.CurrentCamera = cam
		
	else
		warn(charName .. " is not in ReplicatedStorage")
	end
end)

and this is in serverscriptservice

local createDialogueEvent = game.ReplicatedStorage.Remotes.createDialogueEvent
local hideDialogueEvent = game.ReplicatedStorage.Remotes.hideDialogueEvent
local setDialogueImageEvent = game.ReplicatedStorage.Remotes.setDialogueImageEvent
local touchpart = game.Workspace.touchpart

touchpart.Touched:Connect(function()
	touchpart:Destroy()
	wait(1)
	setDialogueImageEvent:FireAllClients("JendaGaming", Color3.new(0, 0.603922, 0.905882)) -- here must be name of char in workspace and color
	wait(0.5)
	createDialogueEvent:FireAllClients("")
	wait(1)
	createDialogueEvent:FireAllClients("Oh sh*t, I forgot my loved small head")
	wait(3)
	createDialogueEvent:FireAllClients("Will you find it???")
	wait(1.5)
	createDialogueEvent:FireAllClients("If yes, don´t forget return or no mysterious rewards for you!")
	wait(5)
	createDialogueEvent:FireAllClients("You are asking, what is reward??")
	wait(3)
	createDialogueEvent:FireAllClients("Well, I will give you one relic for one very secret and mysterious place...")
	wait(4)
	hideDialogueEvent:FireAllClients()
end)

1 comment

0

I know I'm not answering your problem, but swearing in your game even if it has a asterisk may get your game reviewed by Roblox. Try avoiding swearing.