Camera and character goes back to the player when pressed a key

ok, so I made a robot script and I do not know how to detect the player’s character is in NPC or not, so how would I modify my script using if…and…then and else?
my script:

local UIS = game:GetService("UserInputService")
local Character = script.Parent
local Npc = game.Workspace.Npc
local camera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local Lol = game.Workspace.Lol

UIS.InputBegan:Connect(function(Key, Chatted)
	if Chatted then
	local Player = game.Players.LocalPlayer
	if Key.KeyCode == Enum.KeyCode.E then
		camera.CameraSubject = Npc
		Player.Character = Npc
	if Key.KeyCode == Enum.KeyCode.Q then
		camera.CameraSubject = Lol.Humanoid
		Player.Character = Lol



please and thank you.

PS i don’t know much scripts for player’s charcter

you cant put a camerasubject to humanoid as far as i know

what about player.character? do you know any about how to change it to the player?

what do you mean? but its better to Camera.CameraSubject = Npc.HumanoidRootPart

and why is that line for
Player.Character = Npc

eh the player’s character is in the npc if e pressed

i mean that the player’s character change back to the player’s charcter