Hello, so recently I have been working on my -not so efficient- anti cheat and I thought of doing this to stop some aimbot exploits that accesses the player character model in workspace from player or by finding them through workspace.
coroutine.resume(coroutine.create(function()
while wait(1.5) do
for _, Player in next, Players:GetPlayers() do
if Player ~= Players.LocalPlayer then
if Player.Character ~= nil then Player.Character = nil end
if workspace:FindFirstChild(Player.Name) then
local ThisGuy = workspace:FindFirstChild(Player.Name)
ThisGuy.Parent = workspace.CurrentCamera
end
end
wait()
end
end
end))
It works fine but it lags the client every time the character is parented to the Camera. Is there's a way to fix this?

2 comments
Regardless of this not working efficiently on the code side in the first place, aimbots can very easily be adapted to work with the players characters parented to the camera. I could make you an aimbot in under 5 mins that caters to that, also that's in a local script which can easily be deleted on whichever players client and then they can move the characters back out of the camera.
I have other checks for all of that to trick exploiters with less knowledge in scripting, but is there's a way to stop the lag?