What is the most optimal way of disabling jumps?

  1. What do you want to achieve? Keep it simple and clear!
    I want to disable jump during M1’s, but I’m struggling to find the most optimal way to disable it when during a M1 chain…

  2. What is the issue? Include screenshots / videos if possible!
    I can’t really find the best way to achieve it without it being inconsistent or having delays if I want to do a downslam, because If I’m holding space in advance to do a uppercut, it works okay. However if I want to downslam after 3 M1’s there is a lot of delay…

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried changing different times of disabling jump / other methods, but I’m still unsure of the best way to achieve it without delay or inconsistency.

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!

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")

local BaconHitbox = require(ServerScriptService.Modules.BaconHitbox)
local StunHandler = require(ServerScriptService.Modules.StunHandlerV2)
local RagdollModule = require(ServerScriptService.Modules.RagdollModule)
local KBModule = require(ServerScriptService.Modules.KBModule)

local M1CamShake = ReplicatedStorage.Remotes.M1CamShake
local M1Remote = ReplicatedStorage.Remotes.M1
local BlockRemote = ReplicatedStorage.Remotes.Block
local DashM1Remote = ReplicatedStorage.Remotes.DashM1
local HoldingSpaceRemote = ReplicatedStorage.Remotes.HoldingSpace
local DashPunchCamShake = game.ReplicatedStorage.Remotes.DashPunchCamShake

local function M1Reset(Combo, Character)
	local OldCombo = Combo
	task.delay(1.3, function()
		local Combo = Character:GetAttribute("Combo")
		if Combo == OldCombo then
			Character:SetAttribute("Combo", 0)
		end
	end)
end

M1Remote.OnServerEvent:Connect(function(Player)
	local character = Player.Character

	local Ragdolled = character:GetAttribute("Ragdolled")
	local Stunned = character.Humanoid:GetAttribute("Stunned")
	local M1Cooldown = character:GetAttribute("M1Cooldown")
	local M1Debounce = character:GetAttribute("M1Debounce")
	local Blocking = character:GetAttribute("Blocking")
	local Dashing = character:GetAttribute("Dashing")

	if Ragdolled == true or Stunned == true or M1Cooldown == true or M1Debounce == true or Blocking == true or Dashing == true then return end

	character:SetAttribute("M1Debounce", true)

	character.Humanoid.WalkSpeed = 7
	character.Humanoid.JumpPower = 0
	character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)

	local Combo = character:GetAttribute("Combo")
	Combo = Combo + 1
	character:SetAttribute("Combo", Combo)

	M1Reset(Combo, character)


	local Fighter = character:GetAttribute("Fighter")

	local isAirborne = false
	local isHoldingSpace = character:GetAttribute("HoldingSpace")
	if character.Humanoid.FloorMaterial == Enum.Material.Air then
		isAirborne = true
	end

	print(isHoldingSpace)

	local Animation = nil
	local Punch_TYPE = nil

	if Combo >= 4 then
		if isAirborne == true then
			Animation = character.Humanoid.Animator:LoadAnimation(script.Characters[Fighter].Animations.Downslam)
			Animation:Play()
			Punch_TYPE = "Downslam"
		elseif isHoldingSpace == true then
			Animation = character.Humanoid.Animator:LoadAnimation(script.Characters[Fighter].Animations.Uppercut)
			Animation:Play()
			Punch_TYPE = "Uppercut"
		else
			Animation = character.Humanoid.Animator:LoadAnimation(script.Characters[Fighter].Animations["M1.".. 4])
			Animation:Play()
			Punch_TYPE = "Punch"
		end
	else
		Animation = character.Humanoid.Animator:LoadAnimation(script.Characters[Fighter].Animations["M1.".. Combo])
		Animation:Play()
	end

	if Combo == 1 then
		local Outline = ReplicatedStorage.Assets.Outline:Clone()
		Outline.Parent = character["Right Arm"]
		Outline.Limb.Part1 = character["Right Arm"]
		task.delay(Animation.Length, function()
			Outline:Destroy()
		end)
		local Trail = ReplicatedStorage.Assets.FistTrailDragon:Clone()
		for i, v in Trail:GetChildren() do
			v.Parent = character["Right Arm"]
			task.delay(Animation.Length, function()
				v:Destroy()
			end)
		end
		Trail:Destroy()
	elseif Combo == 2 then
		local Outline = ReplicatedStorage.Assets.Outline:Clone()
		Outline.Parent = character["Left Arm"]
		Outline.Limb.Part1 = character["Left Arm"]
		task.delay(Animation.Length, function()
			Outline:Destroy()
		end)
		local Trail = ReplicatedStorage.Assets.FistTrailDragon:Clone()
		for i, v in Trail:GetChildren() do
			v.Parent = character["Left Arm"]
			task.delay(Animation.Length, function()
				v:Destroy()
			end)
		end
		Trail:Destroy()
	elseif Combo == 3 then
		local Outline = ReplicatedStorage.Assets.Outline:Clone()
		Outline.Parent = character["Right Arm"]
		Outline.Limb.Part1 = character["Right Arm"]
		task.delay(Animation.Length, function()
			Outline:Destroy()
		end)
		local Trail = ReplicatedStorage.Assets.FistTrailDragon:Clone()
		for i, v in Trail:GetChildren() do
			v.Parent = character["Right Arm"]
			task.delay(Animation.Length, function()
				v:Destroy()
			end)
		end
		Trail:Destroy()
	end

	if Combo >= 4 then
		print(Punch_TYPE)
		if Punch_TYPE == "Punch" then
			local Outline = ReplicatedStorage.Assets.Outline:Clone()
			Outline.Parent = character["Left Leg"]
			Outline.Limb.Part1 = character["Left Leg"]
			task.delay(Animation.Length, function()
				Outline:Destroy()
			end)
			local Trail = ReplicatedStorage.Assets.FistTrailDragon:Clone()
			for i, v in Trail:GetChildren() do
				v.Parent = character["Left Leg"]
				task.delay(Animation.Length, function()
					v:Destroy()
				end)
			end
			Trail:Destroy()
			Combo = 0
			character:SetAttribute("Combo", 0)
			Animation:GetMarkerReachedSignal("Hit"):Connect(function()
				local Hitbox = BaconHitbox.new(Player, Vector3.new(5,5,5), Vector3.new(0,0,-3))
				Hitbox:StartDetection()

				M1CamShake:FireClient(Player)

				task.delay(0.3, function()
					Hitbox:Destroy()
				end)

				Hitbox.touched:Connect(function(Enemy, Direction)
					if Enemy == character then return end

					local EnemyBlocking = Enemy:GetAttribute("Blocking")
					if EnemyBlocking == true then
						if Direction == "Behind" then
							Enemy:SetAttribute("Blocking", false)
							Enemy.Humanoid.WalkSpeed = 16
							for _,anim in pairs(Enemy.Humanoid.Animator:GetPlayingAnimationTracks()) do
								if anim.Name == "Block" then
									anim:Stop()
								end
							end
						elseif Direction == "Front" then
							return
						end
					end

					StunHandler.Stun(Enemy.Humanoid, 1.2)
					local EnemyDummy = Enemy:GetAttribute("Dummy")
					if EnemyDummy == true then
					else
						M1CamShake:FireClient(game.Players:GetPlayerFromCharacter(Enemy))
					end
					Enemy.Humanoid:TakeDamage(4)
					Enemy.Hurt.Enabled = true
					RagdollModule.Ragdoll(Enemy, 1.2)
					KBModule.Knockback(character, 50, Enemy)

					task.delay(0.3, function()
						Enemy.Hurt.Enabled = false
					end)
				end)
			end)
		elseif Punch_TYPE == "Uppercut" then
			character.Humanoid.WalkSpeed = 7
			character.Humanoid.JumpPower = 0
			character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
			local Outline = ReplicatedStorage.Assets.Outline:Clone()
			Outline.Parent = character["Right Arm"]
			Outline.Limb.Part1 = character["Right Arm"]
			task.delay(Animation.Length, function()
				Outline:Destroy()
			end)
			local Trail = ReplicatedStorage.Assets.FistTrailDragon:Clone()
			for i, v in Trail:GetChildren() do
				v.Parent = character["Right Arm"]
				task.delay(Animation.Length, function()
					v:Destroy()
				end)
			end
			Trail:Destroy()

			Combo = 0
			character:SetAttribute("Combo", 0)
			Animation:GetMarkerReachedSignal("HitUp"):Connect(function()
				local Hitbox = BaconHitbox.new(Player, Vector3.new(5,5,5), Vector3.new(0,0,-3))
				Hitbox:StartDetection()

				M1CamShake:FireClient(Player)

				task.delay(0.3, function()
					Hitbox:Destroy()
				end)

				Hitbox.touched:Connect(function(Enemy, Direction)
					if Enemy == character then return end

					local EnemyBlocking = Enemy:GetAttribute("Blocking")
					if EnemyBlocking == true then
						if Direction == "Behind" then
							Enemy:SetAttribute("Blocking", false)
							Enemy.Humanoid.WalkSpeed = 16
							for _,anim in pairs(Enemy.Humanoid.Animator:GetPlayingAnimationTracks()) do
								if anim.Name == "Block" then
									anim:Stop()
								end
							end
						elseif Direction == "Front" then
							return
						end
					end

					StunHandler.Stun(Enemy.Humanoid, 1.2)
					local EnemyDummy = Enemy:GetAttribute("Dummy")
					if EnemyDummy == true then
					else
						M1CamShake:FireClient(game.Players:GetPlayerFromCharacter(Enemy))
					end
					Enemy.Humanoid:TakeDamage(4)
					Enemy.Hurt.Enabled = true
					RagdollModule.Ragdoll(Enemy, 1.2)
					local bv = Instance.new("BodyVelocity")
					bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
					bv.Velocity = Vector3.new(0, 50, 0)
					bv.Parent = Enemy.HumanoidRootPart
					game.Debris:AddItem(bv, 0.1)

					task.delay(0.3, function()
						Enemy.Hurt.Enabled = false
					end)
				end)
			end)
		end

		wait(Animation.Length)
		character.Humanoid.WalkSpeed = 16
		task.delay(2, function()
			character.Humanoid.JumpPower = 50
			character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
		end)

		character:SetAttribute("M1Cooldown", true)
		task.delay(0.8, function()
			character:SetAttribute("M1Cooldown", false)
		end)
		character:SetAttribute("M1Debounce", false)
		return
	end


	Animation:GetMarkerReachedSignal("Hit"):Connect(function()
		local Hitbox = BaconHitbox.new(Player, Vector3.new(5,5,5), Vector3.new(0,0,-3))
		Hitbox:StartDetection()

		task.delay(0.3, function()
			Hitbox:Destroy()
		end)

		M1CamShake:FireClient(Player)

		Hitbox.touched:Connect(function(Enemy, Direction)
			if Enemy == character then return end

			local EnemyBlocking = Enemy:GetAttribute("Blocking")
			if EnemyBlocking == true then
				if Direction == "Behind" then
					Enemy:SetAttribute("Blocking", false)
					Enemy.Humanoid.WalkSpeed = 16
					for _,anim in pairs(Enemy.Humanoid.Animator:GetPlayingAnimationTracks()) do
						if anim.Name == "Block" then
							anim:Stop()
						end
					end
				elseif Direction == "Front" then
					return
				end
			end

			StunHandler.Stun(Enemy.Humanoid, 0.8)
			local EnemyDummy = Enemy:GetAttribute("Dummy")
			if EnemyDummy == true then
			else
				M1CamShake:FireClient(game.Players:GetPlayerFromCharacter(Enemy))
			end
			local HitAnimation = Enemy.Humanoid.Animator:LoadAnimation(script.Characters[Fighter].Animations["Hit.".. Combo])
			HitAnimation:Play()
			Enemy.Humanoid:TakeDamage(3)
			Enemy.Hurt.Enabled = true
			KBModule.Knockback(character, 2.5, Enemy)
			task.delay(0.3, function()
				Enemy.Hurt.Enabled = false
			end)
		end)
	end)
	wait(Animation.Length)
	character.Humanoid.WalkSpeed = 16
	task.delay(1.7, function()
		character.Humanoid.JumpPower = 50
		character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
	end)

	character:SetAttribute("M1Debounce", false)
end)

I understand my scripting is SUPER messy XD

i accidentally hit send… editing wait a sec

Set their Humanoid.JumpHeight to 0