That means there was no code error. It is probably your badge settings. Would u mind linking ur game? (If it’s public)
kk:
ur ment 2 get the badge when u roll
Did you actually call the function?
Let’s see ur code with my function
--__Config______________
local Items = {
["~✨~"] = 09,
["~🔥~"] = 20,
["~❤️~"] = 35,
["~⭐~"] = 12,
["~🤩~"] = 10,
["~🎵~"] = 10,
["~😀~"] = 40,
}
local hideprint = true
--___Player__________________________
local Player = game.Players.LocalPlayer
local Character = Player.Character
--___________________________________
--___Rolling_________
local Weight = 0
--___________________
--________Instances_______________
--_______DataStore____________
-- *_______W.I.P___________*
-- * I hate Datastore*
--_____________
--________Rolling__________
local Roll = script.Parent.Roll
local Auto = script.Parent.Auto
--_________________________
--_______Words____________________
local WordsB = script.Parent.WordsB
local WordsF = script.Parent.WordsF
local WordsSF = WordsF.ScrollingFrame
local Wordst = WordsSF.Template
--________________________________
--________Settings_________________
local SettingsB = script.Parent.SettingsB
local SettingsF = script.Parent.SettingsF
--_________________________________
--____________Functions____________________________
function Roller()
for _, Chance in pairs(Items) do
Weight += (Chance * 10)
end
local ranNumber = math.random(1, Weight)
Weight = 0
for Prize, Chance in pairs(Items) do
Weight += (Chance * 10)
if Weight >= ranNumber then
if hideprint == false then
print(Prize.." was won")
end
local Clone = script.Rolling:Clone()
Clone.Parent = script.Parent
Clone.Text = "Rolling..."
wait(2)
Clone.Text = "You got: "..tostring(Prize)
wait(1)
Clone:Destroy()
WordsSF:WaitForChild(Prize).TextColor = BrickColor.new("Lime green")
game.ReplicatedStorage.Badge:FireServer(6433767682)
break
end
end
end
--________________________________
--______Loaders_____________
for i, v in pairs(Items) do
local Item = Wordst:Clone()
Item.Parent = WordsSF
Item.Name = i
Item.Text = i.." - "..v.."%"
Item.Visible = true
end
--___________________________
--__________Interations_______________________________________
Roll.MouseButton1Click:Connect(function()
Auto.State.Value = false
Auto.BackgroundColor = BrickColor.new("Bright red")
Auto.Text = "Auto Roll: Off"
Roll.Visible = false
Roller()
Roll.Visible = true
end)
Auto.MouseButton1Click:Connect(function()
if game.Players.LocalPlayer:IsInGroup(34803435) then
if Auto.State.Value == false then
Auto.State.Value = true
Auto.BackgroundColor = BrickColor.new("Slime green")
Auto.Text = "Auto Roll: On"
while true do
if Auto.State.Value == true then
Roller()
wait(1)
else
break
end
end
else
Auto.State.Value = false
Auto.BackgroundColor = BrickColor.new("Bright red")
Auto.Text = "Auto Roll: Off"
end
else
Auto.Text = "You must join the group for auto roll"
end
end)
WordsB.MouseButton1Click:Connect(function()
WordsF.Visible = not WordsF.Visible
end)
SettingsB.MouseButton1Click:Connect(function()
SettingsF.Visible = not SettingsF.Visible
end)
everything here is working fine, seeing as at the start I made it print “badge” when it ran the remote event
What about the server code?
This text will be blurred
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.
EDIT
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 ._.