It still does not give me the badge. It prints “Here is your badge” but it won’t give me the badge.
You should restart studio… I looked at the badgeservice website… you did everything correct. (userId, then the badge id.) there should be no reason why this isnt working. You should restart studio, or your computer / laptop. If that still doesnt work… then you might need to uninstall studio and install it again… still doesnt work? I dont know what to tell you… it might be a pretty serious glitch.
WAIT, is your badge even available for the public to be awarded?? (Enabled)
local __BADGESERVICE = game:GetService("BadgeService")
local __ID = 2457454485 -- !! REPLACE
local success, fail = pcall(function()
return __BADGESERVICE:GetBadgeInfoAsync(__ID)
end)
if success then
print(fail.IsEnabled)
end
You MUST also own the BADGE:
-
The player must be presently connected to the game.
-
The player must not already have the badge (note that a player may delete an awarded badge from their profile and be awarded the badge again).
-
The badge must be awarded from a server-side Script or a ModuleScript eventually required by a Script, not from a LocalScript.
-
The badge must be awarded in a place that is part of the game associated with the badge.
-
The owner of the place must also own the badge (for example, the owner must not have deleted the badge).
-
The badge must be enabled; check this using the IsEnabled property of the badge fetched through BadgeService:GetBadgeInfoAsync().
from the docs.
Can you double check by clicking the three dots and see if theres the option to remove from inventory?
Also it says the badge is active where there is the slider to change it from active to inactive or inactive to active.
Ok… you should try weakroblox35’s script then to see if its not enabled
I’m not sure what to put it under. I have not restarted studio yet by the way.
Shouldnt you just put it in the badge script?
It’s just a normal server-script it can be put anywhere it can run. Just play the game and show output for any true/falses. Don’t put it in the .Touched (Award Badge one) script.
It printed “true”. Does that mean it’s active? I put it in a new script under ServerScriptService.
Yes of course, then the last issue is you don’t own the badge, you need to own it.
I do not own the badge and I am not sure how to get it.
Try using the snippet provided in the roblox docs and see if any errors print.
local BadgeService = game:GetService("BadgeService")
local __PLAYERS = game:GetService("Players")
local __ID = 4574163471527 -- !! REPLACE
local function awardBadge(player, badgeId)
-- Fetch Badge information
local success, badgeInfo = pcall(BadgeService.GetBadgeInfoAsync, BadgeService, badgeId)
if success then
-- Confirm that badge can be awarded
if badgeInfo.IsEnabled then
-- Award badge
local awarded, errorMessage = pcall(BadgeService.AwardBadge, BadgeService, player.UserId, badgeId)
if not awarded then
warn("Error while awarding Badge:", errorMessage)
end
end
else
warn("Error while fetching Badge info!")
end
end
script.Parent.Touched:Connect(function(__PART)
local __PLAYER = __PLAYERS:GetPlayerFromCharacter(__PART.Parent)
if __PLAYER ~= nil then
print("Here is your badge")
awardBadge(__PLAYER, __ID)
end
end)
Do I do the same thing as I did with the other script? (Make a new script and put it under ServerScriptService)
Sure.
It did not seem to do anything. I didn’t print anything either. I do not own the badge still.
Something is wrong with your badge, can you run this in command bar?
local __BADGESERVICE = game:GetService("BadgeService")
local __ID = 2457454485 -- !! REPLACE
__BADGESERVICE:AwardBadge(game:GetService("Players"):FindFirstChild("qpwoeiruty122333").UserId, __ID)
After that, check if you got the badge in your inventory.
Says this in output:
Sorry, badges can only be awarded by Roblox game servers - Studio