Giving badge on touch script not working

Hello! I am a new scripter on Roblox. Like very new, but anyway I wanted to make a script that allows players to earn a badge when they touch certain parts. This is for my Obby that I have been working on. I tried to scripting a part to do so and I have no luck :frowning: I have watched multiple YouTube videos and looked on google to try to find a working script, but I can’t find one. When I run the script it has no errors. Here is my script that I am using

local BadgeService = game:GetService("BadgeService")
local id = 2124656502
local badgegive = script.Parent

badgegive.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
		if not BadgeService:UserHasBadgeAsync(plr.UserId, id) then
			BadgeService:AwardBadge(plr.UserId, id)
		end
	end
end)

If anybody could please help it would be greatly appreciated!
Thank You!

I don’t think you would need their UserId. Instead, just use their name.

You do in fact need the UserId.

To OP - you posted this multiple times. There’s no need to do that

1 Like

Is your badge active?

Yes, both are because I need to have two different parts give two different badges

Well I still need some help and nobody will respond to those ones. Do I delete the ones that nobody responds to anymore?