Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How do i put badges in my zombie map that are given when a certain round is reached

Asked by 6 years ago

like the ones in Der Reise http://www.roblox.com/Der-Riese-v0-2-New-Sounds-place?id=17888427

2 answers

Log in to vote
1
Answered by
Unclear 1776 Moderation Voter
6 years ago

The first thing you want to do is figure out when to award badges. You can do this by integrating the badge awarding process directly in the loop controlling the progression of rounds, and checking whether the round matches the required round to award the badge for.

You can use the AwardBadge method to actually award Badges to players. Here's an example of the AwardBadge method being used, assuming the variable player references the player that will earn the badge and the variable badgeId is the number ID of the badge asset.

game:GetService("BadgeService"):AwardBadge(player.userId, badgeId)

To award all players, you can just use a simple loop iterating through all of the players in the game. The line of code above will turn into...

for _, player in pairs(game.Players:GetPlayers()) do
    game:GetService("BadgeService"):AwardBadge(player.userId, badgeId)
end

You can read more about BadgeService on the Wiki.

Ad
Log in to vote
0
Answered by
Shawnyg 4241 Trusted Badge of Merit Snack Break Moderation Voter Administrator Community Moderator Super Administrator
6 years ago

You'd need the AwardBadge Method. For leaderstats, just add this: (I'm assuming you have the leaderstat script already)

lstat = "Leaderstat name here"
badge = 1337 --ID here
waveneeded = 5 --wave needed to get badge
game.Players.PlayerAdded:connect(function(plr)
    repeat wait() until plr.leaderstats
    repeat wait() until plr.leaderstats[lstat]
    repeat wait() until plr.leaderstats[lstat].Value == waveneeded
    if not game:GetService("BadgeService"):UserHasBadge(plr.userId, badge) then
    game:GetService("BadgeService"):AwardBadge(plr.userId, badge)
    end
end)

Answer this question