local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local BadgeService = game:GetService("BadgeService")
local MILLIONAIRE_BADGE_ID = 4320183360723226
local millionaireStore = DataStoreService:GetDataStore("MillionaireBadges")
local function checkCash(player)
local cash = player:FindFirstChild("leaderstats"):FindFirstChild("Cash")
if not cash then return end
local success, hasBadge = pcall(function()
return millionaireStore:GetAsync(player.UserId)
end)
if not success or not hasBadge and cash.Value >= 1000000 then
BadgeService:AwardBadge(player.UserId, MILLIONAIRE_BADGE_ID)
millionaireStore:SetAsync(player.UserId, true)
end
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
wait(1)
checkCash(player)
end)
end)
It is not working and idk why, can any1 help ?