How do i fix the player not being able to touch the ground and get back up, even tho npcs can do it fine
local detectionParams = RaycastParams.new()
detectionParams.FilterType = Enum.RaycastFilterType.Exclude
detectionParams.FilterDescendantsInstances = {hitHumanoid.Parent}
detectionParams.IgnoreWater = true
detectionParams.CollisionGroup = "Players"
detectionParams.RespectCanCollide = true
repeat
task.wait()
until
hitHumanoid.FloorMaterial == Enum.Material.Air
print(1)
repeat
task.wait()
hitHumanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, true)
hitHumanoid.RootPart.CFrame = CFrame.new(hitHumanoid.RootPart.Position, hitHumanoid.RootPart.Position + -hitHumanoid.RootPart.AssemblyLinearVelocity)
until
workspace:Raycast(hitHumanoid.RootPart.Position, -hitHumanoid.RootPart.CFrame.LookVector, detectionParams) or hitHumanoid.FloorMaterial ~= Enum.Material.Air
print(2)
(this code is just to make it face the direction its moving)