The title may sound very confusing so I’ll sum it up here.
I want to create a dialog popup whenever the player touches a part. That may sound simple in turn, just change the text based on the part’s properties and such but…
I’m currently attempting to use @Defaultio’s Rich Text Module: https://www.roblox.com/library/1014847041/Rich-Text-Markup
I’m pretty sure how it works is by getting a table of text sequences then playing it using the module.
I’m able to get it to work perfectly, the only problem is that I have no clue how I would be able to get a text sequence from a part to the local script that plays the text and pops up the dialog message.
repeat wait() until game.Players.LocalPlayer
local TextModule = require(game.ReplicatedStorage.RichTextModule)
local TS = game:GetService("TweenService")
local DF = script.Parent.DialogFrame
local TF = DF.Dialog
local CV = DF.CubeView
local Char = game.Players.LocalPlayer.Character
local Hum = Char:WaitForChild("Humanoid")
local DEB = false
local DFTweenIn = TS:Create(DF, TweenInfo.new(0.4), {Size = DF.Size, ImageTransparency = 0})
local DFTweenOut = TS:Create(DF, TweenInfo.new(0.4), {Size = DF.Size, ImageTransparency = 1})
local CVTweenIn = TS:Create(CV, TweenInfo.new(0.4), {Size = CV.Size, ImageTransparency = 0})
local CVTweenOut = TS:Create(CV, TweenInfo.new(0.4), {Size = CV.Size, ImageTransparency = 1})
local TextBeginningSeq = {
{Text = "Hello there! Welcome to the <AnimateStyle=Wiggle><Color=Red>Simple Cubes!<Color=/>!<AnimateYield=1>", DelayTime = 2},
{Text = "In this adventure, your journey will be <AnimateStyle=Wiggle><Color=Red>grueling and difficult!<Color=/>!<AnimateYield=1>", DelayTime = 3},
{Text = "If you're ready to begin, get hopping!", DelayTime = 2},
}
local function ShowDialog(Text, DT)
local TextObj = TextModule:New(TF, Text, {Font = "SourceSansLight"})
TextObj:Animate(true)
wait(DT)
TextObj:Hide()
end
local function ShowFrame()
DF.Size = UDim2.new(0.4, 0, 0.2, 0)
DF.ImageTransparency = 1
DF.Visible = true
DFTweenIn:Play()
CVTweenIn:Play()
wait(DFTweenIn.TweenInfo.Time)
end
local function HideFrame()
DFTweenOut:Play()
CVTweenOut:Play()
wait(DFTweenOut.TweenInfo.Time)
DF.Visible = false
end
local function TouchedDialogBox()
end
wait(2)
ShowFrame()
for _,v in pairs(TextBeginningSeq) do
ShowDialog(v.Text, v.DelayTime)
end
HideFrame()
The code I’m using to do pop up the dialog.