Hover Car angle FIX?

So I have a hover car scripted / tweaked script. I didn’t make it but If im right can’t I integrate raycasts to the get the angle of the surface and have the hover car or bike parallel to the ground.


I want the hover car to be able to climb the ramp.
heres my code / edited code

local RS = game:GetService("RunService")

--[[INSTANCE REFERENCES]]--

local car = script.Parent
local seat = car.VehicleSeat 
local base = car.Base
local hover = base.Hover 
local thrust = base.Thrust
local inertialDampener = base.Dampener
local rotationalDampener = base.RotDampener
local turn = base.Turn 


--[[CONSTANT VALUES]]--

local HOVER_HEIGHT = 2
local DETECT_RANGE = 8
local SPEED = 700
local TURN_SPEED = 625
local DAMP_MULTIPLIER = 1
local ROT_DAMP_MULTIPLIER = 0.2
local OFFSET_MULTIPLER = 0.1

--[[CONTROLLING THE HOVER]]--

--This event runs every frame before the physics is simulated 
RS.Stepped:Connect(function(totalTime, deltaTime)	
	
	--This is a vector the points downwards from 0 to DETECT_RANGE (Change this value to determine how far the ray scans for ground) 
	local direction = Vector3.FromAxis(Enum.Axis.Y) * -DETECT_RANGE
	
	--Raycast from the position of the base to our direction defined above, this is a ray that points down 
	local result = workspace:Raycast(base.Position, direction)
	
	if result and result.Instance.CanCollide then 
		--The instance of the result is either terrain or a collidable part, so we can adjust the hover accordingly 
		
		--This is the vector between the car and ground 
		local distanceToGround = base.Position - result.Position 
		
		--A value that can be greater or less than 1, it is the multiplier that determines whether we need to go up or down 
		local offset = 1 + (HOVER_HEIGHT - distanceToGround.Magnitude) * OFFSET_MULTIPLER
		
		--We set the hover (A VectorForce pointing down to the force need to maintain 0G times the offset defined above) 
		hover.Force = Vector3.new(-base:GetMass() * workspace.Gravity * offset)
	else
		--If there is nothing below the vehicle, we let it fall
		hover.Force = Vector3.new(0, 0, 0)
	end 
	
	--For player input (thrust is a VectorForce Pointing forwards, turn is a Torque) 
	thrust.Force = Vector3.new(seat.Throttle * SPEED)
	turn.Torque = Vector3.new(-seat.Steer * TURN_SPEED)
	
	--Set the interial dampeners to the negative of the velocity (both rotational and linear) 
	inertialDampener.Force = -base.Velocity * DAMP_MULTIPLIER 
	rotationalDampener.AngularVelocity = -base.RotVelocity * ROT_DAMP_MULTIPLIER
	
	--VFX for Fire on thruster / control hovering on and off
	--if seat.Throttle == 1 then 
        --fire.Enabled = true 
       -- print("hovering and moving")
	--else
        
	--end 
	
end)

--[[CONTROLLING THE PLAYER CHARACTER MASS]]--

local function SetMassless(model, massless)
	for i, part in pairs(model:GetDescendants()) do
		if part:IsA("BasePart") then
			part.Massless = massless
		end
	end
end

local occupant = nil 
--This property changes whenever a player gets into a vehicle seat 
seat:GetPropertyChangedSignal("Occupant"):Connect(function()
	
	if seat.Occupant then
		--They just got into the seat, so we set occupant
		occupant = seat.Occupant
		
		--And we make them massless so they don't weigh down the hover car 
		SetMassless(occupant.Parent, true)
	else
		--They just got off of the seat, so we need to set massless to false 
		SetMassless(occupant.Parent, false)
	end	
end)

One idea is to change the car’s orientation (or whatever controls how the car is oriented) based on the orientation of the part below it.

how would I do that exactly? im kinda new to raycasts.

You can get the normal vector of a raycast with rayResult.Normal. The normal vector is essentially the lookVector of the side of the part that was hit. Here’s an excellent explanation of normal vectors: https://devforum.roblox.com/t/surface-normal-why-vector3/12654/5
Anyways you can use this to orient the car relative to the part’s surface. The only problem is you’d need to find a way to prevent it from setting the left and right vector (absolutely no idea which one because I think its both x and z). While that can 100% be done, I am completely incapable with CFrame and vector math, so good luck. I spent a few hours attempting to make a hover car and was unable to figure it out, but perhaps you can do it. I’m sorry I couldn’t give any more help.