I think you need to check that hit.Parent is actually the character.
Try running this before setting the player variable:
script.Parent.Touched:Connect(function(hit)
if not (Players:GetPlayerFromCharacter(hit.Parent)) then return end -- Check if this is the player
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
awardBadge(player, badgeID)
end)