You met the creator badge

Is there any errors?


In the dev console there are, but there not for the scipt

better version:

local ownerId = 69420 -- the owner's userid

local BadgeService = game:GetService("BadgeService")
local function awardBadge(plr, badgeId)
	local success, badgeInfo = pcall(BadgeService.GetBadgeInfoAsync, BadgeService, badgeId)
	if success then
		if badgeInfo.IsEnabled then
			local awarded, errorMessage = pcall(BadgeService.AwardBadge, BadgeService, plr.UserId, badgeId)
		end
	end
end
function init(plr)
	for _,v in pairs(game.Players:GetPlayers()) do
		if v.UserId = ownerId then 
	                awardBadge(plr, 2128736008) -- you forgot to put the player on the first argument
                    break -- dont forgor to break
                end
        end
end
for i, v in next, game.Players:GetPlayers() do
        init(v) -- catch previous players
end
game.Players.PlayerAdded:Connect(init)

i recommend using userids instead of finding an instance named “CFTD_services”. because i think your script will never find one even when the owner is in the server

Still does not work, I have it in a script in serverscriptservice, should it be in a local script?

dont put it in a localscript. any errors?

You are only giving the badge id in awardBadge, try awardBadge(plr, 2128736008)

It’s not it a localscript it’s just in a script is severscriptservice.

Errors:

That’s a client error, not a server error. Have you tried what I said over here:

(In your original script)

Where in the script do I put that?

game.Players.PlayerAdded:Connect(function(plr)
	for _,v in pairs(game.Players:GetPlayers()) do
		if v:FindFirstChild("CTFD_services") then 
			awardBadge(2128736008) -- Here
		end
	end
end)

Still did not work

Are you sure you’ve given me the full script? Line 8 on your original script is just an end (and all the parentheses are closed as far as I can tell), so it wouldn’t cause an error like that.

Yes

local BadgeService = game:GetService("BadgeService")
local function awardBadge(plr, badgeId)
  local success, badgeInfo = pcall(BadgeService.GetBadgeInfoAsync, BadgeService, badgeId)
  if success then
    if badgeInfo.IsEnabled then
      local awarded, errorMessage = pcall(BadgeService.AwardBadge, BadgeService, plr.UserId, badgeId)
    end
  end
end
game.Players.PlayerAdded:Connect(function(plr)
for _,v in pairs(game.Players:GetPlayers()) do
If v:FindFirstChild("Your Username") then 
awardBadge(v, IdHere)
end
end
end)

Make sure to replace the uppercase “If” that you have with an “if”.

Other than that, make sure you don’t use v here:

game.Players.PlayerAdded:Connect(function(plr)
for _,v in pairs(game.Players:GetPlayers()) do
If v:FindFirstChild("Your Username") then -- Uppercase Ifs don't work
awardBadge(v, IdHere) -- This will only award the player with the found username
end
end
end)

Instead, do this:

game.Players.PlayerAdded:Connect(function(plr)
	for _,v in pairs(game.Players:GetPlayers()) do
		if v:FindFirstChild("Your Username") then 
			awardBadge(plr, IdHere)
		end
	end
end)

So like this:

game.Players.PlayerAdded:Connect(function(plr)
	for _,v in pairs(game.Players:GetPlayers()) do
		if v:FindFirstChild("My Username") then 
			awardBadge(plr, badgeID)
		end
	end
end)

Yes, that’s what it would be. (As long as you replace the string and make the badgeID a variable or replace it)

game.Players.PlayerAdded:Connect(function(plr)
	for _,v in pairs(game.Players:GetPlayers()) do
		if v:FindFirstChild("CTFD_services") then 
			awardBadge(plr, 2128736008)
		end
	end
end)

Test it out to see if it works, since I can’t do that for you (I can’t award a badge that isn’t mine). It should work though

I tried it is studio and in-game, still does not work

And you’ve made completely sure you don’t own the badge (and there’s no errors)?