I want to make it so that if a part is not on screen it will anchor.
Current code:
while task.wait(0.8) do
local camera = game.Workspace.CurrentCamera
local target = game.Workspace.Enemy
local _, visible = camera:WorldToViewportPoint(target.Position)
if visible then
target.Anchored = false
else
target.Anchored = true
end
end