Top = Roblox’s version, bottom = my recreation
Table of Contents |
---|
Purpose |
How |
* Getting the base image |
* Set up a button |
* Add an ImageLabel |
Download |
Conclusion |
Purpose
Today, I spent about an hour recreating the default SelectionImageObject
using a variety of resources. To prevent someone else from having to go through what I did, here’s how to create the default SelectionImageObject
.
How
If you don’t want to follow along, you can always hop down to the Download section and pick up an easy copy
Getting the base image
First, you’ll need to get the image from your Roblox folder. On Windows, this will be %localappdata%/Roblox/Versions/{CURRENT_VERSION_HERE}/content/textures/ui/SelectionBox@2x.png
.
If you can’t find here’s a directly uploaded copy:
Or alternatively, use my uploaded image:
Set up a button
Next, you’ll need a button to test this out on. For this demo, I’ll create a ScreenGui
with a TextButton
in it, like this:
Feel free to use any other button, or ideally the one you’re going to want selected!
Here’s what mine looks like:
Add an ImageLabel
Finally, we can just add an ImageLabel
and set it’s .Image
property to the image we just got:
That doesn’t look quite right, though!
Set the size to 1, 0, 1, 0
, the BackgroundTransparency
to 1
, and it looks a bit better:
To fix this up, we change ScaleType
to Slice
, set SliceScale
to 0.5
, and set SliceCenter
to 36, 36, 88, 88
.
However, we’re not quite done, as the original image sticks out a bit, so we need to do the same.
First, we set AnchorPoint
to 0.5, 0.5
and Position
to 0.5, 0, 0.5, 0
to center the image. Then, we can increase the size to 1, 13, 1, 13
to add a bit of padding.
The perk of this setup is if you want to make the selection an outline instead of an inline, you can do so by making the size 1, 26, 1, 26
instead.
And that’s it! Looks pretty perfect, because it is!
Download
Here’s the final results:
DefaultSelectionImageObject.rbxl (39.3 KB)
Conclusion
If you have any questions, suggestions, or other inquires feel free to reply below (so others can benefit) or message me directly!
Thanks for reading!