As you can see in the image above, that exact error has been slowing down my game by causing constant error like that. I have tried finding a way to stop it from making the error, but what could be making it? The script is below.
local BadgeService = game:GetService("BadgeService")
local Badge1 = 2124822573
local Badge2 = 2124822835
local Badge3 = 2124823020
local Badge4 = 2124823022
local Badge5 = 2124823023
local Badge6 = 2124823024
local Badge7 = 2124823028
local Badge8 = 2124830972
local Badge9 = 2128555988
local Badge10 = 2128555990
local PaperBadge = 2125979732
local WetBadge = 2126547317
local G17Badge = 2127772349
--[ FUNCTIONS ]--
game.Players.PlayerAdded:Connect(function(player)
if BadgeService:UserHasBadgeAsync(player.UserId,Badge1) == false then
local leaderstats = player:WaitForChild("leaderstats")
player.leaderstats.Kills.Changed:Connect(function()
if player.leaderstats.Kills.Value >= 1 then
pcall(BadgeService.AwardBadge, BadgeService, player.UserId, Badge1)
end
end)
else
end
if BadgeService:UserHasBadgeAsync(player.UserId,Badge2) == false then
local leaderstats = player:WaitForChild("leaderstats")
player.leaderstats.Kills.Changed:Connect(function()
if player.leaderstats.Kills.Value >= 25 then
pcall(BadgeService.AwardBadge, BadgeService, player.UserId, Badge2)
end
end)
else
end
if BadgeService:UserHasBadgeAsync(player.UserId,Badge3) == false then
local leaderstats = player:WaitForChild("leaderstats")
player.leaderstats.Kills.Changed:Connect(function()
if player.leaderstats.Kills.Value >= 50 then
pcall(BadgeService.AwardBadge, BadgeService, player.UserId, Badge3)
end
end)
else
end
if BadgeService:UserHasBadgeAsync(player.UserId,Badge4) == false then
local leaderstats = player:WaitForChild("leaderstats")
player.leaderstats.Kills.Changed:Connect(function()
if player.leaderstats.Kills.Value >= 100 then
pcall(BadgeService.AwardBadge, BadgeService, player.UserId, Badge4)
end
end)
else
end
if BadgeService:UserHasBadgeAsync(player.UserId,Badge5) == false then
local leaderstats = player:WaitForChild("leaderstats")
player.leaderstats.Kills.Changed:Connect(function()
if player.leaderstats.Kills.Value >= 200 then
pcall(BadgeService.AwardBadge, BadgeService, player.UserId, Badge5)
end
end)
else
end
if BadgeService:UserHasBadgeAsync(player.UserId,Badge6) == false then
local leaderstats = player:WaitForChild("leaderstats")
player.leaderstats.Kills.Changed:Connect(function()
if player.leaderstats.Kills.Value >= 500 then
pcall(BadgeService.AwardBadge, BadgeService, player.UserId, Badge6)
end
end)
else
end
if BadgeService:UserHasBadgeAsync(player.UserId,Badge7) == false then
local leaderstats = player:WaitForChild("leaderstats")
player.leaderstats.Kills.Changed:Connect(function()
if player.leaderstats.Kills.Value >= 1000 then
pcall(BadgeService.AwardBadge, BadgeService, player.UserId, Badge7)
player.leaderstats.Cash.Value = leaderstats.Cash.Value + 500
end
end)
else
end
if BadgeService:UserHasBadgeAsync(player.UserId,Badge8) == false then
local leaderstats = player:WaitForChild("leaderstats")
player.leaderstats.Kills.Changed:Connect(function()
if player.leaderstats.Kills.Value >= 2000 then
pcall(BadgeService.AwardBadge, BadgeService, player.UserId, Badge8)
end
end)
else
end
if BadgeService:UserHasBadgeAsync(player.UserId,Badge9) == false then
local leaderstats = player:WaitForChild("leaderstats")
player.leaderstats.Kills.Changed:Connect(function()
if player.leaderstats.Kills.Value >= 5000 then
pcall(BadgeService.AwardBadge, BadgeService, player.UserId, Badge9)
end
end)
else
end
if BadgeService:UserHasBadgeAsync(player.UserId,Badge10) == false then
local leaderstats = player:WaitForChild("leaderstats")
player.leaderstats.Kills.Changed:Connect(function()
if player.leaderstats.Kills.Value >= 10000 then
pcall(BadgeService.AwardBadge, BadgeService, player.UserId, Badge10)
end
end)
else
end
--[[
game.Workspace.PaperAwarder.Touched:Connect(function(hit)
if not BadgeService:UserHasBadgeAsync(player.UserId,PaperBadge) then
local leaderstats = player:WaitForChild("leaderstats")
game.ReplicatedStorage.Remotes.PaperMainGuiVisible.Value = false
pcall(BadgeService.AwardBadge, BadgeService, player.UserId, PaperBadge)
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 5
else
end
end)--]]
game.Workspace.PaperAwarder.Touched:Connect(function(hit)
if BadgeService:UserHasBadgeAsync(player.UserId, PaperBadge) == false then
local leaderstats = player:WaitForChild("leaderstats")
game.ReplicatedStorage.Remotes.PaperMainGuiVisible.Value = false
pcall(BadgeService.AwardBadge, BadgeService, player.UserId, PaperBadge)
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 5
else
end
end)
game.Workspace.WetBadgeAwarder.Touched:Connect(function(hit)
if BadgeService:UserHasBadgeAsync(player.UserId,WetBadge) == false then
local leaderstats = player:WaitForChild("leaderstats")
game.ReplicatedStorage.Remotes.WetMainGuiVisible.Value = false
pcall(BadgeService.AwardBadge, BadgeService, player.UserId, WetBadge)
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 6
else
end
end)
game.Workspace.G17Badge.Click.ClickDetector.MouseClick:Connect(function(hit)
if BadgeService:UserHasBadgeAsync(player.UserId,G17Badge) == false then
local leaderstats = player:WaitForChild("leaderstats")
game.ReplicatedStorage.Remotes.WetMainGuiVisible.Value = false
pcall(BadgeService.AwardBadge, BadgeService, player.UserId, G17Badge)
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 6
else
end
end)
end)
Any help is appreciated.