The function isn’t firing while the attribute is true.
players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local humanoid = char.Humanoid
humanoid:SetAttribute("Infected", false)
while true do
humanoid:GetAttributeChangedSignal("Infected"):Connect(function(attribute)
if attribute then
print("aaaaa")
createInfected(char, plr)
else
print(false)
for i, v in pairs(infected) do
if v.Name == plr.Name then
table.remove(infected, i)
end
end
end
end)
task.wait()
end
end)
end)