StarterCharacter Car Slope Physics

I am making a car game and creating the cars completely from startercharacters.

the vehicles move fine but once it reaches a slope of some point, the angle of it does not change.

this is how it looks:

slope problem

this is the model:
slope problem2

and this is the code i tried:

local RunService = game:GetService(“RunService”)
local Players = game:GetService(“Players”)

local plr = Players.LocalPlayer
repeat wait() until plr.Character or plr.CharacterAdded:Wait()

local char = plr.Character
local HRP = char:WaitForChild(“Torso”)
local Reference = HRP:WaitForChild(“Reference”)

RunService.RenderStepped:Connect(function()
local r = Ray.new(HRP.Position, HRP.CFrame.UpVector * -(char.Humanoid.HipHeight + 3.5))
local ,,n = workspace:FindPartOnRayWithIgnoreList(r,{char})
local h, hp = workspace:FindPartOnRay(r, char) – hit, hitpart

local vector = (HRP.CFrame - HRP.CFrame.p):VectorToObjectSpace(n)
--print(Reference.Transform)
--print(math.abs(vector.z))

if h and string.sub(h:GetFullName(), 1, 16) == "Workspace.Sloped" then
	Reference.Transform = CFrame.new(0,0,0,1,0,0,0,1,0,0,0,1) * CFrame.Angles(vector.z,0,-vector.x)
else
	Reference.Transform = CFrame.new(0,0,0,1,0,0,0,1,0,0,0,1)
end

end)

the car doeset have any motord6’s of any sort in them does not have any legs, arms, or a humanoidrootpart, so i am unsure how to do this. any ideas?

Is the car just welded to the humanoid root part? I’m not sure on the hierarchy of anything, but check out my pinned post on my profile. It goes over aligning a part to a sloped surface while still facing a direction.

1 Like

the car doesnt have a humanoid root part but the “middle” is basically the rootpart. and everything is welded to that.

1 Like

Have you tried this?

char.Humanoid.PlatformStand = true

yes but it did nothing. im not even sure if this is even possible lol

I tried it out and it worked fine. However, here is another solution:

charHumanoid.Sit

To make sure they stay seated, loop it.