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
return
end
local Player = game.Players.LocalPlayer
if Key.KeyCode == Enum.KeyCode.E then
camera.CameraSubject = Npc
Player.Character = Npc
end
if Key.KeyCode == Enum.KeyCode.Q then
camera.CameraSubject = Lol.Humanoid
Player.Character = Lol
end
end)
please and thank you.