Error in my script

where would i change that? plus my npc is metal so is that affecting it loading?

Where you’re defining the character variable.

I don’t understand what your script should do, can you explain more?

this?

local UIS = game:GetService("UserInputService")
local Character = script.Parent
local Npc = game.Workspace.Npc
local camera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer
--getting original character before you change it
local originalCharacter = Player.CharacterAdded:Wait()

UIS.InputBegan:Connect(function(Key, Chatted)

	if Chatted then
		return
	end
	if Key.KeyCode == Enum.KeyCode.E and Player.Character == Character then 
		camera.CameraSubject = Npc
		Player.Character = Npc
	else
		--changing the character back to it's original form
		Player.Character = originalCharacter
		camera.CameraSubject = Player.Character:WaitForChild("Humanoid")

	end



end)

Why you made Player.Character = Npc, that the problem.

it should make me become/go to the npc and control it and go back when i press the e key again (or detect i’m inside the npc and change me back when i press e again)

how else should i make the player inside the npc and move if i don’t set the character to it? ;-;

Do you want your character to turn into an NPC character or do you want it to be done remotely?

i want the player able to see that he is controlling the npc at the npc view, just like controlling a normal player, be able to do everything a player can and can switch back to the oringinal player view

in short, like a pilot mode or controlling a robot

can you show me what your NPC Character is made of in Explorer?

Screen Shot 2021-05-26 at 8.02.33 AM

local UIS = game:GetService("UserInputService")

local Npc = game.Workspace:WaitForChild("Npc")
local camera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local originalCharacter = Player.Character

local npcnow = false -- is player control npc now?

UIS.InputBegan:Connect(function(Key, Chatted)
	if Chatted then
		return
	end
	if Key.KeyCode == Enum.KeyCode.E then
		if not npcnow then 
			npcnow = true -- is player control npc now?
			camera.CameraSubject = Npc
			Player.Character = Npc
		elseif npcnow then
			npcnow = false -- is player control npc now?
			--changing the character back to it's original form
			Player.Character = originalCharacter
			camera.CameraSubject = Player.Character:WaitForChild("Humanoid")
		end
	end
end)

Try this


i can’t switch back and can’t move for some reason

local UIS = game:GetService("UserInputService")

local Npc = game.Workspace:WaitForChild("Npc")
local camera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local originalCharacter = Player.Character


Player.CharacterAdded:Connect(function(char)
	char.Archivable = true
	local cloneOrigChar = Player.Character

	local npcnow = false -- is player control npc now?



	UIS.InputBegan:Connect(function(Key, Chatted)
		if Chatted then
			return
		end
		if Key.KeyCode == Enum.KeyCode.E then
			if not npcnow then 
				npcnow = true -- is player control npc now?
				camera.CameraSubject = Npc
				Player.Character = Npc
			elseif npcnow then
				npcnow = false -- is player control npc now?
				--changing the character back to it's original form
				Player.Character = cloneOrigChar
				camera.CameraSubject = cloneOrigChar:WaitForChild("Humanoid")
			end
		end
	end)


end)

Try this

make sure that’s parts of your npc character not anchored

it is unancored ;-; and when i move i have to wait a few second and move for one second, there is huge lag when i switch

Well, this is not my problem, I just helped you fix your script and to help with the management of the NPC I do not have to

yea ur right ima try fix the lag ty for ur help