Finding all players in a range not working

I tried to get all characters in a certain distance from a dummy and if they are in range, they will be anchored. However, for some reason, it only freezes one character in the range at a time.

	for _,player in pairs(game:GetService("Players"):GetPlayers()) do
		local char = player.Character
		local hum = char:FindFirstChild("Humanoid")
		local torso = char:FindFirstChild("Torso")
		
		
		if hum and torso and player~=script.Parent then
			if (script.Parent.Torso.Position - torso.Position).magnitude < 40 then
				torso.Parent:FindFirstChild("Left Arm").Anchored = true
				torso.Parent:FindFirstChild("Right Arm").Anchored = true
				torso.Parent:FindFirstChild("Left Leg").Anchored = true
				torso.Parent:FindFirstChild("Right Leg").Anchored = true
				torso.Parent:FindFirstChild("Head").Anchored = true
				torso.Parent:FindFirstChild("Torso").Anchored = true

				wait(math.random(3,5))

				torso.Parent:FindFirstChild("Left Arm").Anchored = false
				torso.Parent:FindFirstChild("Right Arm").Anchored = false
				torso.Parent:FindFirstChild("Left Leg").Anchored = false
				torso.Parent:FindFirstChild("Right Leg").Anchored = false
				torso.Parent:FindFirstChild("Head").Anchored = false
				torso.Parent:FindFirstChild("Torso").Anchored = false
			end
		end
	end

It is freezing one player at a time because the loop is being yielded by the `wait(math.random(3,5))

You can easily fix this by adding a task.spawn()

Example:

			if (script.Parent.Torso.Position - torso.Position).magnitude < 40 then
				task.spawn(function()
					torso.Parent:FindFirstChild("Left Arm").Anchored = true
					torso.Parent:FindFirstChild("Right Arm").Anchored = true
					torso.Parent:FindFirstChild("Left Leg").Anchored = true
					torso.Parent:FindFirstChild("Right Leg").Anchored = true
					torso.Parent:FindFirstChild("Head").Anchored = true
					torso.Parent:FindFirstChild("Torso").Anchored = true

					wait(math.random(3,5))

					torso.Parent:FindFirstChild("Left Arm").Anchored = false
					torso.Parent:FindFirstChild("Right Arm").Anchored = false
					torso.Parent:FindFirstChild("Left Leg").Anchored = false
					torso.Parent:FindFirstChild("Right Leg").Anchored = false
					torso.Parent:FindFirstChild("Head").Anchored = false
					torso.Parent:FindFirstChild("Torso").Anchored = false
				end)
			end

Oh, thanks, I completely forgot about spawns.