Press F to get badge error

When you press F, you get a badge.

When I test in game. I get : https://gyazo.com/a509734878979cc0da418098c8ade4f8

I’d like to know what I’ve done wrong.

local userInputService = game:GetService("UserInputService")

local badgeservice = game:GetService("BadgeService")
local ID = 2124639051


userInputService.InputBegan:Connect(function(input, gameProcessedEvent)
	
	if input.UserInputType == Enum.UserInputType.Keyboard then
		
		if input.KeyCode == Enum.KeyCode.F then 
			badgeservice:AwardBadge(plr.UserId,id)
		end
			
		
	end
end)
1 Like

To clear up, when I press F, I get an error message.

You have to get the player to get the player’s Id.

1 Like

This is correct, but doesn’t AwardBadge have to be invoked from the server?

Yes, that’s true.

https://developer.roblox.com/en-us/api-reference/function/BadgeService/AwardBadge


https://gyazo.com/0c8951ecfd077d167078c3343879d900

1 Like