RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"the proximity prompt can be exploited via auto clicker and give 500 afcash. please fix"
To fix the exploit, we can add a cooldown to the proximity prompt trigger. This will prevent the player from triggering the prompt repeatedly in a short amount of time. ```lua local sound = script.Parent.Parent.Parent.sound.Sound local afcashValue = 100 local cooldown = 10 -- 10 seconds cooldown local lastTriggered = {} local function play(player) local currentTime = os.time() if lastTriggered[player.UserId] and currentTime - lastTriggered[player.UserId] < cooldown then return end lastTriggered[player.UserId] = currentTime sound:Play() local leaderstats = player:FindFirstChild("leaderstats") if leaderstats then local afcash = leaderstats:FindFirstChild("AFCash") if afcash then afcash.Value = afcash.Value + afcashValue end end end script.Parent.Triggered:Connect(play) ``` In this script, we create a `lastTriggered` table to keep track of the last time each player triggered the prompt. When the prompt is triggered, we check if the player has triggered it within the cooldown period. If they have, we simply return and do nothing. If they haven't, we update their last triggered time and proceed as before.