What a badge hitbox is and why you need one
A badge hitbox in Roblox is an invisible collision box that detects when a player touches a part and triggers a badge award. Instead of making the badge itself clickable or visible, you create a separate part — usually a thin block or sphere — that sits on top of or around the badge model. When a player's character touches that part, a script fires and gives them the badge.
This approach solves a real problem: badge models are often small, detailed, or oddly shaped, making them hard to click precisely. A hitbox gives you a larger, predictable target area. Players can walk into it naturally without aiming, and you control exactly where the trigger zone sits.
Key Takeaways
- A badge hitbox is a separate invisible part that detects player contact and awards a badge, not the badge model itself.
- You create the hitbox by inserting a Part into your workspace, scaling it to cover the area where you want the badge to trigger, and setting CanCollide to false so players walk through it.
- A script inside the hitbox part uses the Touched event to detect when a player enters and awards the badge using the BadgeService.
- You must publish your game and add the badge to your game's badge page before the script can award it, or the award will fail silently.
- Use a debounce table to prevent the same player from earning the badge multiple times in a few seconds when they touch the hitbox.
Insert and position a part as your hitbox
Open Roblox Studio and load your game. In the Explorer window on the left, right-click the Workspace folder and select Insert Object. Choose Part from the menu. A new part appears in your workspace — usually a gray block in the center of the map.
Rename this part to something clear like "BadgeHitbox" so you remember what it does. Right-click it in the Explorer and select Rename, or press F2 with it selected. Move and scale the part to cover the area where you want the badge to trigger. Use the Move and Scale tools in the toolbar, or set the Position and Size properties in the Properties panel on the right. Make it large enough that a player walking past will definitely touch it — usually 4 to 8 studs across.
Position the hitbox where your badge model sits. If your badge is on a pedestal, center the hitbox over the top of the pedestal. If it hangs from the ceiling, position the hitbox at the same height and location.
Make the hitbox invisible and non-solid
With the hitbox part selected, look at the Properties panel on the right. Find the Transparency property and set it to 1. This makes the part completely invisible — players will not see it in the game, only the badge model behind it.
Next, find the CanCollide property and set it to false. This means players can walk straight through the hitbox without stopping or bouncing off it. If you leave CanCollide as true, players will bump into an invisible wall and get confused.
You can also set the TopSurface and BottomSurface properties to Smooth to reduce any physics oddities, though this is optional. The key settings are Transparency = 1 and CanCollide = false.
Write a script that detects contact and awards the badge
Right-click the hitbox part in the Explorer and select Insert Object. Choose Script (not LocalScript). A new script opens in the editor. Delete the default code and paste this:
local BadgeService = game:GetService("BadgeService") local badgeId = 0 -- Replace 0 with your badge ID local debounce = {} script.Parent.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if not humanoid then return end local player = game.Players:GetPlayerFromCharacter(hit.Parent) if not player then return end if debounce[player.UserId] then return end debounce[player.UserId] = true BadgeService:AwardBadge(player.UserId, badgeId) task.wait(5) debounce[player.UserId] = nil end)
This script listens for the Touched event on the hitbox. When something touches it, the script checks if it is a player character (by looking for a Humanoid). If it is, the script awards the badge using BadgeService:AwardBadge(). The debounce table prevents the same player from earning the badge again for 5 seconds, even if they touch the hitbox multiple times.
Find your badge ID and insert it into the script
You need your badge's ID number to make the script work. Publish your game first if you have not already — click File and then Publish. Once published, go to your game's page on the Roblox website. Click the three dots menu and select Configure This Game. On the left sidebar, click Badges.
If you have not created a badge yet, click the Create Badge button. Give it a name, description, and icon image. Once the badge exists, you will see it listed on the Badges page. Hover over the badge or click it to find its ID — a number that looks like 123456789.
Copy that ID number. Go back to your script in Studio and find the line that says local badgeId = 0. Replace the 0 with your badge ID. For example: local badgeId = 123456789. Save the script.
Test the hitbox in Studio and in a live server
Click the Play button in Studio to test locally. Walk your character into the hitbox area. If the script works, you should see no error messages in the Output window. However, local testing does not actually award the badge — that only works in a live game server.
To test properly, publish your game and join it from the Roblox website. Walk into the hitbox area. Check your badge inventory on your profile — the badge should appear there within a few seconds. If it does not show up, check the game's server logs. Click the three dots on your game's page, select Manage This Game, then Monitoring to see error messages.
Common issues: the badge ID is wrong, the badge does not exist on your game's badge page, or the script is not inside the hitbox part. Double-check all three before troubleshooting further.
Adjust the hitbox size and debounce timing to fit your game
The hitbox size and debounce delay are not one-size-fits-all. If players are earning the badge too easily or from too far away, make the hitbox smaller. If they have to be very precise to trigger it, make it larger. You can adjust the Size property anytime without republishing.
The debounce delay (the 5 in task.wait(5)) controls how long a player must wait before they can earn the badge again from the same hitbox. If you want players to earn it only once per game session, increase this to 300 (5 minutes) or higher. If you want them to earn it multiple times, lower it or remove the debounce entirely — though this is rare for badges.
Test these changes in a live server, not in Studio, because the badge award only works on live servers. Make a small change, republish, join the game, and see how it feels.
Frequently Asked Questions
Can I use a different shape for the hitbox instead of a block?
Yes. Instead of a Part, you can insert a Ball (sphere) or use a custom mesh. The script works the same way — it listens to the Touched event on whatever part you put the script in. A sphere is often better for round badges, and a thin block works well for wall-mounted badges.
What if the badge is not awarding even though the script runs?
The most common cause is that the badge does not exist on your game's badge page, or the badge ID in the script is wrong. Go to your game's Configure page, click Badges, and verify the ID matches exactly. Also make sure you are testing in a live server, not in Studio — local testing never awards badges.
Can multiple players earn the badge from the same hitbox?
Yes. The debounce table tracks each player separately by their UserId, so ten players can all touch the hitbox and each earn the badge. The debounce only prevents the same player from earning it twice within 5 seconds.
How do I make the hitbox visible while I am building, then invisible in the game?
Set Transparency to 0 while you are building and positioning. Once it is in the right place, set Transparency to 1. The change takes effect immediately in Studio and in live servers. You do not need to republish to change transparency.
What happens if a player touches the hitbox but does not have a Humanoid?
The script checks for a Humanoid and returns early if it does not find one. This prevents non-player objects (like other parts or NPCs without humanoids) from triggering the badge. Only player characters with a Humanoid can earn it.