Ghost Driver Script Keyless – Car Break Through (Open Source)

Ghost Driver Script Keyless – Car Break Through (Open Source)

Ghost Driver 4 days ago
31 views
Ghost Driver Script Keyless – Car Break Through (Open Source) Keyless

Description

You can break through the NPC car for now

Right Ctrl for ON/OFF

I uploaded this script as open source; you can make your own script or make your own auto-farm!

Features
Compatible Executors

Script

local RunService   = game:GetService("RunService")
local StarterGui   = game:GetService("StarterGui")
local UserInput    = game:GetService("UserInputService")

local TRAFFIC_FOLDER_NAME = "TrafficFolder"
local TOGGLE_KEY = Enum.KeyCode.RightControl

local original = setmetatable({}, { __mode = "k" }) 

local State = { enabled = false }
local heartbeatConn, addedConn, folderWatchConn

local function notify(text)
    pcall(function()
        StarterGui:SetCore("SendNotification", {
            Title = "Ghost Driver",
            Text = text,
            Duration = 3,
        })
    end)
end

local function getTrafficFolder()
    return workspace:FindFirstChild(TRAFFIC_FOLDER_NAME)
end

local function ghostPart(part)
    if not part:IsA("BasePart") then return end
    if original[part] == nil then
        original[part] = { part.CanTouch, part.CanQuery, part.CanCollide }
    end
    if part.CanTouch   then part.CanTouch   = false end
    if part.CanQuery   then part.CanQuery   = false end
    if part.CanCollide then part.CanCollide = false end
end

local function restorePart(part)
    local o = original[part]
    if o and part and part.Parent then
        pcall(function()
            part.CanTouch   = o[1]
            part.CanQuery   = o[2]
            part.CanCollide = o[3]
        end)
    end
    original[part] = nil
end

local function ghostAll()
    local tf = getTrafficFolder()
    if not tf then return end
    for _, d in ipairs(tf:GetDescendants()) do
        if d:IsA("BasePart") then ghostPart(d) end
    end
end

local function enable()
    if State.enabled then return end
    State.enabled = true

    ghostAll()

    local function hookFolder(tf)
        if addedConn then addedConn:Disconnect() end
        addedConn = tf.DescendantAdded:Connect(function(d)
            if State.enabled and d:IsA("BasePart") then
                ghostPart(d)
            end
        end)
    end

    local tf = getTrafficFolder()
    if tf then hookFolder(tf) end

    folderWatchConn = workspace.ChildAdded:Connect(function(c)
        if State.enabled and c.Name == TRAFFIC_FOLDER_NAME then
            hookFolder(c)
            ghostAll()
        end
    end)

    local acc = 0
    heartbeatConn = RunService.Heartbeat:Connect(function(dt)
        acc = acc + dt
        if acc < 0.2 then return end
        acc = 0
        local f = getTrafficFolder()
        if not f then return end
        for _, d in ipairs(f:GetDescendants()) do
            if d:IsA("BasePart") then
                if d.CanTouch or d.CanQuery or d.CanCollide then ghostPart(d) end
            end
        end
    end)

    notify("Opened: You cant hit npc car now!")
end

local function disable()
    if not State.enabled then return end
    State.enabled = false

    if heartbeatConn  then heartbeatConn:Disconnect();  heartbeatConn  = nil end
    if addedConn      then addedConn:Disconnect();      addedConn      = nil end
    if folderWatchConn then folderWatchConn:Disconnect(); folderWatchConn = nil end

    for part in pairs(original) do restorePart(part) end

    notify("Closed: You can hit npc car now!")
end

local function toggle()
    if State.enabled then disable() else enable() end
end

UserInput.InputBegan:Connect(function(input, gpe)
    if gpe then return end
    if input.KeyCode == TOGGLE_KEY then toggle() end
end)

_G.GhostDriverNoTraffic = { enable = enable, disable = disable, toggle = toggle, state = State }

enable()

print("[Ghost Driver] No-Traffic-Collision Loaded | Press RightControl ON/OFF")

Comments (0)

No comments yet. Be the first!