i have a script that is supposed to make player’s character when pressed a key and come back if the server detect that player’s character is in the npc and pressed the key again. my problem is that nothing is working
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
if Player.Character == Character then
camera.CameraSubject = Npc
Player.Character = Npc
elseif Player.Character == Npc then
camera.CameraSubject = Character
Player.Character = Character
end
end
end)