Counting jumps on server-side script

Does your code cover roof or the air spam? Didn’t think so.

If I were you I’d take this as a loss and accept it

It does cover roof spam, like the person who created this post wanted.

He can still adjust the debounce or even have roof parts set the debounce to true

(Edit: Reply to topic author)

Note, everyone here is trying to adjust the code via LocalScript or Script based on the player’s jumps, but the number 1 rule for all programmers is: Never trust the client. Knowing this, the best option will ALWAYS be to use RemoteEvents to inform the server, because you execute the code on the client (0 delay) and inform the server of what happened. ON THE SERVER you validate the information that the client sent.

For your situation, you can simply save the time it takes to recover from a jump. (In this case, you are already considering that the client could be a possible exploit)

Create the “Debounce” table as the players suggested.

Every time a player jumps, inform the Debounce table of the name and the time the last jump was made.

Example: Debounce[player.Name] = LastJumpTime
Whenever the player reports that a jump was made, validate in the RemoteEvent Script if it has a time registered in the Debounce table and compare it with the “JumpDelay” to see if its point is valid.

All information that is important to come from the player for use by the server needs to be impeccably verified and validated.

2 Likes

Please don’t start arguments here. We are just trying to help a guy. Your reputation does not depend on this.

I tested your code and it does work pretty well. However, there is a big delay between jumps registering when jumping under a roof.

1 Like

Change AssemblyLinearVelocity.Y > 0 to AssemblyLinearVelocity.Y ~= 0

and that’s it?

@EmmieShayz Do this, it works fantastic for me, mass triggers are not counted, I’m getting like 10 jumps per second under a roof but none of them count

Don’t forget to adjust debounce to your liking

They said

I want there to be no limit to how fast a player can jumps. I want them to be able to jump under a roof if they want

And I did just mention debounce didn’t I mister Frostism?

Lowering debounce time will allow more jumps to be counted, FIY

I would do this, adding around a 0.1 debounce, if it’s fired more times, it would kick the player

it would kick the player

or just don’t count the jump lmao?

That would make the exploiter’s job easier.

I have to kindly ask you guys to make more structured and thought-out responses and not impulsively reply with “but mine is better!” or “you forgot this detail!”. Stop trying to make it a fight between who can make a better solution. This topic already has way more replies than it needs to.

Well, the issue with the event firing multiple times while in air is now present again. As for the debounce, this is basically identical to adding a debounce to a RemoteEvent, and in that case the detection would be way more consistent.

1 Like

You are already patched the spam with rate limits, what else are you making easier for him lol

This will be my final reply with how I think the solution should be; remote events with debounces. If the client doesn’t follow the debounce, then ignore the request. There should be around 0.1 seconds extra for any latency, so any request sent like

while task.wait() do
	event:FireServer()
end

will be ignored.

1 Like

Nice solution for adding debounce with the consideration of multiple players. The OP can then use Humanoid.Jumping on the client to fire the remote event.

@ChiDj123 While I understand your aversion to using RemoteEvents, I think this is one of those things where it’s best to just use them. Any solution that was about trying to detect player’s jumps purely on the server would be able to be pushed to its limit by an exploiter, so purely creating a RemoteEvent with a debounce is way less hustle and works much more consistently.

2 Likes
local Players = game:GetService("Players")

local function characterAdded(char)
	local humanoid: Humanoid = char:WaitForChild("Humanoid")
	local rootPart: BasePart = char:WaitForChild("HumanoidRootPart")
	local debounce = false

	humanoid:GetPropertyChangedSignal("Jump"):Connect(function()
		if not humanoid.Jump then 
			return 
		end

		if debounce then 
			return
		end
		
		if math.abs(rootPart.AssemblyLinearVelocity.Y) < -0.01 then
			return
		end

		debounce = true
		print("Jumping")
		
		task.delay(0.2, function()
			debounce = false
		end)
	end)
end

local function playerAdded(plr: Player)
	if plr.Character then
		characterAdded(plr.Character)
	end	
	
	plr.CharacterAdded:Connect(characterAdded)
end

Players.PlayerAdded:Connect(playerAdded)

Try this

1 Like

Yes, I think everyone thinks the same way. All types of gains (score, gold, coins, etc…) can be sent from the client, but they need to be validated on the server (in whatever way you prefer), but always checking whether it could send the request or not (through debounces, whether it is close to a location or not, etc). I’m just trying to be more vague, because as you @EmmieShayz mentioned, I think there are too many answers to the author’s request.

2 Likes

All types of gains (score, gold, coins, etc…) can be sent from the client

that’s just straight up wrong?