How to detect if the player's character is the npc

so i have a script where my character become the npc and leaving the original body behind when I press e. i want the script to detect of the player character is in the npc, and if yes then when I press e I should go back into my original body
here’s 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

UIS.InputBegan:Connect(function(Key, Chatted)
	if Chatted then
		return
	end
	if Key.KeyCode == Enum.KeyCode.E then --the error
		camera.CameraSubject = Npc
		Player.Character = Npc

	end

You can check if it has a humanoid.
Currently what I think you should do is move everything to the npc. (CameraSubject and other things).

You could try to change the character property (correct me if I’m wrong).

Since you already have a variable for both the NPC and the Character you can check if it’s the NPC using Player.Character == NPC. So your script might look like this:

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

UIS.InputBegan:Connect(function(Key, Chatted)
	if Chatted then return end

	if Key.KeyCode == Enum.KeyCode.E then
		if Player.Character == Character then
			camera.CameraSubject = Npc
			Player.Character = Npc
		elseif Player.Character == Npc then
			camera.CameraSubject = Character
			Player.Character = Character
		end
	end