Localscript having a delay for some reason

For some reason, my local script is being weird. It just doesn’t work for 1-2 minutes then it starts to work
Localscript

local RunService = game:GetService("RunService")
local player = game.Players.LocalPlayer
local part = workspace.Blark

print("working")
RunService.RenderStepped:Connect(function()
	local pos,canSee = workspace.CurrentCamera:WorldToViewportPoint(part.HumanoidRootPart.Position)
	if not canSee and player.Character.Humanoid.Health ~= 0 then
		part.Humanoid:MoveTo(player.Character.HumanoidRootPart.Position)
		if (part.HumanoidRootPart.Position - player.Character.HumanoidRootPart.Position).Magnitude < 3 then
			player.Character:BreakJoints()
		end
	else
		part.Humanoid:MoveTo(part.HumanoidRootPart.Position)
	end
end)

I don’t want to put the code into a script as that gives a noticeable delay but fixes the problem. I want the block to move only when the player isn’t looking at it.

Then at times, it works only when I’m close to the humanoid.
I have tried using other types of loops (Stepped, Heartbeat, while wait() do, etc) and it still gives no change.
Prints however still print. I have put prints in it and it does register that i am looking at it