TextBounds Issue

I’m attempting to make a description popping out, when hovered, and contains that text that’s being used in the script - however, I’m facing issues with sizing the frame as intended. Hence, there’s no more to add on other than the frame and textlabel has offset in the size, it still doesn’t seem to scale right, what’s the issue in this scenario?

--[ Variables
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local frame = script.Parent
local addLife = frame["Perk-AddLife"]
local boundary = frame.Boundary
local desc = boundary.Description
local entLife = false
--[ Setup
local function createBnd(txt)
	boundary.Visible = true
	desc.Text = txt
	boundary.Size = UDim2.new(0, math.max(10, desc.TextBounds.X), 0, math.max(10, desc.TextBounds.Y))
end
addLife.Background.MouseEnter:Connect(function()
	entLife = true
	repeat wait()
		createBnd("adds an extra life and brings you back after dead from the arena (stackable)")
	until not entLife
end)
addLife.Background.MouseLeave:Connect(function()
	entLife = false
end)

Result:
image
Expected:

Yeah, sounds like a malicious plugin. They usually hide as a legitimate plugin, but contain a script that inserts a script into your game whenever the plugin is loaded (i.e. when you open a game). The script then requires a module from elsewhere and runs code from that module, usually some code that…

Hence textbounds didn’t work accurately, I decided to use TextService:GetTextSize() and it works flawlessly now, written in:

	local textSize = game:GetService("TextService"):GetTextSize(txt, desc.TextSize, desc.Font, Vector2.new(math.huge, math.huge))
	boundary.Size = UDim2.fromOffset(textSize.X + 45, textSize.Y)
2 Likes