The function does not give a badge

Hello everyone, I wanted to do script so that after the player steps on the Part, he will be given an Alpha tester badge, but this function does not work.
image
Script:

local badgeservice = game:GetService("BadgeService")
local id = 2127395398
script.Parent.Touched:Connect(function(hit)

	if hit.Parent:FindFirstChild("Humanoid") then

		local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
		badgeservice:AwardBadge(plr.UserId, id)
	end
end)

Do you already own the badge? When you create a badge you automatically own it. If you are testing this in studio then you cannot get badges in studio.

1 Like

you cant get badges on roblox studio

1 Like

As @BirdieI90 said, you aren’t able to award badges via Roblox Studio, add a line of code printing something in the output log if you want to test the function. Here’s an example

if hit.Parent:FindFirstChild("Humanoid") then

		local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
		badgeservice:AwardBadge(plr.UserId, id)
        print("Badge Awarded")
	end
1 Like

Oh, I didn’t know that, thanks for telling me