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!
