Help with making a more secure cash script

Include a standalone, bare-bones rbxl file with only the code you want reviewed.

  • Code Review is for reviewing specific parts of your code, and not your whole game.
  • Code Review is intended for improving already-working code. If you need help debugging your code, please use Scripting Support.

Provide an overview of:

  • What does the code do and what are you not satisfied with?
    The code gives the player 10 dollars when they interact with a proximity prompt
  • What potential improvements have you considered?
    i have considered adding a check to see how close the player is to the cash
  • How (specifically) do you want to improve the code?
    i want to make this code more secure and exploiter proof
	if plr.Character.Humanoid.health ~= 0 then
		plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + 10
		script.Parent:Destroy()
		end
end)

What exactly do you mean by this?

i mean a check to see if the player model is within 10 studs of the cash

Proximity prompts have a limit you can set for that on its’ properties

i know that but im not sure if it is secure

That’s a good point. I’m not sure either.

the prox prompt distance is only the distance that it shows from, im afraid a exploiter could make the proximity prompt visible on their screen and take the cash from far away

Though I haven’t heard of an exploit that could do that, I’m sure its still out there somewhere

if you search “proximity prompt hack roblox” the second result is a script on v3rmillon that remotly fires a proximity prompt, although it might be patched now im not sure

they can change the wait time with this script, (not mine)

function promptfired(p)
fireproximityprompt(p,5000000)
end
ProximityPromptService.PromptButtonHoldBegan:Connect(promptfired)

I made a sanity check that checks if the player is close enough to fire the proximity prompt, if anyone else wants to see this script here you go

local part = (the part that contains the proximity prompt)
local distance = 10 --- change to the distance of the proximity prompt

part.ProximityPrompt.Triggered:Connect(function(plr)
	
	local DistanceLimit = (plr:DistanceFromCharacter(part.Position))
	
	if plr.Character.Humanoid.health ~= 0 and distance <= DistanceLimit  then --- checks if the player is alive and close enough to interact
		--- your proximity prompt action here
	end
end)


1 Like

here i’ll edit this incase anybody else wants to use it

One thing to note is that the client’s character position is replicated. An exploiter could teleport their character to each proximity prompt and then fire it, and your code wouldn’t pick that up

that is true but you would have to make a anti teleport script for that which is a whole other thing

I know, my point is just that it’s incredibly easy for an exploiter to bypass your current solution. You’re right though, an anti-teleport script would be a great place to start!