How can I safely sanity check this system?

Hey guys, I am working on a dash system that turns a boolean (can dash) to true when the meter goes to 100, this meter increments when the player walk, you can kinda compare this to a stamina system.

So, through my research, I’ve seen lots say to do that on the client then sanity check it since its smoother for the player which i did, but the problem is the exploiter can make this dash meter/stamina full to a 100 in my case and have infinity dashes and I am not sure how to sanity check this, any ideas please?

Basically, if I have a value on the client like an int, how can I “secure” this value when it reaches a certain point on the server from the client? I know I need a remote event to fire once it does but I get stuck after on what to do.

Thanks <3

1 Like

You run the code on the Client so the gui readout is smooth.

You run the same code on the Server. The Server changes the boolean.

You should not need a Remote is the Client script is checking (not changing) the Boolean.

1 Like

is the dash stamina stored as a doubleconstrainedvalue?

I see thats smart didnt think of that, but one question, do u think that might be laggy? in a way where player sees that they can dash through the GUI but because its on the server it might be delayed if they are lagging? but if they are lagging either way, validation will always be delayed no matter the system?

no idea what doubleconstrainedvalue means to be honest can you please explain? do you mean an object value like IntValue? the way im doing it is by using heartbeat and when the player walks it adds to an attribute, here is the code below:

local heartBeatConnection

local function onHeartBeat()

	local dashStamina = character:GetAttribute("DashStamina")
	local dashMaxStamina = character:GetAttribute("DashMaxStamina")
	
	if humanoid.MoveDirection.Magnitude > 0 and dashStamina <= dashMaxStamina then
		character:SetAttribute("DashStamina", dashStamina + 0.5)
	end

	if dashStamina >= dashMaxStamina then
		heartBeatConnection:Disconnect()
		print("Can Dash")
	end
end

heartBeatConnection = runService.Heartbeat:Connect(onHeartBeat)

Is the dash purely movement or does it also give the player temporary invincibility? If it is only movement, there isn’t much of a need to make a sanity check on the client because an exploiter can always turn on movement exploits.

2 Likes

Calculate the min time between dashes and debounce it on the server.

I would probably run all the dash and stamina code on the client. Then check how often a player dashes on the server, if they’ve dashed more than, say 2 times in 1 second, set them back a bit and anchor their character for about 2 seconds or just kill them, depends on what type of game it is. The reason I’d do this is because if your sanity check/anti cheat relies only on the stamina being correct, an exploiter could just run the dash code without checking stamina.

This is also makes input near instant for players as the dashing is client side. Getting a false positive could happen but is pretty unlikely unless the server gets a big lag spike.

a doubleconstrained value has 3 values, the maximum, minimum, and current.

Deprecated but who cares

1 Like

Sorry, didnt show the server side, im using a remote event then on the server i used linear velocity to dash

do i make that using a remote event to check how many dashes? also is using linear velocity on the server to dash bad? because thats the way i did it

I think remote event would be fine, it is possible for exploiters to block outgoing remote events, however if you want to counter that then you’ll have to do the dashing on the server from my experience.

I would say try to avoid using linear velocity on the server. Same thing here, if the server has a lag spike the velocity won’t stop in time and the player will keep moving very awkwardly or not at all.

what do you recommend me doing here? if lets say i want to do it on the server what should i use to dash?

None of the people in this thread have any deep level of understand how to bypass everything like I do lol. Yes great idea let’s sanity check the dash so that exploiter enables custom fly script and easily do whatever they want far more powerful than any dash that you created in your game. Oh wait you enabled handshakes and client side anticheat? disables your handshakes and creates my own client event and then bypasses your client side anticheat yeah you never win. Only way to win is checking things on the server so let’s say I use a fly script and there’s some sort of distance I have to travel right? The whole point of a magnitude check is to prevent them from being able to use fly. Now sure there are bypasses to magnitude check server sided but a truly good one that accounts for those bypasses such as cframe flying would work magnifcently.

1 Like

So the way i fixed it, is through server script, i added a debounce table true then only return it to nil after task.wait(cooldown) has passed, this cooldown is the same amount of time it takes to recharge your dash meter up, if the exploiter sets the stamina to 100 constantly and tries to dash, it wont work cuz its on cooldown. This way normal players and someone trying to exploit stamina dash equally. This still needs more sanity checks cuz its still exploitable but works well for now till its more secure

Also, another way i am considering is running it on client and also on server for many reasons such as items that can refill ur stamina up faster or even instant, so that is a big part of the game i cant risk it and have that mainly on client.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.