Need Help - Levitating Ped during animation

Not sure how to stop the ped from levitating during bench press animation:
RegisterNetEvent(‘scenario’, function()
local ped = PlayerPedId()
local dict = nil
local anim = nil
local dictid = nil
local name = nil
local counter = 1

for i = 1,Config.FramesInScene,1  do
    local animtaskcomplete = false
    dictid = Config.Scene[i].dict
    name = Config.Scene[i].name
    dict = Config.Animations[dictid].animDict
    anim = Config.Animations[dictid].animName[name]
    if counter <= Config.FramesInScene then
        while (not HasAnimDictLoaded(dict)) do
            RequestAnimDict(dict)
            Wait(3)
        end
        if HasAnimDictLoaded(dict) then
            print('Animation ID ='..dict.."Animation Name ="..anim)
            while not animtaskcomplete do
                print("in animation loop")
                TaskPlayAnim(ped, dict, anim, 3.0, 3.0, -1, 2, 0, false, false, true)
                animtaskcomplete = HasEntityAnimFinished(ped,dict,anim,3)
                while not animtaskcomplete do
                    Wait(15)
                    animtaskcomplete = HasEntityAnimFinished(ped,dict,anim,3)
                end
            end
        end
    end
    counter = counter+1
    print("counter = "..counter)
end  
ClearPedTasks(ped)

end)

Here is a video of the problem:

Hey, im currently on mobile. Ill look over docs when I get home and try to fix the error you recieve.

After a quick look at docs, you may be able to use the TaskStartScenarioInPlace and hook your variables and parameters into that

It also levitates the ped. I tried that first, the scenario basically does the same thing that I’ve done with my loop here. I thought this might be a work around to the levitation, but using PlayScenario or PlayAnimation the ped levitates when he enters the bench.

Try to disable collisions, look on the natives to figure it out, the bench is colliding with where the legs would normally be, making the character “step onto the bench”

you could also maybe try to teleport the player as soonas the animation starts, making him levitate to where he should be at, this could be a workaround.

@KSUIE_Gaming Did you solve the problem?