Jeez. Undo that delay loop. It’s an overall horrible idea.
Get us a screenshot of your crouch button press sequence so we can advise on how to deal with that.
Your line trace does nothing, you arent even storing the on hit value into a value to check if you hit something or not. Start with that.
That’s the value you want to plug by your buttons to prevent from getting up.
Have the trace run on tick event, off a sequence behind either a gate or a branch that only casts the ray if you are in a crouched state.
Again. All of that is very basic. A more beefy setup would just detect collision on begin overlap and go back to couched by only using events and not a tick function.
Start simple, once you learn then you can get fancy…