How do I make a Drift system for players?

The goal is for the character to be able to drift similar to a race car like in Sonic Unleashed.

I was originally rotating them 45 degrees with this script:

UIS.InputBegan:Connect(function(input)
    if input.KeyCode == testDrift and hum.WalkSpeed > 50 then --requires speed
        --Drift. Major wip. Probably gonna end up controlling like unleashed (which is the goal but still.)
        driftEnd = false
        local drift = Instance.new("BodyVelocity") --creates the push force for sliding
        drift.MaxForce = Vector3.new(1,0,1)*30000
        drift.Velocity = humroot.CFrame.lookVector*150
        drift.Parent = humroot
        repeat 
            --First Turn the player 45 degrees.
            humroot.CFrame = CFrame.new(humroot.Position)*CFrame.Angles(math.pi/4,0,0)
            --Second give them a push
            drift.Velocity *= 1.25
            --drift sound here
            wait(0.01)
        until driftEnd == true
        drift:Destroy()
    end
end)

However this did nothing. Anyone have any idea as to how I could achieve this?

3 Likes