Physics is part of the process of jumping and client replicates their character’s state to the server, yes. What are you trying to say with this?
I edited the code to add a debounce, again trying to do it through the server is much less reliable.
local debouncePlayer = {}
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local jumps = Instance.new("NumberValue")
jumps.Name = "Jumps"
jumps.Parent = leaderstats
game.ReplicatedStorage:WaitForChild("JumpEvent").OnServerEvent:Connect(function(eventPlayer)
if eventPlayer == player and not debouncePlayer[player] then
debouncePlayer[player] = true
player.leaderstats.Jumps.Value += 1
task.wait(0.1)
debouncePlayer[player] = nil
end
end)
end)
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
however your chart is very helpful, I just don’t want exploiters to be able to fire my remoteEvents.
Well, it’s impossible to stop exploiters from firing remotes, since they are the client. There’s only so much you can do, like adding debounces.
Well I imagine there’s still some maximum rate a player can jump at, like every frame or so. If someone’s firing the remote multiple times in one frame, that player should be flagged in your system.
Yeah, that sounds like a good idea.
here is the desired effect
how do popular games have remoteEvents and prevent people from triggering them? if its impossible then there has to be a way to do this without remoteEvents.
If my game is exploitable then it will be ruined, its all about stats.
local Players = game:GetService("Players")
local function characterAdded(char)
local humanoid = char:WaitForChild("Humanoid")
local debounce = false
humanoid:GetPropertyChangedSignal("Jump"):Connect(function()
if humanoid.Jump and not debounce then
debounce = true
print("Jumping!")
task.delay(0.2, function()
debounce = false
end)
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)
Adjust the debounce to your needs, 0.2 seems ideal for me.
No remotes needed, works fine. Case closed.
Maybe try thinking of workarounds instead of hopping to the idea of Remotes
this is almost perfect ty for helping
the only issue I’m noticing is that I can press space mid air and it counts it up twice like a double jump.
They don’t. Exploiters are here either way.
I’ll give you the benefit of the doubt - I haven’t filled out the Server part of my spreadsheet, so I don’t know what’s best in this case. It’s up to you guys to find out!
Add character humanoid root part velocity.y
check and check if current is higher and only then count it as a jump
This is similar to the “Y Acceleration” part of my spreadsheet. I feel like adding that may come with its own can of worms though…
Yeah, I do agree that it works, but it ends up having the same effect since both our scripts have debounces.
And except your can be exploited and count increment jumps when they are not jumps, don’t compare our code
And yours can be exploited by spamming space
At least they are pressing the space and actually interacting with the game unlike with your code.
Player can be afk and remote just being spammed.
Someone can place a book on their keyboard or have a key spammer, and place their character under a short roof.
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 rootPart.AssemblyLinearVelocity.Y > 0 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)
You’re welcome, you can no longer spam while being in air.
Solve this as marked, thank you, have a good one
Tested it, and like the poster said it should work spammed under a roof. When this is spammed under a roof, it does not work all of the time.