Badge award is not giving the badge to a player

hi can someone help me with my script becuz the badge is not giving it to a player and i think im doing my script wrong also there is no error in the script and im also new to scripting so yeah. yes i already tried looking at some tutorials in yt and devhub

local bID=0000000000 -- it has id i just put it as 00000 lol
local bs=game:GetService('BadgeService')
while wait() do
    if game.Workspace.CurrentCamera ~= game.Workspace:WaitForChild("RingCamera") then
        script.Parent.GiveGui.MainGui.Blind.Visible = true
    else
        script.Parent.GiveGui.MainGui.Blind.Visible = false
    end
end
        script.Parent:Connect(function(player)
        bs:AwardBadge(player, bID)
end)
2 Likes

You have to put the:

script.Parent:Connect(function(player)
        bs:AwardBadge(player, bID)
end)

Over the while wait do
Maybe this works

1 Like

What’re you trying to do exactly?

im trying to award the badge after the blind.visible = false

what do you mean by: script.Parent:Connect(function(player)?

Oh I see. You’ll have to utilise RemoteEvents as you can’t award badges from the client.

Insert a RemoteEvent into ReplicatedStorage.

local remote = game.ReplicatedStorage.RemoteEvent
local blind = -- Path of the blind here

blind.Changed:Connect(function()
    if blind.Visible == false then
        remote:FireServer()
    end
end)

Insert a Script in ServerScriptService:

local badgeService = game:GetService("BadgeService")
local remote = game.ReplicatedStorage.RemoteEvent
local badgeId = -- Your badge ID here

remote.OnServerEvent:Connect(function(player)
    badgeService:AwardBadge(player.UserId, badgeId)
end)
2 Likes