You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
Trying to achieve a cooldown for my longJump
- What is the issue? Include screenshots / videos if possible!
There is no cooldown so it just lets me constantly loop
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Debounces, etc.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
function moveSet:longJump()
if not (self.isLongJumpActive and self._canLongJump and self:isAlive() and not self:inAir()) then
return false;
end
self._isLongJumping = true;
self._canLongJump = false;
self.humanoid.JumpPower = 0;
self.humanoid:ChangeState(Enum.HumanoidStateType.Jumping); -- unless the character is jumping we can't set its velocity
local hrpCF = self.hrp.CFrame;
local ray = Ray.new(hrpCF.p, -5*hrpCF.upVector);
local hit, pos, normal = game.Workspace:FindPartOnRay(ray, self.character);
normal = normal:Dot(normal) > 0 and normal or UP;
self.hrp.Velocity = self.longJumpSpeed*(normal:Cross(hrpCF.lookVector):Cross(normal)).unit + self.longJumpPower*normal;
self.currentAnim:Stop();
self.currentAnim = self.longJumpAnim;
self.currentAnim:Play(0.2, nil, 1);
--long jump man
return true;
end