Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i make a badge award you after a certain amount of time?

Asked by
ads_bv 29
3 years ago

when i tried scripting a badge awarding you after 1800 seconds. here is what i put for the script local badgeservice = game:GetService("BadgeService") local id = 21283716

wait(1800) badgeservice:AwardBadge(id)

1 answer

Log in to vote
0
Answered by 3 years ago

You forgot to specifie which player you want to award, so it won't work!

what i understood is that you want a player awarded if he has 1800 seconds in game time here the script : (put on serverscriptservice, must be an global script)

game.Players.PlayerAdded:connect(function(plr)

local badgeservice = game:GetService("BadgeService") 
local id = 21283716

local break_ = false

local con = nil
con = game.Players.PlayerRemoving:connect(function(plr2)
if plr2 == plr then
      break_ = true
con:Disconnect()
end
end)
local time = 0

while true do
wait(1)
time = time + 1

if time >= 1800 then
badgeservice:AwardBadge(plr.UserId,id)
break
end

if break_ == true then
     break
end

end

con:Disconnect()

end)
Ad

Answer this question