Lock action when player jumped

Can someone tell how to lock action in script if player jumped because I want to make it to reduce bugs. I was thinking about it but not idea.

Please give us more information:

  • What do you mean by lock action?
  • Do you want the player’s animation to freeze?
  • Do you want the player to stop and levitate?
  • What kind of bugs are you having and need to reduce when the player jumps?

I want to make if player jumped then script will not working and when he stopped then it works.

When the action works when player jumped then setting parts to possition is bugged and they are not staying in their place

I know that I can while an action jumpheight = 0 but check it earlier, before the action / main script work

Try looking in your View tab in Studio. There’s a box for ‘Assistant’.
You can type in a description of what you’d like a script to do and it might come up with a pretty close script for you.
I think setting a player’s location by Position is buggy anyway. You may want to use CFrame.

I did it but still there are bugs

Try this code I made in a couple minutes.

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid"):: Humanoid

local UserInputService = game:GetService("UserInputService")

local HoldingSpace = false
local CanJump = true

-- We first check if the players jumping or not by using UserInputService.

UserInputService.InputBegan:Connect(function(Input, Proccessed)
	if Proccessed then return end -- This is so when you type in chat it doesn't get activated.
	
	if Input.KeyCode == Enum.KeyCode.Space then
		HoldingSpace = true
	end
end)

UserInputService.InputEnded:Connect(function(Input, Proccessed)
	if Proccessed then return end

	if Input.KeyCode == Enum.KeyCode.Space then
		HoldingSpace = false
		
		-- We then check if "CanJump" and the Jumping state is false.
		if not CanJump and not Humanoid:GetStateEnabled(Enum.HumanoidStateType.Jumping) then
			Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
			CanJump = true
		end
	end
end)

-- Now we set the humanoid.

Humanoid.Jumping:Connect(function(IsJumping)
	if IsJumping and HoldingSpace and CanJump then
		-- If "IsJumping", "HoldingSpace" and "CanJump" are true,
		-- then we set it's jumping state to false and "CanJump" to false.
		Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
		CanJump = false
	end
end)

Let me know if you have problems with the code.

Doesn’t work in my script. I will post my script then you can include yours into it.

game:GetService("ReplicatedStorage").LadybugEvent.OnServerEvent:Connect(function(player)
	if player.Character.Humanoid.CharInfo.Value == "Marinette" and player.Character.Humanoid:FindFirstChild("TransformInfo") then

		local character = player.Character
		local humanoid = character.Humanoid
		
		-- not necessary part of script

	end
end)

Something like this?

Humanoid.StateChanged:Connect(function)
if Humanoid:GetState() == Enum.HumanoidStateType.Jumping or Enum.HumanoidStateType.Freefalling then
repeat task.wait() until Humanoid:GetState() == Enum.HumanoidStateType.Landed
end
end)

Poor formatting due to phone

it is not working how it should too.