Basically, I added a new script into my game that awards badges for completing a specific quest. Two problems:
- No one has done the quest yet. (I am not here to talk about this one).
- After publishing the update with the quest, my error log (in create.roblox.com) for the game started getting filled with the message “The player with userId=(random userId) is not present at the moment”. I turned off the script for a few hours, checked the log during those hours, and no errors like that showed up.
This leads me to believe beyond reasonable doubt that it is this script causing it. However, I don’t know why it is causing all these errors if no one has had reason to earn it.
My script:
--This is just the awarding part of the script:
if #aliens == 0 and spawned == true and summoner.Humanoid.Health == 0 then
runCon:Disconnect()
for i,v in players do
local x,y = pcall(function()
if v == nil or game.Players:FindFirstChild(v.Name) ~= nil then
if v and BS:UserHasBadgeAsync(v.UserId,3154641866632423) == false then
print("Tried to award badge: "..tostring(3154641866632423).." to "..v.UserId)
BS:AwardBadge(v.UserId,3154641866632423)
end
end
end)
end
debris:AddItem(summoner,5)
for i,v in touchCons do
local x,y = pcall(function()
if v.Connected == true then
v:Disconnect()
end
end)
end
end
Players are added using the following logic that runs several times
local parts = game.Workspace:FindPartsInRegion3(Region3.new(summonerTorso.Position - checkAOE, summonerTorso.Position + checkAOE), moon, 50)
for i = 1, #parts do
if parts[i] and parts[i].Parent then
local character = parts[i].Parent
if not table.find(aliens,character) and character.Name ~= "Zombie" and character:FindFirstChild("Torso") and character:FindFirstChild("Humanoid") then
targetEnemyTorso = character.Torso
if table.find(players,game.Players:GetPlayerFromCharacter(character)) == nil then
table.insert(players,game.Players:GetPlayerFromCharacter(character))
end
end
end
end
and with
if hit and hit.Parent and hit.Parent.Name ~= "Alien" then
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid and humanoid.Parent.Name ~= "Alien" and zombie:FindFirstChild("Humanoid") ~= nil and zombie:FindFirstChild("Humanoid").Health > 0 and humanoid.Health > 0 and humanoid ~= summonerHumanoid then
humanoid:TakeDamage(1)
if table.find(players,game.Players:GetPlayerFromCharacter(humanoid.Parent)) == nil then
print("added "..humanoid.Parent.Name)
table.insert(players, game.Players:GetPlayerFromCharacter(humanoid.Parent))
end
end
end
Thank you for reading this far and for any ideas you may have.