I’m tryna create a hoverboard
local VerticalOffset = math.sin(tick() * FREQUENCY) * AMPLITUDE
local RayTarget = Seat.Position + RayOffset + (Seat.AssemblyLinearVelocity * RAY_VELOCITY) + Vector3.new(0, VerticalOffset , 0)
local Result = workspace:Raycast(Seat.Position, RayTarget - Seat.Position, Params)
if Result then
local Magnitude = (Result.Position - RayTarget).Magnitude
VectorForce.Force = Vector3.new(0, MINIMUM_THRUST + Magnitude * THRUST, 0)
RayPart.BrickColor = BrickColor.Red()
RayPart.Position = Result.Position
else -- Does not collide
VectorForce.Force = Vector3.new(0, MINIMUM_THRUST, 0)
RayPart.BrickColor = BrickColor.Green()
RayPart.Position = RayTarget
end
local Velocity = Seat.CFrame:VectorToObjectSpace(Seat.AssemblyLinearVelocity)
if Velocity.Magnitude > 0 then
VectorForce.Force -= Velocity.Unit * (DRAG * Velocity.Magnitude ^ 2)
end
VectorForce.Force += (Seat.CFrame.LookVector * Seat.Throttle) * 50000
When I press forward or backwards, it goes in all sorts of random directions