I’m trying to make some badges for players that get 1,5,20 rebirths, I’ve made a code but It’s not giving the badge to the player. Also is not giving any errors.
badge1rebirth = 2124849496
badge5rebirth = 2124849498
badge20rebirth = 2124849500
wait(10)
game.Players.PlayerAdded:Connect(function(player)
while true do
wait(1)
if player.leaderstats.Rebirths.Value >= 1 then
game:GetService("BadgeService"):AwardBadge(player.userId,badge1rebirth)
elseif player.leaderstats.Rebirths.Value >= 5 then
game:GetService("BadgeService"):AwardBadge(player.userId,badge5rebirth)
elseif player.leaderstats.Rebirths.Value >= 20 then
game:GetService("BadgeService"):AwardBadge(player.userId,badge20rebirth)
end
end
end)
I think it’s bcs rebirths are probably stored in serverstorage but idk how to access it. I also have a badge for people who are in group to get cash and it works and looks like this that’s why I think rebirths are in serverstorage too:
local group = 12524604
local amount = 10000
local serverStorage = game:GetService("ServerStorage")
local playerMoney = serverStorage:WaitForChild("PlayerMoney")
game.Players.PlayerAdded:Connect(function(player)
wait(8)
if player:IsInGroup(group) then
local plrCash = playerMoney:FindFirstChild(player.Name)
if plrCash then
plrCash.Value = plrCash.Value + amount
end
end
end)
local badge1rebirth = 2124849496
local badge5rebirth = 2124849498
local badge20rebirth = 2124849500
local players = game:GetService("Players")
local badgeService = game:GetService("BadgeService")
players.PlayerAdded:Connect(function(player)
local playerStats = player:WaitForChild("leaderstats")
local rebirthStat = playerStats:WaitForChild("Rebirths")
while task.wait(1) do
if rebirthStat.Value >= 1 then
badgeService:AwardBadge(player.UserId, badge1rebirth)
elseif rebirthStat.Value >= 5 then
badgeService:AwardBadge(player.UserId, badge5rebirth)
elseif rebirthStat.Value >= 20 then
badgeService:AwardBadge(player.UserId, badge20rebirth)
end
end
end)