Exploiter Safe Key/Ability Detection?

I’m trying to make my game exploiter “safe”, so I wonder how to prevent people from spamming key triggered abilities.

I’m aware key presses can only be registered via local scripts, and remote events, and —from the little i know— both options are easily exploitable from the client.

I’m unsure on how to do this from a server script or in a way that can’t —easily— be used to cheat.

I’ve only just discovered how exploitable local scripts are so I’m just barley learning about anti-exploitative practices. Here’s my old script, any feedback to improve it would be awsome.

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid"):: Humanoid

local abilitygui = player.PlayerGui.MatchGUI.AbilityGUI
local abilitymod = require(game.ReplicatedStorage.CONFIG.AbilityScripts.Abilities)

local abilityKey = {"Q", "E", "R","F"}

local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(Input, Processed)
	
	for _, key in pairs(abilityKey) do
		if Input.KeyCode == Enum.KeyCode[key] and not Processed then
			print(key)
			local pos = table.find(abilityKey, key)
			print(pos)

			abilitymod[player.CharacterPlayingAs.Abilities["Ability".. pos].Value]()
			task.wait(1)
		end
	end
	
end)

Thanks!

1 Like

just add cooldown check in remote event on server for each player and ability and you will be safe. No any server scripts are able to detect keyboard or mouse

1 Like

alright ill try that out, thanks!

1 Like

is there a reason why abilities are being handled on the client? Its better if you just send a key input to the server and handle ability firing and logic on the server


Visualization being gui effects, vfx, sfx

Handling all key inputs on the server only would make responsiveness of the abilities heavily ping-reliant and would make it feel sluggish/jank on poor connections.
However you could take a hybrid approach where most things are handled on the client, but anything that can affect other players would only run on the server.
This way anything that is purely movement-based will feel immediate and feel good to use, but exploiters won’t be able to leverage abilities for things such as a kill-all script.

This is just an idea however.