I want to see if a value is over 47, give all players in the server a badge. I just don’t know how to do it lo I don’t know much about scripting so pls help (I didn’t find this anywhere so yeah)
Heres some example code if u wana finish it lo
local badgeService = game:GetService("BadgeService")
local function giveBadgeToAllPlayers(someBadgeID)
for _, p in ipairs(game.Players:GetPlayers()) do
pcall(function() badgeService:AwardBadge(p.UserId, someBadgeID) end)
end
end
There are multiple videos on how to make badges on YouTube, but here is one that I’d recommend:
You could also check out Roblox’s API, that has a built in tutorial at the bottom, on the DevHub: BadgeService
The documentation website is mostly the same as the DevHub, but is more recent. It is in beta however. Here is the badges api on there: BadgeService | Roblox Creator Documentation
local BadgeServ = game:GetService("BadgeService")
local Value --Wherever the value is
local GiveBadge = workspace.GiveBadge
local BadgeId = 1234567890
Value.Changed:Connect(function(v)
GiveBadge.Value = v > 47
end)
GiveBadge.Changed:Connect(function(BadgeGiven)
if BadgeGiven then
for _, v in pairs(game.Players:GetPlayers()) do
if v.Character and v.Character:FindFirstChild("Humanoid") then
BadgeServ:AwardBadge(v.UserId, BadgeId)
end
end
end
end)