Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Too much lag trying to parent players characters in a loop?

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

0

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.

0

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?

1 answer

✓ Accepted answer

This anticheat solution is obviously not ideal. As stated above, aimbots can easily be adapted to work with this system. This is also not to mention that aimbots generally get the character via game.Players["NameOfPlayer"].Character. Client sided anticheats are often useless because of the ways exploits get around detection. The best advice I can give you as someone who messes with exploits frequently is: Dont bother with a client sided anticheat.

More often than not, they provide little to no protection against the people making scripts for your game and releasing them. Instead, shift focus to securing the server and making sure the client has the smallest chance possible to abuse any of your systems. You have to remember that an exploiter has full access over their entire client. They can spoof literally anything to your client scripts, but not your server scripts.

1 comment

0

Okay, thank you for the advice, I accepted the answer, but please is there's a way to stop this lag or anyway to reduce it?

This discussion is preserved as it was. New answers, comments, and votes are closed.