Cart ride around nothing

HOW would I implement a script just like the game cart ride around nothing by sky vad which has the rail magnets game pass ? I looked it up on YouTube and that game pass literally makes any cart stable on turns!!! :smiley:

So what’s the script for the rail magnet just like in that game?

Maybe something like this?

local railMagnetEnabled = false
local pullDownForce = 1000

function enableRailMagnet()
    railMagnetEnabled = true
end

function disableRailMagnet()
    railMagnetEnabled = false
end

local function onPartTouched(part)
    if railMagnetEnabled and part:IsDescendantOf(workspace.Rails) then
        local cart = script.Parent
        local upVector = Vector3.new(0, 1, 0)
        local pullForce = cart.AssemblyMass * pullDownForce * upVector
        cart:SetNetworkOwner(nil)
        cart.AssemblyLinearVelocity -= pullForce
        wait()
        cart:SetNetworkOwner(game.Players.LocalPlayer)
    end
end

script.Parent.PrimaryPart.Touched:Connect(onPartTouched)
1 Like

vector forces on the wheels or axle