I am trying to make a focus system. The thing I am trying to do is when shift is pressed the Local Player constantly faces an NPC (Enemy) Head while making the camera also to look at the Enemy.
Events.LockToEnemy.OnServerInvoke = function(player , pressed)
print(chainedEnemyGlobal)
local Camera = workspace.CurrentCamera
local Goal = workspace.Enemies:FindFirstChild(chainedEnemyGlobal).Head
while true do
wait(0.01)
Camera.CFrame = CFrame.new(Goal.Position,Camera.CFrame.Position)
end
end
this is the thing I tried but it is not working for some reason . The chainedEnemyGlobal variable is for the nearest player script I am using which dosen't seem to be the problem. Pls I have been searching for an answer for 3 days now and I could find anywhere for help

1 comment
It might be a new bug with roblox, I am having almost the exact issue: https://scriptinghelpers.org/questions/130383/