Hi,
I made a walljump mechanic in 20 mins and I want to be able to wall jump fast from 2 walls that are adjusted like this:
The problem is I have a jump request that needs a debounce because jump request fires like 3 times for one jump. So how do I get around this?
Wall jump func:
function Movement.Walljump(self: ClassType, Humanoid, Root)
local isGrounded = if Humanoid.FloorMaterial == Enum.Material.Air or Humanoid:GetState() == Enum.HumanoidStateType.Freefall then false else true
local _front = RaycastUtil.FrontCheck(Root, PlayerSettings.WallrunRayLength, self.wallrunParameters) :: RaycastResult
if _front and CollectionService:HasTag(_front.Instance, Tags.Walljump )then
local Rotate = _front.Instance:GetAttribute("Rotate") or false
RaycastUtil.DebugAttatchment(_front.Position)
RaycastUtil.VisibleRay(Root, _front)
Humanoid:ChangeState(Enum.HumanoidStateType.Jumping) -- force jump
if Rotate then
CurrentCamera.CFrame = CFrame.Angles(0, math.rad(180), 0) * CurrentCamera.CFrame -- 180 deg
end
Humanoid.WalkSpeed = PlayerSettings.AccelerationMaxSpeed -- keep their speed
end
end
JumpRequest:
-- self.jumpDebounceDelay is 0.15!!!!!!!!
function Movement.onJumpRequest(self: ClassType, Humanoid, Root): ()
local currentTime = tick()
local isGrounded = if Humanoid.FloorMaterial == Enum.Material.Air then false else true
local velocity = Root.AssemblyLinearVelocity.Magnitude
if currentTime - self.lastJump >= self.jumpDebounceDelay then
self.lastJump = currentTime
if not isGrounded and velocity >= 16 then
self:Walljump(Humanoid, Root)
end
end
end
Bump