create CUSTOM topbar icons! - TopbarPlus V3
摘要
TLDRLa vidéo est un guide détaillé sur l'utilisation du module Top Bar Plus version 3 pour Roblox. Top Bar Plus permet aux développeurs d'ajouter facilement des widgets ou des icônes au sommet de l'interface utilisateur, avec des fonctionnalités étendues pour correspondre au style du nouveau UI de Roblox. La version 3 est compatible avec l'ancienne interface UI, assurant une transition en douceur pour les utilisateurs. Le tutoriel couvre la création de widgets via le module d'icônes, la modification d'aspects tels que l'apparence et la fonctionnalité, l'ajout d'images et de textes, la gestion des événements de widgets, et l'application de thèmes modifiés. En dépit d'expliquer chaque aspect, la vidéo souligne les problèmes potentiels avec les bugs encore présents, tout en expliquant comment utiliser efficacement les fonctions pour une personnalisation étendue.
心得
- 🆕 Top Bar Plus version 3 compatible avec le nouveau UI de Roblox.
- 🔄 Rétrocompatible avec l'ancienne interface UI.
- 🖼️ Fonctionnalités pour ajouter des images et des textes aux widgets.
- 🔔 Système de notifications personnalisables pour les icônes.
- 🧩 Manipulation facile de l'apparence avec des fonctions en chaîne.
- 🛠️ Inclut des fonctions pour gérer les événements des widgets.
- 📐 Ajustement flexible de la taille des widgets et du texte.
- 🔑 Assignation possible de raccourcis clavier pour manipuler les widgets.
- 📏 Possibilité de définir l'ordre et l'alignement des widgets.
- 🚫 Options pour cacher et afficher les éléments de l'interface selon les besoins.
时间轴
- 00:00:00 - 00:05:00
Dans cette vidéo, on explore comment utiliser le module Top Bar Plus version 3. Ce module permet d'ajouter des widgets ou des icônes sur la partie supérieure de l'écran, imitant le style de l'interface utilisateur de Roblox. La version 3, réalisée par Forever HD, offre une compatibilité avec la nouvelle interface de Roblox tout en restant utilisable avec l'ancienne interface. Pour commencer à utiliser Top Bar Plus, il faut inclure le module d'icônes pour créer de nouveaux widgets.
- 00:05:00 - 00:10:00
On continue à explorer les fonctionnalités de Top Bar Plus. La fonction set name permet de définir un nom pour chaque widget, utile pour les identifier. Le module offre des fonctions pour modifier le thème et l'apparence des icônes en passant des tableaux contenant des informations à modifier. Les widgets peuvent aussi être modifiés, activés ou désactivés, et des notifications peuvent être ajoutées.
- 00:10:00 - 00:15:00
La vidéo détaille comment désactiver l'effet de survol avec disableState overlay et ajouter des images aux widgets via set image. On peut aussi ajouter du texte grâce à set label. Les fonctions set order et align permettent de définir l'ordre et l'alignement des icônes sur l'écran. La taille et le rayon des coins des widgets peuvent également être modifiés.
- 00:15:00 - 00:20:00
L'animateur montre comment lier des objets GUI avec la fonction bind toggle item pour qu'ils apparaissent/disparaissent en fonction de l'état du widget. Il présente aussi les événements que l'on peut écouter, tels que sélection et désélection, et comment ajouter des raccourcis clavier pour interagir avec les widgets. La possibilité de verrouiller les widgets est également abordée.
- 00:20:00 - 00:25:00
Les widgets peuvent être configurés pour se comporter comme des boutons simples grâce à la fonction oneclick. Des fonctions pour créer des menus déroulants et des sous-menus sont illustrées. On approfondit sur la gestion dynamique des icônes dans les menus et des fonctionnalités de chaînes qui facilitent les appels de fonctions consécutifs.
- 00:25:00 - 00:34:10
L'animateur conclut en explorant les propriétés en lecture seule des widgets et plusieurs fonctions disponibles dans le module d'icônes. Il mentionne la personnalisation possible du thème par défaut dans le module themes et encourage à explorer le V3 Playground pour plus d'exemples et d'idées. Ce module sert grandement à créer des widgets sur les interfaces Roblox.
思维导图
视频问答
Qu'est-ce que Top Bar Plus ?
Top Bar Plus est un module qui permet d'ajouter des icônes ou des widgets en haut de l'interface utilisateur de Roblox pour correspondre au style UI de base de Roblox.
Quels sont les avantages de la version 3 de Top Bar Plus ?
La version 3 offre la compatibilité avec le nouveau UI de Roblox tout en restant rétrocompatible avec l'ancien UI.
Comment démarrer avec Top Bar Plus ?
Pour commencer, il faut requérir le module d’icône afin de créer de nouveaux widgets sur la Top Bar de l’écran.
Quels types de modifications peut-on faire aux widgets ?
On peut changer l'apparence en modifiant la thématique, le texte, les notifications, la taille et la position des widgets.
Comment ajouter une image à un widget ?
Utiliser la fonction 'set image' en passant l'ID de l'image à afficher dans le widget.
Peut-on changer l'ordre des widgets ?
Oui, en utilisant la fonction 'set order' pour définir l'ordre d'apparition sur la barre supérieure.
Quels événements peuvent être associés aux widgets ?
Les événements comme sélectionné, désélectionné, basculé, vue commencée et terminée peuvent être associés aux widgets.
Peut-on personnaliser les notifications ?
Oui, les notifications peuvent être ajoutées et des signaux personnalisés peuvent être utilisés pour les effacer.
Comment modifier la taille du texte dans un widget ?
Utilisez la fonction 'set text size' pour définir la taille souhaitée du texte.
Est-il possible de désactiver une icône ?
Oui, en utilisant la fonction 'set enabled' en passant false pour rendre l’icône invisible.
查看更多视频摘要
Elon Musk Five Step Improvement Process
Au coeur de la cuisine japonaise
2-Minute Neuroscience: Glutamate
Day-19 | Jenkins ZERO to HERO | 3 Projects Live |Docker Agent |Interview Questions | #k8s #gitops
Korrektes Abkuppeln eines LKW Anhängers - Klasse CE
Webinaire : La conjoncture du crédit immobilier pour les non-résidents et les expatriés à la mi 2023
- 00:00:00in this video we're going to take a look
- 00:00:02at how to use the new and beloved top
- 00:00:04bar plus version 3 if you've never heard
- 00:00:07of top bar plus it is a neat module that
- 00:00:09allows you to add widgets or icons along
- 00:00:12the top of the screen that matches the
- 00:00:14style of the default Roblox UI this
- 00:00:17recently released version made by
- 00:00:19forever HD adds support for the new
- 00:00:21Roblox UI that has been rolling out to
- 00:00:23more and more users and V3 is also
- 00:00:26backwards compatible to any players who
- 00:00:28still have the old roox UI there are a
- 00:00:30lot of features and functions to go over
- 00:00:33for top bar plus and we're going to take
- 00:00:35a look at all of them please note as of
- 00:00:37the recording of this video I'm using
- 00:00:38version
- 00:00:403.0.2 and there are still some issues
- 00:00:42with top R plus which is expected V3
- 00:00:45came out not that long ago so there's
- 00:00:47still going to be a few bugs that
- 00:00:48forever HD will need to iron out in the
- 00:00:50future to get started with top bar plus
- 00:00:53all we need to do is require the icon
- 00:00:55module to create new widgets on the top
- 00:00:58bar of the screen so wherever you have
- 00:01:01your icon module script located you're
- 00:01:02going to need to require it I just have
- 00:01:04mine replicated storage so I'm going to
- 00:01:06require it from this local script that
- 00:01:08is inside of starter player
- 00:01:10scripts and then once you have gotten
- 00:01:13your icon module required then you can
- 00:01:15go ahead and use the new Constructor
- 00:01:18that exists within this module to create
- 00:01:19new icon objects and I'm going to go
- 00:01:22ahead and store this inside a variable
- 00:01:24I'm just going to call it icon and this
- 00:01:26is going to be my new icon that's going
- 00:01:27to display on the screen and as you can
- 00:01:29see as we play test the game here is a
- 00:01:31new 32x32 pixel icon that has appeared
- 00:01:34on the top left it's blank because
- 00:01:35there's nothing in it there's no labels
- 00:01:37there's nothing but we are able to
- 00:01:39select it and deselect it which is going
- 00:01:41to be firing some events that we'll take
- 00:01:42a look at a little bit later now do note
- 00:01:45that I have modified my module slightly
- 00:01:47to include types so that way when I
- 00:01:50refer to my icon I can see all the
- 00:01:52functions that belong to it I'm pretty
- 00:01:54sure types are going to be added to top
- 00:01:57bar plus sometime in the future but I
- 00:01:58just did it for the sake this video so
- 00:02:00it's easy for me to see all the
- 00:02:02functions and autofill them now the
- 00:02:04first function we can go ahead and take
- 00:02:05a look at is going to be the set name
- 00:02:07function I'm just going to pass a name
- 00:02:09here of like Bob and all this is going
- 00:02:11to do is just set the name of the widget
- 00:02:13instance itself and then this is going
- 00:02:16to be useful when you need to grab
- 00:02:18different widgets based on a particular
- 00:02:20name so since I have this icon or this
- 00:02:23widget set to the name of Bob when I go
- 00:02:26and use a function inside of the icon
- 00:02:28module itself which is the function of
- 00:02:31get icon I can pass that name here and
- 00:02:34get it back from this function if an
- 00:02:36icon exists with this particular name
- 00:02:38this function is purely for
- 00:02:39identification purposes and doesn't
- 00:02:41really serve much other use other than
- 00:02:43that now the next function we have here
- 00:02:45is called get instance or Collective
- 00:02:47which will return an instance based on
- 00:02:49the name you provide that's inside of
- 00:02:51the widget UI itself for all the
- 00:02:53instances that make up the widget so if
- 00:02:55you want to grab a specific thing out of
- 00:02:57there for some reason if you want to
- 00:02:59manipulate it in some some way then you
- 00:03:00can do so by using this function so
- 00:03:03actually let me go ahead and get rid of
- 00:03:04that and then let's play test the game
- 00:03:07and then let's go ahead and head over to
- 00:03:08our player GUI folder and let's go ahead
- 00:03:10and take a look at the top bar and I
- 00:03:13believe we're going to have to go to
- 00:03:14standard and then we're going to go to
- 00:03:16the left and as you can see here is our
- 00:03:19Bob widget here's the frame and then
- 00:03:21there's some other stuff in here such as
- 00:03:23the icon button itself there's a
- 00:03:25gradient for it ACC coring here is a
- 00:03:27menu for it and then there's a whole
- 00:03:29bunch of different instances that make
- 00:03:30up this widget now if you wanted to grab
- 00:03:33any of these particular instances then
- 00:03:35that's what you're going to use the get
- 00:03:37instance or Collective function for as
- 00:03:39an example I can go ahead and get the
- 00:03:41instance or Collective let's say I want
- 00:03:43to get the menu and then let's go ahead
- 00:03:45and actually print that out inside of
- 00:03:47the console and if we go and play test
- 00:03:49our game and we take a look as you can
- 00:03:51see we got a table returned back to us
- 00:03:53referring to that particular instance
- 00:03:55which is menu the next function we have
- 00:03:57is called modify theme which is not
- 00:03:59autofilling for some reason but what we
- 00:04:01do here is this gives us the ability to
- 00:04:04modify the theme of our button in any
- 00:04:06way we want and we can do so by passing
- 00:04:09a table to this function and this table
- 00:04:11has to contain some information of what
- 00:04:12we would like to modify if we take a
- 00:04:14look at the documentation for top bar
- 00:04:16plus it says to modify the theme you can
- 00:04:18modify the appearance by doing modify
- 00:04:20theme and passing modifications
- 00:04:22modifications can either be a single
- 00:04:24array describing a change or a
- 00:04:26collection of these arrays for example
- 00:04:28both the following are valid so here we
- 00:04:31want to modify the theme of the icon
- 00:04:33label and we want to change the text
- 00:04:35size and set it to 16 while we can also
- 00:04:37change multiple different properties at
- 00:04:39the same time for example we want to
- 00:04:41modify the widget instance change its
- 00:04:43minimum width and set that to 290 or we
- 00:04:46can go ahead and manipulate the icon
- 00:04:47corners and set the corner radius to a
- 00:04:49new udm it says a modification array has
- 00:04:52four components the name property value
- 00:04:55and an optional icon state so with the
- 00:04:58name it says this can be widget which is
- 00:05:00the icon container frame the name of an
- 00:05:02instance within the widget such as the
- 00:05:04icon gradient the icon spot the menu all
- 00:05:06those different instances that we saw
- 00:05:08and it says a collective the value of an
- 00:05:10attribute called Collective applied to
- 00:05:12some instances this enables them to be
- 00:05:13acted upon all at once for example all
- 00:05:15of the icon Corners inside of your
- 00:05:19Widget the second is going to be the
- 00:05:20property to modify it says a property
- 00:05:22from the instance like the name
- 00:05:24background color text Etc or if the
- 00:05:26property doesn't exist an attribute of
- 00:05:28that property name will be set on the
- 00:05:30instance and then thirdly we need the
- 00:05:32value so the value you want the property
- 00:05:34to become you can pass strings colors
- 00:05:37whatever and then this last optional
- 00:05:39thing we can pass is an icon State and
- 00:05:42it says this determines when the
- 00:05:43modification is applied so we can apply
- 00:05:46this particular modification to our
- 00:05:48widget during specific States like if
- 00:05:50the icon is selected or deselected we
- 00:05:53can go ahead and do that so let's go
- 00:05:54ahead and modify the theme of let's say
- 00:05:56the widget and the property we would
- 00:05:59like to modify is let's say we want to
- 00:06:01modify the size and let's set that to a
- 00:06:03new udm 2 and let's do from offset and
- 00:06:06let's say I want to make it longer so
- 00:06:08let's do like 500 pixels along the x
- 00:06:11axis and then for the Y offset I think
- 00:06:13the default is 32 so we're just going to
- 00:06:15leave it like that and let me get rid of
- 00:06:17this print
- 00:06:18statement and as you can see now we have
- 00:06:20a new widget that is 500 pixels across
- 00:06:24and it looks like the button area
- 00:06:26actually didn't update so I believe we
- 00:06:28only manipulated the widget itself and I
- 00:06:30guess the height is actually a little
- 00:06:31bit taller than 32 pixels so I think the
- 00:06:33documentation needs to be fixed in that
- 00:06:35regard but as you can see now we have
- 00:06:37modified this particular instance inside
- 00:06:39of our widget to be super long something
- 00:06:41you should also be noticing is that I
- 00:06:43was able to call this function directly
- 00:06:46upon after calling the set name function
- 00:06:48and that's because most of these
- 00:06:49functions are chainable so they return
- 00:06:51the icon itself which means you can
- 00:06:53chain functions on top of functions so I
- 00:06:55can call another function here after
- 00:06:57modifying the theme and continue on the
- 00:06:59chain and just keep going on so like I
- 00:07:02could set the name again to something
- 00:07:04different like hello and then I can
- 00:07:06continue chaining to different functions
- 00:07:09that are inside of my widget now another
- 00:07:12function we have is called modify child
- 00:07:14theme and the documentation states that
- 00:07:16this will update the appearance of all
- 00:07:19icons that are parented to this icon so
- 00:07:22using different things like menus and
- 00:07:24stuff like that or changing around the
- 00:07:26parenting of widgets you can go ahead
- 00:07:27and have some icons or widget just be a
- 00:07:30child of another icon and then using
- 00:07:32this function you can modify all of
- 00:07:34those particular icons and their themes
- 00:07:37with the same modifications that you
- 00:07:39would use in the regular modify theme
- 00:07:41function so you would pass a table with
- 00:07:43the different properties you would like
- 00:07:45to change or if you need to change
- 00:07:47multiple different properties then you
- 00:07:48would pass multiple different tables in
- 00:07:50here that would of course contain the
- 00:07:53name of the particular instance you want
- 00:07:54to modify the name of the property and
- 00:07:57the value you want to supply to that
- 00:07:58property the next function that exists
- 00:08:00for widgets is a function called set
- 00:08:02enabled which will simply determine if
- 00:08:04you want the icon to be displayed or not
- 00:08:07displayed so if I pass false here my
- 00:08:10icon is going to disappear from the
- 00:08:11screen and we won't be able to interact
- 00:08:13with it and as you can see no more icon
- 00:08:15exists in the top left the next function
- 00:08:18we have here is Select which will allow
- 00:08:20you to artificially select the button
- 00:08:22without a player or a user needing to
- 00:08:24select it using their mouse or touching
- 00:08:26on the screen of a mobile device or
- 00:08:27whatever we can select the automatically
- 00:08:30just by using this function and as you
- 00:08:32can see I have not clicked on my widget
- 00:08:34yet but it's already selected and when I
- 00:08:35click on it again now it's going to
- 00:08:37deselect of course this wouldn't be
- 00:08:39complete without having another function
- 00:08:41to deselect the widget without needing
- 00:08:44the user to deselect it manually another
- 00:08:47function we have is the ability to add
- 00:08:48notifications to our widget so we can
- 00:08:51use the function notify to allow a
- 00:08:53little popup on the top right of the
- 00:08:55widget to appear displaying how many
- 00:08:57notifications there are and we're also
- 00:08:59able able to provide a custom clear
- 00:09:01signal which means the notifications
- 00:09:03will disappear during some kind of
- 00:09:05signal and this signal could be whatever
- 00:09:07it could be an RBX script signal it
- 00:09:08could be a custom signal from a custom
- 00:09:10module whenever that particular signal
- 00:09:12triggers then it's going to clear the
- 00:09:14notifications but let's just go ahead
- 00:09:16and create one notification and as you
- 00:09:18can see there is my widget with my
- 00:09:19notification if I select it and then
- 00:09:21deselect it it's going to automatically
- 00:09:23disappear once we have deselected the
- 00:09:25widget but instead if you wanted the
- 00:09:27notification to disappear when the let's
- 00:09:29say the icon is selected then we can
- 00:09:32refer to an event inside of our icon or
- 00:09:35our widget and that event is called
- 00:09:38selected and we're just going to pass
- 00:09:40that so now if we go and play test the
- 00:09:42game and we were to select it as you can
- 00:09:44see now the notification has already
- 00:09:46disappeared and we didn't need to
- 00:09:48deselect and of course we also have a
- 00:09:50function to clear any notices on the
- 00:09:52button as well if we wish to do so
- 00:09:53through scripts the next function we
- 00:09:55have is called disable overlay ignore
- 00:09:58this other one called dis disable State
- 00:10:00overlay that's deprecated and it's
- 00:10:01simply there for backwards compatibility
- 00:10:03but disable State overlay if we go ahead
- 00:10:05and call that function and if we pass
- 00:10:07the value like true and we go and play
- 00:10:09test the game what you're going to
- 00:10:10notice is that the hovering or that
- 00:10:12little kind of effect when you hover
- 00:10:14over the button is now disabled so as
- 00:10:17you can see I can select it and deselect
- 00:10:19it but when I was hovering over the
- 00:10:20widget earlier you could see that the
- 00:10:21background color was changing but now
- 00:10:23that we've disabled it it doesn't do
- 00:10:25that anymore now let's add a little bit
- 00:10:27more personality to our widget and we
- 00:10:29can do so by using a function called set
- 00:10:31image which allows us to set an image
- 00:10:33onto our widget so let's go ahead and
- 00:10:36open up the toolbox and let's find a
- 00:10:38suiting image to place inside of the
- 00:10:41widget all right so I found a suitable
- 00:10:43image ID all you need to do is pass that
- 00:10:45ID to the set image function and as you
- 00:10:47can see now your widget should have that
- 00:10:50image inside of it so there's my little
- 00:10:52shocked Freddy Faz bear inside of my
- 00:10:54icon and you should also notice that the
- 00:10:56shape of it or the size of it has shrunk
- 00:10:58down and it's become basically a circle
- 00:11:00with my image in the center we can also
- 00:11:03add text to our widgets by using the set
- 00:11:05label function and we can pass whatever
- 00:11:07kind of text that we want here and let's
- 00:11:09say I only want this text to appear when
- 00:11:11I have the icon selected so we're also
- 00:11:14able to pass an icon state to this
- 00:11:17function which means it's only going to
- 00:11:19update the text label during that
- 00:11:21particular state if we take a look at
- 00:11:22the documentation for Icon States it
- 00:11:24says sometimes you'll want an item to
- 00:11:25appear only when D selected and
- 00:11:27similarly only when selected you can
- 00:11:29achieve this by specifying a string
- 00:11:31value within the icon State parameter of
- 00:11:33methods containing the toggleable tag
- 00:11:35these are deselected selected and
- 00:11:38viewing so we can pass these three
- 00:11:40different strings to determine when we
- 00:11:42would like certain things to happen on
- 00:11:44our label so let's go ahead and set the
- 00:11:47label of hello there only once we have
- 00:11:50selected the widget as you can see
- 00:11:52there's no text currently on my widget
- 00:11:54but once I have selected it there we go
- 00:11:56it says hello there and then once I
- 00:11:57deselect it that t text automatically
- 00:12:00disappears now sometimes if you have
- 00:12:02multiple different icons on let's say
- 00:12:04the leftand side of the screen you might
- 00:12:06want to shift Around The Ordering of the
- 00:12:08different icons and in order to do that
- 00:12:10there's a function called set order and
- 00:12:12all you need to do is pass a number of
- 00:12:14the order for this particular icon so
- 00:12:17what I'm going to do actually is I'm
- 00:12:18going to make a few more icons here and
- 00:12:20they're just going to be empty icons and
- 00:12:22by default all of these icons are going
- 00:12:24to be on the left hand side and let's
- 00:12:26say for my particular Bob icon here I
- 00:12:29want it to be the last so since there's
- 00:12:31four icons here I'm going to set its
- 00:12:33order to a value of four and as you can
- 00:12:36see now my Bob widget is the last one
- 00:12:39inside of this chain of icons if I want
- 00:12:43it to be the second one from the left
- 00:12:45hand side then I can set the order of
- 00:12:46this one to be two but then we also need
- 00:12:49to adjust the ordering of these other
- 00:12:51icons because by default they're all
- 00:12:52going to be in order of one so this one
- 00:12:55will still end up at the very end so
- 00:12:57let's also go ahead and set the order of
- 00:13:00let's just do the set order of this one
- 00:13:01to like one and then we can set the
- 00:13:04order of this one to three and then
- 00:13:06let's set the order of this one 2 4 and
- 00:13:08as you can see there are my icons in the
- 00:13:10correct 1 2 3 4 position if you would
- 00:13:13like to be able to adjust the corner
- 00:13:14radius of your icon you can go ahead and
- 00:13:16do so using the set Corner radius
- 00:13:19function and all you need to do is pass
- 00:13:20a udm here so we'll do a new udm do new
- 00:13:24and let's say instead of there being a
- 00:13:27scale let's let's make the radius very
- 00:13:30small with an offset of like five pixels
- 00:13:33and let's say we also only want to apply
- 00:13:35this corner radius when let's say the
- 00:13:39icon is selected as you can see there's
- 00:13:42my widget but once I select it the
- 00:13:44corner radius has changed then if I
- 00:13:46deselect it it goes back to normal as
- 00:13:49you can see there's a little bit of a
- 00:13:50bug here when you have it selected like
- 00:13:52that it's kind of reverting when you
- 00:13:54hover over the button that's a little
- 00:13:56bit of a bug that needs to be resolved
- 00:13:57but as you can see once I deselect it it
- 00:13:59goes back to normal and then when I
- 00:14:00select it it goes back to that other
- 00:14:01Corner radius that we set in the script
- 00:14:04now let's say we don't like this widget
- 00:14:05being on the left hand side of the
- 00:14:07screen and we want to shift it over to
- 00:14:08the right hand side of the screen or
- 00:14:10maybe the center of the screen then we
- 00:14:12can use the Align function and tell if
- 00:14:14we would like to align it to the left
- 00:14:16the center or the right and all we need
- 00:14:18to do is pass a string so if I would
- 00:14:19like my icon to be in the center of the
- 00:14:21string I just need to say Center and as
- 00:14:23you can see my icon is now in the center
- 00:14:26of the screen or if I want to move it to
- 00:14:28the right side of theen screen then I
- 00:14:29can do so I can pass right and there we
- 00:14:31go my icon or my widget is on the right
- 00:14:34side of the screen very cool now let's
- 00:14:36say I want my icon to be on the right
- 00:14:38side of the screen but I also want it to
- 00:14:39be wider because that little circle on
- 00:14:41the right side of the screen just isn't
- 00:14:42big enough for my taste well there's
- 00:14:44another function we could use which is
- 00:14:46set width and we can go ahead and Define
- 00:14:48the minimum offset in pixels for the
- 00:14:50width of this icon the documentation
- 00:14:53states that the default width is 44 but
- 00:14:55let's go ahead and say we want it to be
- 00:14:57200 pixels wide and as you you can see
- 00:14:59now I have my widget that is 200 pixels
- 00:15:02across now another issue is that my
- 00:15:04image inside of my icon is a little bit
- 00:15:06small so what if I want to make it
- 00:15:08bigger well we have another function
- 00:15:10which is set image scale which allows
- 00:15:12you to change the scale of the image the
- 00:15:15default value is 0.5 so let's make our
- 00:15:17image twice as big by passing a value of
- 00:15:20one and there we go now I have a bigger
- 00:15:22Fredy Fazbear inside of my widget now
- 00:15:25maybe I want to stretch the image to fit
- 00:15:28the entire WID of my icon well there's
- 00:15:31another function we can do set image
- 00:15:33ratio to change the ratio of the image
- 00:15:36the default is one which results in a
- 00:15:39perfect square but if I would like to
- 00:15:41stretch it more let me pass a value of
- 00:15:43like let's say six and as you can see
- 00:15:45there is my Freddy Fazbear stretched
- 00:15:47across the entire widget with a ratio of
- 00:15:50six if I would like to squish it in more
- 00:15:53then I can pass a lower value than one
- 00:15:55so I could pass a value of like 0.5 here
- 00:15:57and there we go now my image is nice and
- 00:16:00squished now let's say we had some text
- 00:16:02inside of our label but we wanted to be
- 00:16:04able to change the size of that text
- 00:16:06well we can use a function which is set
- 00:16:08text size to do exactly that and we can
- 00:16:11pass a number to whatever text size we
- 00:16:13want so let's say we want to set it to
- 00:16:15some text that's a little bit bigger
- 00:16:16let's try 40 as you can see there is my
- 00:16:19widget with my small little image and my
- 00:16:21big old text that says hello there now
- 00:16:24maybe you don't like this particular
- 00:16:25font that is being displayed well guess
- 00:16:27what you can change the font as well as
- 00:16:29well using the set text font function
- 00:16:31and here you can pass an enum you could
- 00:16:34pass a font family name or you can pass
- 00:16:38a font family link using the RBX asset
- 00:16:42kind of uh standard string so you can do
- 00:16:44like RBX asset colon sl/ fonts and then
- 00:16:47Define whatever family but to make this
- 00:16:50easy let's just go ahead and do enum do
- 00:16:53font and let's just pick out some kind
- 00:16:55of font in here I don't know which one
- 00:16:56to do let's do uh actually let's do the
- 00:16:59new Builder font yeah there we go let's
- 00:17:01do Builder Sands extra bold and there we
- 00:17:04go now I have my bolded Builder Sands
- 00:17:06text inside of my widget now the
- 00:17:09functionality doesn't stop there because
- 00:17:11what if I would like to be able to open
- 00:17:13another GUI element on the screen based
- 00:17:17on when this particular widget is
- 00:17:19toggled well there is a function called
- 00:17:21bind toggle item where I can pass a GUI
- 00:17:24object or a layer collector and a layer
- 00:17:26collector is just a GUI so it could be a
- 00:17:29GUI or Surface GUI whatever and when my
- 00:17:31widget is toggled or enabled or selected
- 00:17:33or whatever then it's going to also
- 00:17:35select that other GUI object and then
- 00:17:37when I deselect my icon it's also going
- 00:17:39to deselect that other GUI object so
- 00:17:42here I have the screen GUI and started
- 00:17:44GUI right now it's disabled but when I
- 00:17:46enable it it'll show this little stupid
- 00:17:48little text label on the screen well
- 00:17:49let's go ahead and keep it disabled and
- 00:17:51then let's pass that to this function as
- 00:17:55a particular layer collector that we
- 00:17:57would like to toggle when our icon is
- 00:17:59toggled so I'll just make a variable for
- 00:18:02my GUI game get service I'll grab the
- 00:18:05player service get my local player and
- 00:18:07then refer to my player GUI folder and
- 00:18:10let me just use wait for child on that
- 00:18:11just in case and then now I can go ahead
- 00:18:13and pass my guy to my widget and now
- 00:18:16when I go to select my widget what
- 00:18:17you're going to see is that the label
- 00:18:19appears on the screen and then if I
- 00:18:21deselect it also disappears now let's
- 00:18:24say sometime later in your game you
- 00:18:26don't want to have this particular item
- 00:18:28toggleable anymore then you can use
- 00:18:30another function which is going to be
- 00:18:31the unbind toggle item where you can
- 00:18:33pass the same item again and now it will
- 00:18:35no longer be toggled along with the icon
- 00:18:38widgets also have some events with them
- 00:18:40so you can use the bind event function
- 00:18:43to bind to a particular icon event and
- 00:18:46pass a function that's going to execute
- 00:18:48when that event is triggered if we take
- 00:18:49a look at the documentation for events
- 00:18:51we have a selected event we have a
- 00:18:53deselected event we have a toggled event
- 00:18:56a viewing started event a viewing ended
- 00:18:58event and a notified event so these are
- 00:19:00the different events that we can go
- 00:19:01ahead and bind and listen to whenever
- 00:19:04they are triggered so for simple
- 00:19:06demonstration I'm just going to bind to
- 00:19:08let's say the selected event and I'm
- 00:19:10just going to pass my function here and
- 00:19:12all I'm going to do is I'm just going to
- 00:19:13print that uh this icon was selected so
- 00:19:17icon was selected and now when I go and
- 00:19:20select my icon as you can see it printed
- 00:19:23that the icon was selected and then I
- 00:19:24can deselect and then reselect it again
- 00:19:27and it prints it once more inside of the
- 00:19:29console now it's important to note that
- 00:19:31this function does not return some kind
- 00:19:33of connection instance where you can
- 00:19:35disconnect it if you need to be able to
- 00:19:37disconnect a function from a particular
- 00:19:39event then you're going to have to use
- 00:19:41the unbind event function and just pass
- 00:19:44the particular event name in this case
- 00:19:46that would be selected to unbind this
- 00:19:48particular function from that event now
- 00:19:51the features don't stop there we are
- 00:19:53also able to bind a toggle key that we
- 00:19:56can press to open up or basically select
- 00:19:58select and deselect a particular widget
- 00:20:00all we need to do is pass an enum dokey
- 00:20:03code and whatever key we would like to
- 00:20:05use to tongle this widget so let's go
- 00:20:06ahead and do let's say the q key and if
- 00:20:09I hover over my widget what you're going
- 00:20:10to see is a little drop- down caption
- 00:20:12appear showing us that we can press Q to
- 00:20:15basically select this widget so if I go
- 00:20:17ahead and press Q on my keyboard as you
- 00:20:19can see it's selected and when I press
- 00:20:21it again now it's D selected which is
- 00:20:23pretty cool and of course if you don't
- 00:20:25want to have a particular key bound to
- 00:20:26your icon anymore then you can just use
- 00:20:28the unbind toggle key function pass the
- 00:20:31particular key code that you want to
- 00:20:32unbind and you'll be good to go another
- 00:20:34function that we have for widgets is the
- 00:20:36call function and this will allow you to
- 00:20:39pass a call back function here which
- 00:20:41will get past the icon itself but the
- 00:20:44cool thing about this is that this call
- 00:20:46function still Returns the widget so you
- 00:20:47can continue your chain the
- 00:20:50documentation states that this function
- 00:20:52is useful when you need to basically
- 00:20:55extend the behavior of an icon while
- 00:20:57remaining in the this function chain so
- 00:21:00just for demonstration purposes I'm just
- 00:21:02going to print uh this function was
- 00:21:05immediately called and then if we go and
- 00:21:08play the game what you're going to see
- 00:21:09in the console is that this function was
- 00:21:11immediately called and then it also gets
- 00:21:13past the icon to it so if you need to
- 00:21:15extend any other kind of functionality
- 00:21:17in here you can go ahead and totally do
- 00:21:19that another function that we have for
- 00:21:21widgets is going to be the add to
- 00:21:23janitor function which allows you to
- 00:21:25basically pass anything here and that
- 00:21:28particular thing will get cleaned up
- 00:21:30when this particular icon is destroyed
- 00:21:33so as an example let's say I want to
- 00:21:36delete and clean up the screen GUI when
- 00:21:38my icon gets destroyed so I'm going to
- 00:21:40pass my GUI here and then what I'm going
- 00:21:42to do is I'm going to let's say wait for
- 00:21:465 seconds and then I'm going to destroy
- 00:21:48this particular icon and I'm going to do
- 00:21:50that using the destroy function so we'll
- 00:21:53destroy the icon after 5 Seconds which
- 00:21:56should also destroy this GUI now I'm
- 00:21:58going to enable this GUI so we can see
- 00:22:01it on the screen and I'm going to wait 5
- 00:22:03seconds and my widgets should
- 00:22:05disappear there we go it was added to
- 00:22:08the janitor and then once the icon was
- 00:22:10destroyed it got cleaned up by the
- 00:22:11janitor as well now let's say you wanted
- 00:22:13to be able to lock a widget from being
- 00:22:16interacted with you want to prevent the
- 00:22:18player from being able to click it
- 00:22:19deselect it whatever then you can go
- 00:22:21ahead and call the lock function which
- 00:22:24will as it says lock the widget and then
- 00:22:27if you need to unlock un lock your
- 00:22:28widget to uh reenable user input to
- 00:22:32toggle the icon then you can just simply
- 00:22:34call the unlock function so as an
- 00:22:36example right now my widget is locked I
- 00:22:38can't interact with it hovering over it
- 00:22:40with my mouse does nothing and I can't
- 00:22:42do anything I can interact with these
- 00:22:44other widgets though because they are
- 00:22:45not locked now let's say you want to be
- 00:22:47able to lock a widget for a particular
- 00:22:50time period so we can call the debounce
- 00:22:53function and pass a certain amount of
- 00:22:55seconds that we would like to lock this
- 00:22:57particular icon for so let's say we want
- 00:22:59to lock it for 5 seconds and then
- 00:23:02actually what I'm going to do here is
- 00:23:03I'm just going to delay a function for 5
- 00:23:06seconds and then I'll just print out
- 00:23:07saying that the icon shouldn't be locked
- 00:23:11anymore and then right now I can't
- 00:23:13interact with my particular widget but
- 00:23:15we're going to be waiting 5 seconds or
- 00:23:18actually you know what I believe the
- 00:23:19function yield which is why I didn't
- 00:23:21print so yes this function right here
- 00:23:23does yield which is why this didn't
- 00:23:26execute first
- 00:23:28so if you're going to be calling this
- 00:23:29debound function it is going to yield
- 00:23:31your code so if you were to continue
- 00:23:33calling along your chain the next
- 00:23:36function wouldn't execute until this is
- 00:23:38done yielding so we're going to wait for
- 00:23:40those 5 seconds and then it should print
- 00:23:42that it was
- 00:23:43unlocked okay there we go icon shouldn't
- 00:23:46be locked anymore the yield was over
- 00:23:48which created the other widgets and now
- 00:23:50I am able to select my icon again now
- 00:23:53something interesting to note is that
- 00:23:54when you have multiple widgets on your
- 00:23:55screen if you select one and then you go
- 00:23:58and select another one that other widget
- 00:24:00automatically gets deselected now
- 00:24:02sometimes this particular Behavior may
- 00:24:04not be wanted and don't worry there is a
- 00:24:07function to disable that that function
- 00:24:09is going to be the autod deselect and
- 00:24:12you can pass a Boolean if you would like
- 00:24:14to disable it so the default is going to
- 00:24:16be true but let's say for this
- 00:24:17particular icon I do not want to have it
- 00:24:20deselected when another icon is selected
- 00:24:23so as you can see I can go ahead and
- 00:24:24select my icon and then I can select
- 00:24:26another one and look at that that widget
- 00:24:29is still selected now having selectable
- 00:24:31and Des selectable widgets are cool and
- 00:24:33all but let's say you just want a widget
- 00:24:35to act as a simple button you can't
- 00:24:37select it you can't deselect it all you
- 00:24:39can do is just click on it well you can
- 00:24:41use the oneclick function and pass a
- 00:24:44value of true here to convert your icon
- 00:24:47into a oneclick icon and I can hover
- 00:24:49over my widget and I can click it and
- 00:24:52what you'll notice is that well it's not
- 00:24:54selecting my widget anymore the next
- 00:24:57function we're going to take a look at
- 00:24:58is is called set caption so if you saw
- 00:25:00earlier there was a caption that
- 00:25:02appeared underneath our widget when we
- 00:25:04selected or placed a particular toggle
- 00:25:06key on it but let's say you don't want
- 00:25:07to show up some weird toggle key maybe
- 00:25:10you want to put some caption text well
- 00:25:12that's what you can do with this
- 00:25:12function I'll just say that this is an
- 00:25:15example caption and now when you hover
- 00:25:18over your widget as you can see the
- 00:25:19caption appears and it says what we
- 00:25:21wanted this is an example caption we are
- 00:25:24also able to set the caption hint for a
- 00:25:27particular key key code without
- 00:25:29necessarily needing to bind that key
- 00:25:31code to a widget so let's say I liked
- 00:25:34the key code of Q appearing underneath
- 00:25:37of my widget but I didn't actually want
- 00:25:39to bind let's say Q to my widget what
- 00:25:42you'll notice is that the Q caption
- 00:25:45appears underneath my widget but if I
- 00:25:47press Q on my keyboard nothing is
- 00:25:49happening because I didn't actually bind
- 00:25:52Q to my widget another function we're
- 00:25:54going to take a look at is the set
- 00:25:56dropdown function which as the name
- 00:25:58suggests allows you to create a drop
- 00:26:00down for this particular icon and you
- 00:26:02can give it an array of icons that will
- 00:26:04act as children so there'll be children
- 00:26:06of this icon inside of your dropdown so
- 00:26:08for this example I'm just going to pass
- 00:26:10an array and I'm just going to make a
- 00:26:12bunch of new icons in
- 00:26:14here and when I go and select my widget
- 00:26:17you're going to see my drop down appear
- 00:26:18with my three empty icons which is
- 00:26:21really cool now let's say a little bit
- 00:26:23later you had another icon that you
- 00:26:25wanted to be able to add inside of the
- 00:26:27drop down but without having to recall
- 00:26:31set dropdown again and redo all of the
- 00:26:33icons that are already inside of the
- 00:26:35widget well you can easily do so with a
- 00:26:38function called join dropdown so let's
- 00:26:40say with this icon right here and then
- 00:26:43to be able to differentiate it let me
- 00:26:45actually set a label on this so I'll
- 00:26:47just say uh hello and then I'll get rid
- 00:26:50of that and let's say we want to join
- 00:26:52this icon into the drop down of this
- 00:26:54icon well it's really easy to do all we
- 00:26:57need to do is use a function called join
- 00:26:58dropdown and we just need to pass it
- 00:27:01what icon is going to act as the parent
- 00:27:03for this icon and that's going to be our
- 00:27:07icon variable and now what you're going
- 00:27:08to notice is if I select this widget as
- 00:27:11you can see there we go there's my other
- 00:27:14icon that has been joined into the
- 00:27:16dropdown of this icon now there isn't
- 00:27:19just dropdowns but there's also menus
- 00:27:21that open up horizontally so let's go
- 00:27:23ahead and call the set menu function to
- 00:27:26create a new menu on this icon and again
- 00:27:29we need to pass it an array of icons so
- 00:27:31I'll just do icon. new icon. new and
- 00:27:36icon. new and if I go ahead and select
- 00:27:39my widget here there we go it opened up
- 00:27:41with this menu and I have my three other
- 00:27:44icons inside of it that I can select and
- 00:27:46deselect and then I can hover back over
- 00:27:48to my x button and close out that menu
- 00:27:51and of course there's also a function
- 00:27:52for joining an icon into a menu so if I
- 00:27:55would like to add this particular icon
- 00:27:56into the menu of this icon on then I can
- 00:27:59use the join menu function and pass the
- 00:28:02parent icon which is going to be my icon
- 00:28:04and as you can see my hello icon has
- 00:28:06disappeared but if I open up the menu
- 00:28:09there is my hello icon well let's say
- 00:28:11you had an icon joined into the menu or
- 00:28:13Dro down of another icon and you decide
- 00:28:16you know what I don't want it to be
- 00:28:18inside of there anymore how can you do
- 00:28:20that well there is another simple
- 00:28:21function which is simply leave and it
- 00:28:24will allow the icon to hop out or leave
- 00:28:27the menu or drop down that it's inside
- 00:28:29of and then last but not least the final
- 00:28:31function that we saw earlier is the
- 00:28:33destroy function which simply cleans up
- 00:28:35and destroys the icon as we saw earlier
- 00:28:38there are several different events that
- 00:28:40we can access inside of an icon so
- 00:28:42there's going to be the selected event
- 00:28:44that we can go ahead and connect a
- 00:28:47function to so let's just print selected
- 00:28:50here and then we also have the
- 00:28:53deselected event so deselected let's
- 00:28:55connect a function to that
- 00:28:58we have an event called toggled which
- 00:29:01simply fires every single time the
- 00:29:03button is you know toggled or clicked so
- 00:29:05that could happen when it's deselected
- 00:29:07or selected it will fire every single
- 00:29:09time we have another event called
- 00:29:11viewing
- 00:29:12started which occurs when let's say the
- 00:29:15mouse hovers over the widget and then of
- 00:29:18course there is a viewing ended event
- 00:29:22and then last but not least we have the
- 00:29:24notified event which as the name
- 00:29:26suggests will f
- 00:29:28when the icon has a notification appears
- 00:29:31and then down here I'll just make a
- 00:29:32while loop that will let's say every
- 00:29:35single second add a new notification to
- 00:29:40the icon and what we're going to see is
- 00:29:41that we've gotten a notification new
- 00:29:43notification that'll keep happening
- 00:29:45every single second as you can see it's
- 00:29:47also incrementing on my widget and as
- 00:29:50you can see when I hover my mouse over
- 00:29:53the widget it says Mouse hovering over
- 00:29:54widget and then when I leave Mouse is no
- 00:29:56longer hovering over the widget
- 00:29:58if I go ahead and click it we've
- 00:30:00selected it but we've also toggled it
- 00:30:02and then when I click it again we've
- 00:30:04deselected it and we've also toggled it
- 00:30:07icons also have some readon properties
- 00:30:09that you can go ahead and look at one of
- 00:30:11those readon properties is going to be
- 00:30:13the name of the icon which is what we
- 00:30:16would set using the set name function we
- 00:30:18can also read whether or not this icon
- 00:30:20is currently selected with the is
- 00:30:22selected property we can go ahead and
- 00:30:24read whether or not this icon is enabled
- 00:30:26with the enabled is enabled property we
- 00:30:29can read the total amount of notices
- 00:30:31using the total notices property and we
- 00:30:35can also read if this icon is currently
- 00:30:37locked with the is locked or I believe
- 00:30:40is it just locked I think it's just
- 00:30:41locked so actually let's
- 00:30:44print icon. loock and before we do that
- 00:30:47let's go ahead and actually lock the
- 00:30:49icon and if we run the game there we go
- 00:30:51it prints true because the icon is
- 00:30:53currently locked now we also have some
- 00:30:55other functions inside of the icon mod
- 00:30:57modle itself one of those functions is
- 00:31:00the ability to change the display order
- 00:31:03for the GUI that contains all of the
- 00:31:07icons on the screen so we could call the
- 00:31:08function set display order and we pass a
- 00:31:11number to change the display order for
- 00:31:13that GUI so let's say I want to set the
- 00:31:15display order to five and then I messed
- 00:31:17with another GUI to have basically this
- 00:31:20white frame cover the entire screen
- 00:31:23including the GUI inset and its display
- 00:31:25order is set to zero so if we go and
- 00:31:28play test the game what you're going to
- 00:31:29see is that top bar still appears over
- 00:31:32it because it has a display order of
- 00:31:34zero while top bar has a display order
- 00:31:36of five but if I were to have my screen
- 00:31:38GUI with a display order of six instead
- 00:31:41what you're going to see is that top bar
- 00:31:43plus is no longer visible because this
- 00:31:45GUI is being rendered or drawn over top
- 00:31:48bar Plus's GUI another function that we
- 00:31:50have inside of the icon module is the
- 00:31:52ability to change or set whether or not
- 00:31:56we want the entire top bar enabled or
- 00:31:58disabled for all the icons and that
- 00:31:59function is set top bar enabled and we
- 00:32:02need to pass it a buoyant so let's say
- 00:32:04we wanted to hide all of the widgets
- 00:32:07created by this module on the top of the
- 00:32:09screen then we can go ahead and just
- 00:32:11pass false here and that means we
- 00:32:13shouldn't be able to see this icon on
- 00:32:15the screen and as you can see no Widgets
- 00:32:17or no icons are visible from Top Bar
- 00:32:20plus and then the last function that we
- 00:32:22have inside of the icon module is a
- 00:32:25function called modify base theme which
- 00:32:28is the exact same as the other modify
- 00:32:30theme functions where you need to pass a
- 00:32:32table containing the names the
- 00:32:34properties and the values but this
- 00:32:35function will go ahead and apply these
- 00:32:37changes to all icons made by the module
- 00:32:41now one last thing I would like to
- 00:32:42mention with top bar plus is that if we
- 00:32:44go to the icon module and open it up and
- 00:32:46we go to the features folder there is
- 00:32:48going to be a module called themes and
- 00:32:50inside of that module is where you're
- 00:32:51going to find the default theme for top
- 00:32:54bar PFF so if you ever wanted to modify
- 00:32:56the default theme and change up the
- 00:32:58color scheme or whatever you can do so
- 00:33:00by modifying all of the different
- 00:33:01settings here inside of this default
- 00:33:03module and as you can see this module
- 00:33:05also follows the same format as what is
- 00:33:07expected for the modify theme functions
- 00:33:09so it's literally just a table with
- 00:33:11other tables inside of it that contain
- 00:33:13the name of the instance that we want to
- 00:33:14modify the name of the property and then
- 00:33:16the value to apply to that property and
- 00:33:18of course if you always want to look at
- 00:33:20more examples of top bar plus including
- 00:33:22some of the ones that are shown in this
- 00:33:23example gift here then you can head over
- 00:33:25to the V3 playground and here the V3
- 00:33:28playground you can go ahead and hit the
- 00:33:30three dots and you can edit in studio
- 00:33:32and open up your own copy of some of the
- 00:33:34example work that forever HD has made
- 00:33:37for top bar plus version 3 and that's
- 00:33:39about everything with top bar plus it's
- 00:33:42a very useful module to create widgets
- 00:33:44across the top of the screen that match
- 00:33:46the style of the new Roblox UI I'm sure
- 00:33:49a lot of games will be using this new
- 00:33:51version 3 just like how a lot of games
- 00:33:52use the previous version 2 a huge thank
- 00:33:55you to Forever HD for making this sweet
- 00:33:58module and a big thank you to you the
- 00:34:00viewer the link to this Dev Forum post
- 00:34:02for top bar plus version 3 will be in
- 00:34:04the description so go ahead and check it
- 00:34:06out and I will see you next time
- Top Bar Plus
- Widgets
- Roblox UI
- Version 3
- Icones
- Notifications
- Personnalisation
- Événements de widgets
- Compatibilité
- Thèmes