Custom ToolTips for plugin ui?

Hi,
I’m currently writing a plugin to assist me and a few other devs setup vehicles in our game and there are quite a few values required for full setup. It is in desperate need of documentation of some kind and I thought what better way than to do that than to add a tooltip to each menu item explaining its basic function?

Unfortunately I can find almost nothing on the subject after a few searches, and most questions asked previously never got any answers and are all at least a few years old by now.

So I’m wondering if this is even possible at all to create tooltips on Widget UI’s, and if so, what’s the best implementation?

1 Like

Something like when you hover on a tool with toolTip?

1 Like

Yes, toolTip on hover.
But more like this over a value field or label:
image

1 Like
local testButton = Instance.new("TextButton")
testButton.BorderSizePixel = 0
testButton.TextSize = 20
testButton.TextColor3 = Color3.new(1, 1, 1)
testButton.AnchorPoint = Vector2.new(0.5,0.5)
testButton.Size = UDim2.new(0,100,0,50)
testButton.Position = UDim2.new(0.5,0,0.5,0)
testButton.SizeConstraint = Enum.SizeConstraint.RelativeYY
testButton.Text = "Button"
testButton.Parent = testWidget

local testButton1 = Instance.new("TextButton")
testButton1.BorderSizePixel = 0
testButton1.TextSize = 20
testButton1.TextColor3 = Color3.new(1, 1, 1)
testButton1.AnchorPoint = Vector2.new(0.5,0.5)
testButton1.Size = UDim2.new(0,100,0,50)
testButton1.Position = UDim2.new(0.5,0,0.7,0)
testButton1.SizeConstraint = Enum.SizeConstraint.RelativeYY
testButton1.Text = "Button"
testButton1.Parent = testWidget

local tooltip = Instance.new("TextLabel")
tooltip.BackgroundColor3 = Color3.fromRGB(39, 39, 39)
tooltip.TextColor3 = Color3.fromRGB(235, 235, 235)
tooltip.TextXAlignment = Enum.TextXAlignment.Center
tooltip.TextYAlignment = Enum.TextYAlignment.Center
tooltip.Text = ""
tooltip.Visible = false
tooltip.Parent = testWidget

local buttons = {
	button1 = {testButton, "This is a button"},
	button2 = {testButton1, "This is another button"}
}

for _, v in pairs(buttons) do
	v[1].MouseLeave:Connect(function()
		tooltip.Visible = false
	end)
	v[1].MouseMoved:Connect(function(x, y)
		tooltip.Visible = true
		tooltip.Text = v[2]
		tooltip.Size = UDim2.new(0, tooltip.TextBounds.X + 5, 0, 15)
		tooltip.Position = UDim2.new(0, x+3, 0, y+3)
	end)
end
1 Like

Alright! Thank you so much. :grinning_face_with_smiling_eyes:
I’ll put this too good use!

1 Like

something like when you hover on a tool with toolTip?

Why you are copying my post?‎‎‎‎‎‎‎‎‎‎‎‎

1 Like

Oops sorry i was try something and it did not work that was a error.