Show the server code with my function
BRB rq
Show the server code with my function
BRB rq
its literally just ur function
That is such a security flaw, expect exploiters to get all badges easily and don’t base your game off of badge ownership
If all other badges are awarding correctly using this function (despite the security issue @Varonex_0 ) the issue must be with the badge itself.
When did you create the badge and is the image associated with the badge pending approval?
Also the error would read unable to index nil with UserId
if the player was nil, so the userid would be invalid somehow?
This isn’t how pcall works, you need to pass the function address and then its arguments
pcall(Thing, Plr.UserId, BadgeId)
How did you fetch the badge id? Can I get a link to its page?
not sure if you have a solution yet but imma yap
local BadgeService = game:GetService(“BadgeService”)
if not BadgeService:UserHasBadgeAsync(Player.UserId, BadgeID) then
BadgeService:AwardBadge(Player.UserId, BadgeID)
end
i read a little of the chat and i saw you wrapped in pccall which showed missing argument #1 on line 10 as i didnt see the full script i cant tell what line that was referring to but im assuming that it was the remote connection and the pccal was wrapped incorrectly so again shot in the dark not sure
i did see you were saying the issue was player didnt exist but i dont think thats the case given it wouldve returned an error like it does in mine when it cant find the player id
Are you sure this is the correct badge ID then? bcs thats the only other thing i can think of if all other badges in the game work, i saw you quoted “6433767682” as the badge id but when i attempted to search for that nothing showed up, is the badge active and did you copy the right badge id?
@SASQUACH_PLAYZ123 this url (https://www.roblox.com/badges/6433767682) leads to a 404 page. It may be due to a few reasons but my guess is that it’s just not a valid BadgeId. It would be the best explanation since you got this error message that correlates with what I say, and basically sums up the entire thing.
The reason why you have never had this warning before is quite outstanding to me. Did you print (using warn
) the thrown error of the pcall? It seems odd to discover this after 40+ messages in this thread.
To elaborate, I used BadgeService.GetBadgeInfoAsync
in studio, with a badge from your game. Its ID is 2960319354054680
as seen in the URL.
The result:
That means I can read badge infos, no matter who owns it. The boolean IsEnabled
implies that I can also fetch badge infos from badges that are not enabled.
Doing this with the ID 6433767682
gives me this :
So the problem IS definitely the fact you have indicated an invalid badge ID. Problem solved.
It appears that awarding a badge that doesn’t exist doesn’t throw any error as shown below in a real server:
This should be the source of a bug report I am willing to open. I do not know if it only affects IDs that do not exist or not, either way this should be treated as unexpected behavior, and explains why you had issues troubleshooting this problem. Bug report opened. Link available in “EDIT” section.
After thoroughly checking the documentation, it appears that AwardBadge
does NOT throw errors for badges that do not exist. It returns a boolean
describing whether or not the badge was successfully awarded. The recommended pcall wrapping is most likely due to possibilities of the API failing. No warning is to be expected from invalid BadgeId. This behavior isn’t specified. I am still filing a bug report to see what happens.
The bug report is available here : BadgeService.AwardBadge does not throw any warning/error for invalid BadgeId (or badges that cannot be awarded in specific contexts)
Y’all are asking for the badge id:
https://www.roblox.com/badges/3403492635889423/Did-what-you-were-meant-to-do
if it helps in any way lol
Not so sure about this … If he has it in his inventory of badges then yes. But you can remove badges. If removed he would be able to receive it. (I think, I know this works with gamepasses).
Idm to cut down on possible errors try removing everything but giving them the badge. Focus on that then work your way back.
Then fire the event with the BadgeId in the url ! What is the ID you put in the script in OG message? Isn’t that your UserId or something?
Like what you wrote is
game.ReplicatedStorage.Badge:FireServer(6433767682) -- The RemoteEvent
What ID is 6433767682
? The ID of the badge that you want to test is 3403492635889423
as featured in the url you provided
You are receiving the event in such a way that you want to receive the badge id since it has a function with the Player param, and the BadgeId param
game.ReplicatedStorage.Badge.OnServerEvent:Connect(function(Plr, BadgeId)
game:GetService("BadgeService"):AwardBadge(Plr.UserId, BadgeId)
end)
So you need to locally fire the event with a valid BadgeId, which is what I explained in my previous post
You’re not doing it, instead you’re setting whatever id 6433767682
is, so don’t expect the game to award you the badge with id 3403492635889423
omg… im such an idiot… i was using the assetid for a gamepass in the shop…
the test ._.