HintService (Archived) | Legacy hints reimagined, customizable, straight-forward, and simple

The proper replacement for this is the new package Snacky: Snacky - An Efficient Way to Show Snackbar Hints

Archived Post

What is HintService?

HintService is a module that creates hints fast, yet very efficiently and smoothly.


Videos and Screenshots


Why is this useful?

This is basically the successor of Roblox’s deprecated hint objects, but way more modern and customizable. Here are some use cases for this: Announcements, Tips, Warnings, Reminders, Tasks, etc.


Themes

Themes were created to allow other user to share their hint themes with everyone and make them public and easy to re-use.

How do I set the theme of a hint?

  1. Open up the module and locate the Themes folder inside
  2. Insert a default theme module script (go into the DefaultTheme folder to find and copy over)
  3. Edit the the hint property table in the module to your liking.
  4. Change the name to whatever you want.
  5. In your LocalScript, create a new hint and set additional settings, (eg. text and visible time)
  6. Call the SetTheme() function on your hint, and insert the name of the theme.
  7. Broadcast your hint to the local machine.
  8. Playtest, and your done! It should work fine.

Documentation

HintService Documentation


Quick Poll(s)

[poll type=multiple results=on_vote min=1 max=1 public=true chartType=bar]
  • Good job! I will use this in my game!
  • Very good, though I have no use for it.
  • It’s alright, could be better.
  • This needs serious improvement.
[/ [poll ][poll name=poll2 type=multiple results=always min=1 max=1 public = true chartType=bar]
  • More API
  • Better speed
  • Something else (Reply)
  • It’s already perfect!
[/ [poll ]

(What type of api?)

Out of 10, how good is this?
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

0 voters

Fill out this survey please: https://forms.gle/kwX8WkASs6BkqN1a6

I strictly ask you to give me feedback on this if you chose ‘could be better’ or ‘needs improvement’


Code Sample (Creates a default hint):

local HS = require(game:GetService("ReplicatedStorage"):FindFirstChild("HintService"))

local NewHint = HS.new() -- Creates a blank, and new hint

HS.HintAdding:Connect(function(AddedHint) -- Connect this to a function to detect when a hint is added
	print(string.format("The new hint that was added says '%s'", AddedHint:getLabel()))
end)

NewHint:setText("test") -- Sets the text of NewHint
NewHint:setBottomCenter() -- Sets the position of the hint to the bottom center.
NewHint:setTweenLength(5, 5) -- Sets how long the animations will last
NewHint:setTweenStyle(Enum.EasingStyle.Linear, Enum.EasingStyle.Linear)  -- Sets the animation styles
NewHint:setTweenDirection(Enum.EasingDirection.In, Enum.EasingDirection.Out) -- Sets the animation directions
NewHint:broadcast(false) -- Broadcasts the hint

https://www.roblox.com/library/9807282771/HintService

HintService Playground - Roblox

Thanks!


Credits

Credit to @stravant for his signal module.
Credit to @Daw588 for uploading my resource to their website, BloxyLibrary

I 100% recommend you use all of these external resources, I personally have had great experience with them.

102 Likes

This is epic and could come in handy for displaying server messages, like the ones admin panel’s use! (:m)

6 Likes

It’s nice but I would like it more if it changes text without making the old label disappear and the new one appear and instead tween the new text one to appear, the old one to disappear and resizing the box

6 Likes

Yeah, I was actually going to implement this on the initial release but I didn’t have time. I will notify you when I’m finished!

5 Likes

It seems good but you should add a Documentation to the post we can have more understanding on how to actually use the module.

4 Likes

I am unsure if I need to even include docs just because there is one function, which is very self explanitory.

3 Likes

Yes, but even if there is one function beginners may want to know what parameters to use and they can have a better understanding on what it does. Even thought it is pretty basic so its really your choice.

4 Likes

I have a few questions + improvements about the code.

DisallowedWhiteSpace is a constant, move it outside of the constructor:

function HintService.new(--[[ parameters ]])
	local DisallowedWhiteSpace = {"\n", "\r", "\t", "\v", "\f"} --> move it outside this constructor

There are also a lot more constants (such as Players) that should be moved out of the constructor.


What is the purpose of this line? This just returns DisallowedWhiteSpace[1]:

local DisallowedWhiteSpace = {"\n", "\r", "\t", "\v", "\f"}
local function runThrough()
	for i,v in pairs(DisallowedWhiteSpace) do
		return v
	end
end
if string.find(hintText, runThrough()) then
	error("Whitespaces are not allowed.")
end

This snippet of code is very bloaty:

local function start()
    --> code within function
end
if destroyOnFinished == true then
	start()
	task.wait(1)
	NewHint:Destroy()
else
	start()
end

This can be converted to:

--> code within function
if destroyOnFinished then
    task.wait(1)
    NewHint:Destroy()
end

You should also create your UI and clone it rather than creating a new one using code every single time.

5 Likes

I thought what you wanted to do.

local DisallowedWhiteSpace = {"\n", "\r", "\t", "\v", "\f"}
local function runThrough(hintText)
	for i,v in pairs(DisallowedWhiteSpace) do
		if string.find(hintText, v) then
			error("Whitespaces are not allowed.")
		end
	end
	return hintText
end
3 Likes

Woah, this is really nice! Thank you so much!

2 Likes

Seems cool and all, but doesn’t have much functionality. A new hint should automatically remove an existing hint but doesn’t, also doesn’t seem to have that much in control.

2 Likes

The .new() constructor yields the thread until TimeIsVisible is finished.

1 Like

This is awesome! Gonna use it for my future games. Tysm :smile:

2 Likes

You know what I think would be fantastic for something like this?

The ability to stack a certain number of hints on top of each other, sort of like how Isle does it.

It prints hints in red text at the bottom of your screen that shows you what you did, what you’re not able to do, or that something is happening, and it stacks the messages if another one is already present in that spot to prevent this weird overlapping or having to wait until it goes away.

If this “service” had that mechanic, this would be 10x more useful imo.

2 Likes

Thanks for the feedback! I will take your feature request into consideration.

1 Like

I said that you should add connections to RBXScriptsignal, so like

part.Touched:Connect(newHint)

or

gui.MouseButton1Click:Connect(removeHint)
2 Likes

As a mostly UI designer, I won’t personally use this unless you eventually give us the opportunity of modifying the GUI. But for those of us who don’t value interface design so much this is absolutely great!

2 Likes

This actually looks surprisingly similar to something I made as a reply to another notification attempt two years ago.

However, this system wasn’t perfect and had some obvious drawbacks. Reading the code of yours and I can tell its way more better structured than this two year old resource. Good job! However, mine by default allowed hints that stacked, I know you mentioned this as a new feature coming but I don’t know if it has actually been implemented yet.

P.S. Don’t disallow whitespace, developers may find use out of this (unless your system isn’t built to stand whitespace). Whitespace is an easy way to go multi-line without having to span the entire screen’s width first.

1 Like

You can already do that, just assign a function to the RBXScriptConnection then fire a remote if it is on the server, and create a new hint.

If you mean something like this: HintService.HintAdded:Connect(f) then I am implementing that with @stravant’s signal module.

My system does not support whitespaces, which I don’t think it will for a long time.