So i have been trying to prevent code being executed until my character lands. So i used a function to return a true or false value to determine this
local function IsJumpingListener(Humanoid)
local landed = false
humanoid.StateChanged:Connect(function(OldState,NewState)
if NewState == Enum.HumanoidStateType.Landed then
landed = true
else
landed = false
end
end)
return landed
end
Then i would use this code to wait till the character lands, however
if not IsJumpingListener(humanoid) then IsJumpingListener(humanoid).Changed:Wait() end