Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make it where the gui text goes into a new line after reaching the end of the gui?

Backstory

In making this sorta quest system where the player find this pirate that tells him to kill a zombie in exchange for some gold.

Problem

When the player clicks on the torso of the Pirate it begins a dialog. My problem is when the player click the torso it doesn't go into a new line to write everything else. Instead it goes outside of the TextBox. Here's what I'm talking about And here is what I'm trying to acomplish. Here is my script

Local Script inside of StarterGui

local Player = game.Players.LocalPlayer
repeat wait() until Player.Character
local char = Player.Character
local hum = char.Humanoid
local root = char:WaitForChild("HumanoidRootPart")
local Torso = char:WaitForChild("Torso")
local PTorso = game.Workspace.Pirate:WaitForChild("Torso")
local Mouse = Player:GetMouse()



PTorso.Click.MouseClick:Connect(function()
	local SG = Instance.new("ScreenGui")
	SG.Parent = script.Parent
	local Frame = Instance.new("Frame")
	Frame.Parent = SG
	Frame.Name = "PirateTextFrame"
	Frame.Position = UDim2.new(0.315, 0,0.597, 0)
	Frame.Size = UDim2.new(0, 602,0, 131)
	Frame.Visible = true
	Frame.BackgroundColor3 = Color3.new(0,255,127)
	Frame.BackgroundTransparency = 0.65
	Frame.BorderSizePixel = 0
	local TL = Instance.new("TextLabel")
	TL.Parent = SG
	TL.Name = "PirateTextLabel"
	TL.BackgroundColor3 = Color3.new(0,255,255)
		TL.Position = UDim2.new(0.32, 0,0.597, 0)
	TL.Size = UDim2.new(0, 595,0, 125)
	TL.BorderSizePixel = 0
	TL.BackgroundTransparency = 0
	TL.TextScaled = false
	TL.TextSize = 14
	local Text = "ARRR Mate! from tha looks of it yar mus be a travller! Tell ya what, if you can kill that zombie I'll give ya plenty of gold. What'da say?"
	for i = 1,#Text do
		TL.Text = string.sub(Text, 1, i)
		local Click = Instance.new("Sound")
		Click.Parent = Torso
		local Sounds = {"rbxassetid://537744814","rbxassetid://140910211","rbxassetid://421058925"}
		Click.SoundId = Sounds[math.random(#Sounds)]--aojsdnasdnaoufbaskfngiagandg 
		Click:Play()
			wait()
	end
end)

THIS IS WITHOUT THE USE OFTL.TextScaled = true

Regards, Bl_ueHistory

3 comments

0

TextWrapping

0

or text scaled

0

Send an image

1 answer

✓ Accepted answer
local Player = game.Players.LocalPlayer
repeat wait() until Player.Character
local char = Player.Character
local hum = char.Humanoid
local root = char:WaitForChild("HumanoidRootPart")
local Torso = char:WaitForChild("Torso")
local PTorso = game.Workspace.Pirate:WaitForChild("Torso")
local Mouse = Player:GetMouse()



PTorso.Click.MouseClick:Connect(function()
    local SG = Instance.new("ScreenGui")
    SG.Parent = script.Parent
    local Frame = Instance.new("Frame")
    Frame.Parent = SG
    Frame.Name = "PirateTextFrame"
    Frame.Position = UDim2.new(0.315, 0,0.597, 0)
    Frame.Size = UDim2.new(0, 602,0, 131)
    Frame.Visible = true
    Frame.BackgroundColor3 = Color3.new(0,255,127)
    Frame.BackgroundTransparency = 0.65
    Frame.BorderSizePixel = 0
    local TL = Instance.new("TextLabel")
    TL.Parent = SG
    TL.Name = "PirateTextLabel"
    TL.BackgroundColor3 = Color3.new(0,255,255)
        TL.Position = UDim2.new(0.32, 0,0.597, 0)
    TL.Size = UDim2.new(0, 595,0, 125)
    TL.BorderSizePixel = 0
    TL.BackgroundTransparency = 0
    TL.TextScaled = false
    TL.TextSize = 14
    TL.TextWrapped = true
    local Text = "ARRR Mate! from tha looks of it yar mus be a travller! Tell ya what, if you can kill that zombie I'll give ya plenty of gold. What'da say?"
    for i = 1,#Text do
        TL.Text = string.sub(Text, 1, i)
        local Click = Instance.new("Sound")
        Click.Parent = Torso
        local Sounds = {"rbxassetid://537744814","rbxassetid://140910211","rbxassetid://421058925"}
        Click.SoundId = Sounds[math.random(#Sounds)]--aojsdnasdnaoufbaskfngiagandg 
        Click:Play()
            wait()
    end
end)

Like everyone in the comments said, make sure to enable TextWrapped to true in scenarios like this, as it makes sure that everything in the text box is still within the boundaries of the label.

1 comment

0

edit: i accidentally said to put textscaled to true even though the asker said to not do that. changed to use text wrapped instead.

This discussion is preserved as it was. New answers, comments, and votes are closed.