I Have a problem with my npc dialogue text, I want this to be the same size for every device without having the text cut off, how do I fix that?
Mobile
PC
I Have a problem with my npc dialogue text, I want this to be the same size for every device without having the text cut off, how do I fix that?
Mobile
PC
Are you using scale or offset? Maybe the problem is because of offset
I am using scale and everything works:
Mobile:
PC:
I’m using scale, can u try making a longer sentence?
Give me a moment (Character limit)
Still working
Everything looks good, maybe i can share you script i am using to type dialogue:
local dialogue = require(script.ModuleScript) -- dialogues here
local DummyPP = workspace.T.ProximityPrompt -- promt
local TalkLabel = script.Parent.Talk -- my label
local function TypeDialogue(dialogueText) -- func to type text
local currentIndex = 0
local function TypeNextCharacter()
currentIndex = currentIndex + 1
TalkLabel.Text = string.sub(dialogueText, 1, currentIndex)
if currentIndex < #dialogueText then
wait(0.05)
TypeNextCharacter()
end
end
TypeNextCharacter()
end
DummyPP.Triggered:Connect(function() -- promt func
script.Parent.daName.Text = dialogue.DummyDia0.Name
TypeDialogue(dialogue.DummyDia0.Dialogue.first)
end)
Maybe this would help more, Here’s the problem when you talk with the npc
robloxapp-20240521-2109110.wmv (887.9 KB)
robloxapp-20240521-2110111.wmv (1.2 MB)
Can you share your script when you are typing the dialogue (not all, just a func), maybe i will understand the problem
Also are you using textSize or textScaled? Because if textScaled the are no problems
local DialogueGui = script.Parent
local DialogueSequence = DialogueGui:WaitForChild("DialogueSequence")
local Main = DialogueGui:WaitForChild("Main")
local CurrentDialogue = 1
local function typewriterEffect(targetText)
Main.ContinueFrame.Visible = false -- Hide the frame and button
Main.ContinueButton.Visible = false
Main.DialogueBox.Text = ""
for i = 1, #targetText do
Main.DialogueBox.Text = Main.DialogueBox.Text .. string.sub(targetText, i, i)
wait(0.05) -- Adjust the speed of the typewriter effect here
end
Main.ContinueFrame.Visible = true -- Show the frame and button after typing
Main.ContinueButton.Visible = true
end
local function showNextDialogue()
local TargetDialogue = DialogueSequence:FindFirstChild(CurrentDialogue)
if TargetDialogue then
typewriterEffect(TargetDialogue.Value)
CurrentDialogue = CurrentDialogue + 1
-- Check if this is the last dialogue
if CurrentDialogue > #DialogueSequence:GetChildren() then
Main.ContinueButton.Text = "End"
-- Change ContinueFrame's UIGradient to switch the colors
Main.ContinueFrame.UIGradient.Color = ColorSequence.new{
ColorSequenceKeypoint.new(0, Color3.fromRGB(100, 29, 36)), -- Top color: 641d24
ColorSequenceKeypoint.new(1, Color3.fromRGB(232, 65, 95)) -- Bottom color: e8415f
}
end
else
Main.ContinueButton.Text = "End"
-- Change ContinueFrame's UIGradient to switch the colors
Main.ContinueFrame.UIGradient.Color = ColorSequence.new{
ColorSequenceKeypoint.new(0, Color3.fromRGB(100, 29, 36)), -- Top color: 641d24
ColorSequenceKeypoint.new(1, Color3.fromRGB(232, 65, 95)) -- Bottom color: e8415f
}
end
end
if DialogueSequence:FindFirstChild(CurrentDialogue) then
showNextDialogue()
end
local clickedend = false
Main.ContinueButton.MouseButton1Click:Connect(function()
if Main.ContinueButton.Text == "End" then
if not clickedend then
clickedend = true
game:GetService("TweenService"):Create(Main, TweenInfo.new(1, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut), {Position = UDim2.new(0.302, 0, 2, 0)}):Play()
wait(1)
DialogueGui.TargetEvent.Value:FireServer()
end
else
showNextDialogue()
end
end)
I got your error:
yeah I know but when I use it, it changes the size of the text when it types and I’d rather make it the same size
robloxapp-20240521-2118324.wmv (567.5 KB)
You can try selecting RichText but…
That’s not what you need
You can try scaling the frame more on mobile devices
By using Scale instead of Offset Udim2.new(0.395, 0, 0.227, 0) at that case, you have adjusted the text to fit your screen only.
It also cuts on my screen because it is probably smaller than yours.
What I’ve done was change the size to use Offset; Deleted the UIAspectRatioConstraint since I believe, with a grain of salt, that if you correctly size the UI you shouldn’t need to use it; Enabled the AutomaticSize of the Main frame and the DialogueBox, and did a few minor tweaks.
Hope that helps.
DialogueGui
Thank you so much! I appreciate this
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.