What's a good way to stop hacking for a flying script?

Hi devs,

I’m currently making an admin ModuleScript, and I’m stumped on how I would stop cheating on the fly command.
It uses the player’s camera’s CFrame, and from what I know you can’t do that from the server.
How would I stop cheaters from easily doing this themself?

In what way is your flying command using the Camera’s CFrame?

It points the HumanoidRootPart in the same direction as the camera.

Well, exploiters can easily get access to a flying script without even knowing your admin module exists. So I wouldn’t worry about if they can hack it!

2 Likes

In Adonis, they fly by using a bodyvelocity which is on the client that is in the torso/humanoidrootpart. If you detect a bodyvelocity in the humanoidrootpart or torso, then remove it.

1 Like

Oh, I completely forgot about that…

1 Like

First time posting on the forums :tada:.
perhaps you can check how fast a person is moving, such as what @GreenNinja3645 mentioned.

Check how often the Y value changes in conjunction with the movement speed. Are players meant to be on various Y positions? Does your game have speed boosts, etc. Most fly scripts tilt the player. If I make a script then I’ll reply to this message. Cheers!

1 Like

I think you can also put the script in ServerScriptStorage, and have it check the users permissions ( If conditions permit ), and use a local function, that will look something like this:

local Players = game:GetService("Players")

local function checkPermissions (player) -- Does Lua use cammelCase? 
	if player whitelisted then:
		whitelist
	end
end

Players.PlayerAdded:Connect(checkPermissions)

This code is just a rough “mockup” of what it could look like.