Hello develupers previously I maked a post talking about this, they gave me a script and I marked it as a solution but the script didn’t worked, then I want to make a players get badge if my badgeValue in replicated storage is marked at true there’s a way to make this? Thanks for help.
local badgeServ = game:GetService("BadgeService")
local replicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
if replicatedStorage.BadgeValue.Value then
for _, Player in ipairs(Players:GetPlayers()) do
badgeServ:AwardBadge(Player.UserId, ID)
end
end
Oh yeah the the badge value was supposed to be marked like this and not like I used to do.(local BadgeValue = game.replicatedStorage.BadgeValue) Thanks for your help.
Other question I put this script on SeverScriptService? I put and I make (local ID = "my Badge ID ") and didn’t worked.
That’s because it’s a string, the ID must be a number value.
local ID = 000000
Wath you wold I make? the script there’s not working.
What do you mean? I don’t really understand what you’re saying.
This would it be:
local badgeServ = game:GetService("BadgeService")
local replicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local ID = 000000 -- Put your badge ID here
if replicatedStorage.BadgeValue.Value then
for _, Player in ipairs(Players:GetPlayers()) do
badgeServ:AwardBadge(Player.UserId, ID)
end
end
I want the player get the badge only when my boolValue on replicated storage is = true.
you never specified what’s not working, did you get any errors on the old script? you also didn’t post the old script either
I made some changes of my script, try it again.
Okay I will try it (the post be a least 30 caracters)
Not worked the value was marked as true but the badge didn’t appear, there is no error in the output I have no idea wath is going wrong.
Can’t you put it like this? If replicatedStorage.Value == true then…
Well I want to make a victory badge like canping then I wanted to make a boolValue that will be true at end of the game is it.
Wait the the local ID = 000000, the correct is ID = 0000000??
local badgeService = game:GetService("BadgeService")
local badgeId = 0 -- Change to your BadgeID!
local replicatedStorage = game:WaitForChild("ReplicatedStorage")
local badgeValue = replicatedStorage:FindFirstChild("", true) -- Just add the name of the bool value in the quotes, the script will do the rest!
if badgeValue then
local players = game.Players:GetPlayers()
for i = 1, #Players do
local currentPlayer = Players[i]
if not badgeService:UserHasBadgeAsync(currentPlayer.UserId, badgeId) then
badgeService:AwardBadge(currentPlayer.UserId, badgeId)
end
end
end
This should work, let me know otherwise!
This error shows ,attenp to get length of a nil value
Wait a second ,worked but not with the value worked when I disabled the script and in a other script I enabled the script and worked