Why is it output that there is a player 2 character, but it is not

Why is it output that there is a character player 2, but it is not, he left th game.

	local TargetModel = Plr.Character
	if TargetModel then
		print('')
		local TargetPart=TargetModel:FindFirstChild("Torso");
		local FoundHumanoid;
		for _,Child in pairs(TargetModel:GetChildren())do
			if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
				FoundHumanoid=Child;
			end;
		end;
		local raysettings = RaycastParams.new()
		raysettings.FilterType = Enum.RaycastFilterType.Blacklist
		raysettings.FilterDescendantsInstances = {SCP096Head.facepart}
		local CF = CFrame.new(TargetModel.Head.FaceFrontAttachment.WorldPosition, SCP096Head.facepart.Position);
		local Hit = game.Workspace:Raycast(CF.p, CF.LookVector * (TargetModel.Head.FaceFrontAttachment.WorldPosition - SCP096Head.facepart.Position).magnitude, raysettings);
		if not Hit then
			--when you need to interrupt it
			if sitCycle then
				coroutine.close(sitCycle) -- stop it
				sitCycle = nil --  delete reference to it
			end
			if walkCycle then
				coroutine.close(walkCycle) -- stop it
				walkCycle = nil --  delete reference to it
			end
			TargetTorso=TargetPart;
			NoticeDistance=(TargetPart.Position-SCP096HumanoidRootPart.Position).magnitude;
			AttackDebounce=true;
				Chasing=true;
				if SCP096Script and SCP096 and Idle then
					Notice:Play();
				end;
				if SCP096Script and SCP096 and Hush and Hush.IsPlaying then
					Hush:Stop();
				end;
				if SCP096Script and SCP096 and Idle and Idle.IsPlaying then
					Sit:Stop()
					Idle:Stop();
				end;
				if SCP096Script and SCP096 and Panic then
					Sit:Stop()
					Sit2Start:Stop()
					Sit2:Stop()
					Sit2End:Stop()
					Panic:Play();
				end;
				if SCP096Script and SCP096 and Screaming and Screaming.IsPlaying then
					Screaming:Stop();
			end;
				SCP096Humanoid.WalkSpeed = 0
				if Standing.IsPlaying or Walking.IsPlaying then
					StandToPanic:Play()
					wait(StandToPanic.Length*0.92)
				else
					GetUp:Play()
					wait(GetUp.Length*0.92)
				end
				Standing:Stop()
				Walking:Stop()
				SCP096Humanoid:MoveTo(SCP096Torso.Position,Game:GetService("Workspace"):FindFirstChild("Terrain"));
				Panicking:Play()
				for i = 800, 0, -1 do
				print(i, TargetModel)	
					if not TargetModel or TargetModel and not FoundHumanoid or TargetModel and FoundHumanoid and FoundHumanoid.Health <= 0 then
						break
					end
					wait() -- ΠΆΠ΄Π°Ρ‚ΡŒ 0.001 сСкунды (1 миллисСкунда)
				end
				if SCP096Script and SCP096 and Hush and not Hush.IsPlaying then
					Hush:Play();
				end;
				if SCP096Script and SCP096 and Idle and Idle.IsPlaying then
					Idle:Stop();
				end;
				if SCP096Script and SCP096 and Panic and Panic.IsPlaying then
					Panicking:Stop()
					Panic:Stop();
				end;
				if SCP096Script and SCP096 and Screaming and not Screaming.IsPlaying then
					Screaming:Play();
				end;
				FinalGetup:Play()
				wait(FinalGetup.Length*0.92)
				SCP096Humanoid.WalkSpeed=37;
				local CanSCPSee
				repeat 
					Wait(0)
					local hit,pos=raycast(SCP096HumanoidRootPart.Position,(TargetPart.Position-SCP096HumanoidRootPart.Position).unit,500)
					if hit and hit.Parent and hit.Parent.ClassName=="Model"and hit.Parent:FindFirstChild("Torso")and hit.Parent:FindFirstChild("Head")then
						CanSCPSee=true;
					else
						CanSCPSee=false;
					end;
					if not CanSCPSee then
						if not Run.IsPlaying then
							Run:Play()
							Run2:Stop()
						end
					else
						if not Run2.IsPlaying then
							Run:Stop()
							RunToAttack:Play()
							wait(RunToAttack.Length*0.92)
							Run2:Play()
						end
						SCP096Humanoid:MoveTo(TargetPart.Position+(TargetPart.Position-SCP096HumanoidRootPart.Position).unit*2,Game:GetService("Workspace"):FindFirstChild("Terrain"));
					end
					Panicking:Stop();
					if not CanSCPSee and not Pathing then
						Spawn(function()
							if not Pathing then				
								Pathing = true		
								local Path = game:GetService("PathfindingService"):CreatePath({
									AgentRadius = 2,
									AgentHeight = 2,
									AgentCanJump = true, 
									AgentCanClimb = true
								})

								Path:ComputeAsync(SCP096HumanoidRootPart.Position, TargetPart.Position)

								local waypoints = Path:GetWaypoints()

								for _, waypoint in ipairs(waypoints) do
									if not CanSCPSee then
										local pathTimer = 0
										repeat wait(0)
											SCP096Humanoid:MoveTo(waypoint.Position)
											pathTimer = pathTimer + 1
											if pathTimer > 15 or CanSCPSee then
												break
											end
										until (SCP096HumanoidRootPart.Position - waypoint.Position).Magnitude < 8 or pathTimer > 15 or CanSCPSee
										if pathTimer > 15 or CanSCPSee then
											break
										end
									end
								end
								Pathing = false
							end
						end);
					end;
					checkOpenDoor()
					if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and (TargetPart.Position-SCP096HumanoidRootPart.Position).magnitude<10 then
						Damage5:Play();
						Run:Stop()
						Kill:Play()
						Run2:Stop()
						Screaming:Stop()
						FoundHumanoid:TakeDamage(99999e99999);
						wait(Kill.Length*0.92)
						end
				until not TargetModel or not FoundHumanoid or TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health==0;
					Chasing=false;
			Run2:Stop()
			Run:Stop()
			Panicking:Stop();
			CanChangeStateWalking = true
			repeat Wait(0);until not Chasing;
			AttackDebounce=false
		end;
	end;
end;```

2 Likes

Try to check if the same thing happens on a real server.

When I tested the game sounds through Studio, they played for both players as if they were both on the same local client, and not on a real server, but at real server everything worked correctly.

You’re not right. There is a bug on the real server too.