RunService.RenderStepped:Connect(function()if Detected==false and Chatting==false then for A,L in pairs(NPCS:GetChildren())do local D=L:FindFirstChild("\072\117\109\097\110\111\105\100")local T=L:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")if D and T then if(T.Position-CharHMR.Position).magnitude<15 then Detected=true DetectedNPC=L PromptLabel:TweenSize(UDim2.new(0,60,0,60),"\073\110","\076\105\110\101\097\114",.2)print(L.Name)end end end end if Detected==true and Chatting==false then local A=DetectedNPC:FindFirstChild("\072\117\109\097\110\111\105\100")local L=DetectedNPC:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")if A and L then if(L.Position-CharHMR.Position).magnitude>15 then Detected=false DetectedNPC=nil PromptLabel:TweenSize(UDim2.new(0,0,0,0),"\079\117\116","\076\105\110\101\097\114",.2)print("\078\111 \076\111\110\103\101\114 \068\101\116\101\099\116\101\100 \078\080\067")else local A=Camera:WorldToScreenPoint(L.Position)PromptLabel.Position=UDim2.new(0,A.X,0,A.Y)end end end if Chatting==true then local A=DetectedNPC:FindFirstChild("\072\117\109\097\110\111\105\100")local L=DetectedNPC:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")if A and L then Camera.CameraType=Enum.CameraType.Scriptable Camera.CFrame=Camera.CFrame:Lerp((L.CFrame*CFrame.new(-4,4,-7))*CFrame.fromOrientation(math.rad(-20),math.rad(215),0),.07)end else Camera.CameraType=Enum.CameraType.Custom end end)



RunService.RenderStepped:Connect(function()
	
	
	if Detected == false and Chatting == false then
		for i, NPC in pairs(NPCS:GetChildren()) do
			local Humanoid = NPC:FindFirstChild("Humanoid")
			local HMR = NPC:FindFirstChild("HumanoidRootPart")
			
			if Humanoid and HMR then
				if (HMR.Position - CharHMR.Position).magnitude < 15 then
					Detected = true
					DetectedNPC = NPC
					PromptLabel:TweenSize(UDim2.new(0, 60, 0, 60), "In", "Linear", 0.2)
					print(NPC.Name)
				end
			end
			
		end
	end
	
	if Detected == true and Chatting == false then
		local Humanoid = DetectedNPC:FindFirstChild("Humanoid")
		local HMR = DetectedNPC:FindFirstChild("HumanoidRootPart")
		
		if Humanoid and HMR then
			if (HMR.Position - CharHMR.Position).magnitude > 15 then
				Detected = false
				DetectedNPC = nil
				PromptLabel:TweenSize(UDim2.new(0, 0, 0, 0), "Out", "Linear", 0.2)
				print("No Longer Detected NPC")
			else
				local WTSP = Camera:WorldToScreenPoint(HMR.Position)
				PromptLabel.Position = UDim2.new(0, WTSP.X, 0, WTSP.Y)
			end
		end
	end
	
	if Chatting == true then
		local Humanoid = DetectedNPC:FindFirstChild("Humanoid")
		local HMR = DetectedNPC:FindFirstChild("HumanoidRootPart")
		
		if Humanoid and HMR then
			Camera.CameraType = Enum.CameraType.Scriptable
			Camera.CFrame = Camera.CFrame:Lerp(HMR.CFrame * CFrame.new(-4, 4, -7) * CFrame.fromOrientation(math.rad(-20), math.rad(215), 0), 0.07)
		end
	else
		Camera.CameraType = Enum.CameraType.Custom
	end
	
end)
