#issues with awarding badges

58 messages · Page 1 of 1 (latest)

unreal sinew
#

this error comes up if i try to initiate the thing to give the badge, how do i fix this (code attached also)

tough dew
#

U did connect

#

It’s Connect

unreal sinew
#

oh yeah

#

ill check if that works

unreal sinew
tough dew
#

So do prints to see what it says about that error

unreal sinew
#

howd i do that?

tough dew
#

Can u show full code like a lua

#

Not a screenshot

unreal sinew
#

local event2 = game.ReplicatedStorage:WaitForChild("BadgeGiver")
local BadgeService = game:GetService("BadgeService")
local badgeId = 4467929372
local Player = game.Players.LocalPlayer

function Award(id, badgeid)
BadgeService:AwardBadge(id, badgeid)
print("awarded badge to player, enjoy :)")
end

event2.OnServerEvent:Connect(Award)

tough dew
#

so like this```lua
local event2 = game.ReplicatedStorage:WaitForChild("BadgeGiver")
local BadgeService = game:GetService("BadgeService")
local badgeId = 4467929372
local Player = game.Players.LocalPlayer

function Award(id, badgeid)
print("Awarding badge to player with id:", id)
BadgeService:AwardBadge(id, badgeid)
print("Badge awarded successfully!")
end

event2.OnServerEvent:Connect(function(player)
print("Received server event from player with name:", player.Name)
if player == Player then
Award(player.UserId, badgeId)
end
end)```

unreal sinew
#

ill test this now

unreal sinew
tough dew
#

so any other errors so it did print so anyother errors

unreal sinew
#

nothing else

#

just that

tough dew
#

so it kinda worked

unreal sinew
#

yeah it might of not printed the rest because im in roblox studio

#

do you need to be in the actual game for it to give you a badge?

tough dew
#

Ye

unreal sinew
#

ah that might be why its not printing anything else

#

ty for this!

#

@tough dew the script still wont work...

#

it wont award the badge

tough dew
#

this is why i prob dont use Badges but im still learing

unreal sinew
#

hm

agile finch
#

Fixed

#

?

unreal sinew
#

nope

unreal sinew
agile finch
#

On server event on a local script ?

unreal sinew
#

this script is a server script

#

where the event is coming from is a local script

agile finch
#
local event2 = game.ReplicatedStorage:WaitForChild("BadgeGiver")
local BadgeService = game:GetService("BadgeService")
local badgeId = 4467929372


function Award(id, badgeid)
    print("Awarding badge to player with id:", id)
    BadgeService:AwardBadge(id, badgeid)
    print("Badge awarded successfully!")
end

event2.OnServerEvent:Connect(function(player)
    print("Received server event from player with name:", player.Name)
        Award(player.UserId, badgeId)
end)
unreal sinew
#

i saw you edit that a few times lmao

wispy karmaBOT
#

studio** You are now Level 7! **studio

unreal sinew
#

is that the final code?

agile finch
#

i think

unreal sinew
#

ill test it now and tell you if it works

#

that worked! tysm

#

ill hop into a game and see if it actually works in the game

#

im not sure if it doesnt work or it wont give me the badge because i made it

#

can you test it?

#

what might be the issue then?

agile finch
#

Maybe wrong badge id

unreal sinew
#

ill have a look

agile finch
#

O

#

badgeId not badgeid

unreal sinew
#

i copied and pasted it

unreal sinew
unreal sinew
#

could the badge be private maybe

agile finch
#
local event2 = game.ReplicatedStorage:WaitForChild("BadgeGiver")
local BadgeService = game:GetService("BadgeService")
local badgeId = 4467929372


function Award(id)
    print("Awarding badge to player with id:", id)
    local success,err  = pcall(function()
      BadgeService:AwardBadge(id, badgeId)
    end)
    print(success,err)
    print("Badge awarded successfully!")
end

event2.OnServerEvent:Connect(function(player)
    print("Received server event from player with name:", player.Name)
        Award(player.UserId)
end)
unreal sinew
#

this is what it says, but i tested it in game and it still wont give it to me

#

maybe its not even this script