#issues with awarding badges
58 messages · Page 1 of 1 (latest)
its still doing this
So do prints to see what it says about that error
howd i do that?
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)
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)```
ill test this now
this was the only thing that popped up (ignore the infinite yield thing)
so any other errors so it did print so anyother errors
so it kinda worked
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?
Ye
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
this is why i prob dont use Badges but im still learing
hm
nope
the connect function works but not the actual badge giving script
On server event on a local script ?
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)
i saw you edit that a few times lmao
** You are now Level 7! **
is that the final code?
i think
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?
Maybe wrong badge id
ill have a look
i copied and pasted it
ah, capitilization errors
still wont work :/
could the badge be private maybe
hm
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)