Hey, everyone!
I have made a simple server sided proximity prompt exploit detection that includes detects, enabling prompt when its disabled, hold duration changes, and fire proximity prompt.
local prompt = script.Parent
local players = {}
prompt.PromptButtonHoldBegan:Connect(function(player)
--[[
{
true -- Whether or not Began has been pressed
true -- If hold duration is long enough
}
]]--
players[player.Name] = {true}
task.wait(prompt.HoldDuration - .05)
players[player.Name] = {true, true}
end)
prompt.PromptButtonHoldEnded:Connect(function(player)
task.wait(.1)
players[player.Name] = nil
end)
prompt.Triggered:Connect(function(player)
local success, response = pcall(function()
if players[player.Name][2] then
end
end)
if prompt.Enabled == false then
player:Kick("Enabling Proximity Prompt Exploit Detected")
end
if success then
if players[player.Name][1] and players[player.Name][2] then
print("Put Code Here")
else
player:Kick("Hold Duration Exploit Detected")
end
else
player:Kick("Fire Proximity Prompt Detected")
end
end)
Before I explain how it works, know:
fireproximityprompt - Fires triggered function and not hold began or end began.
I’ll explain how the code works.
prompt.PromptButtonHoldBegan:Connect(function(player)
--[[
{
true -- Whether or not Began has been pressed
true -- If hold duration is long enough
}
]]--
players[player.Name] = {true}
task.wait(prompt.HoldDuration - .05)
players[player.Name] = {true, true}
end)
Now to see if the player actually started holding E on the prompt, we will set our players name as the key and value to {true}.
Afterwards if the hold duration fits in the range of the current hold duration of the prompt, it will set the value to {true, true} to the key (which is players name)
This is a process to confirm player actually pressed button and has the right hold time before we run the triggered function code.
prompt.PromptButtonHoldEnded:Connect(function(player)
task.wait(.1)
players[player.Name] = nil
end)
If the player decides however to stop holding the button, it will immediately set the key to nil and remove it from the table.
The task.wait(.1) is in there as when Triggered is fired, HoldEnded fires too, causing it to false positive later on as I’ll explain later.
prompt.Triggered:Connect(function(player)
local success, response = pcall(function()
if players[player.Name][2] then
end
end)
if prompt.Enabled == false then
player:Kick("Enabling Proximity Prompt Exploit Detected")
end
if success then
if players[player.Name][1] and players[player.Name][2] then
print("Put Code Here")
else
player:Kick("Hold Duration Exploit Detected")
end
else
player:Kick("Fire Proximity Prompt Detected")
end
end)
Now we wrap a pcall around the second value in our key to see if it actually exists, and if it doesnt, we kick them for using fireproximityprompt().
Essentially what happens is when a exploiter uses fireproximityprompt is it never fires the HoldBegan function and will immediately fire the Triggered function, and since the key doesn’t exist when HoldBegan SHOULD be fired, it recognizes it as a fireproximityprompt
if prompt.Enabled == false then
player:Kick("Enabling Proximity Prompt Exploit Detected")
end
Now what happens here is if the server sided property for proximity prompt is disabled while the exploiter on client sets it to enabled, if the exploiter attempts to fire the triggered function, it will kick them.
if players[player.Name][1] and players[player.Name][2] then
print("Put Code Here")
else
player:Kick("Hold Duration Exploit Detected")
end
This code right here basically checks back to our key value and sees if both exist and are true, and if theyre not, it kicks the player.
Now this is bypassable by setting it just by -0.04 to current hold duration, but because of server ping, it has to be that way.
Thanks for reading my post!