local v=require(((game:GetService("\083\101\114\118\101\114\083\099\114\105\112\116\083\101\114\118\105\099\101")):WaitForChild("\070\105\110\100\101\114\115",5)):WaitForChild("\068\111\109\097\105\110\070\105\110\100\101\114",2))local m=v:FindDomain("\115\112\105\101\108\101\114")local u=v:FindDomain("\067\097\114\065\110\100\068\114\105\118\101\114")local q=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local d=require(q:WaitForChild("\078\101\118\101\114\109\111\114\101",2))local X=d("\083\116\100")local T=X.wraptor local F=X.linq local s=X.rquery local p={}function p.GetSpawnerModels(m,v)local u=game:WaitForChild("\087\111\114\107\115\112\097\099\101",1)local q=u:WaitForChild("\083\112\097\119\110\101\114\115",1)local d=q:WaitForChild(v,1)local X=(F(d:GetChildren())):where(function(v)return v:FindFirstChild("\084\111\117\099\104\115\116\111\110\101")~=nil end)return X.list()end function p.TouchedByAPlayerClosure(v,u)local q=function(q)local d=m:GetPlayerFromPart(q)if d~=nil then return u(v,d)end end return T.WithCoolDown(5,q)end function p._vehicleSpawnerTouchedDelegate(v,m)print("\065\076\069\082\084\058 "..(m.Name.." \106\117\115\116 \116\111\117\099\104\101\100 \109\101\046"))local q=s.StringValueOrNil("\083\112\097\119\110\115\080\114\111\116\111\116\121\112\101\073\100",v)local d=v:FindFirstChild("\083\112\097\119\110\080\097\100")local X=CFrame.new(d.Position)+Vector3.new(0,3,0)return u.CreateVehicleFromServerStorage(q,X)end function p.ConfigureSpawners(v)for v in v:GetSpawnerModels("\086\101\104\105\099\108\101\083\112\097\119\110\101\114\115")do print(v);(v:FindFirstChild("\084\111\117\099\104\115\116\111\110\101")).Touched:Connect(p.TouchedByAPlayerClosure(v,p._vehicleSpawnerTouchedDelegate))end end function p.Init(v)v:ConfigureSpawners()end return p
local DomainFinder = require(game
    :GetService("ServerScriptService")
    :WaitForChild("Finders", 5)
    :WaitForChild("DomainFinder", 2))

local spieler = DomainFinder:FindDomain("spieler")
local carAndDriver = DomainFinder:FindDomain("CarAndDriver")

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local require = require(ReplicatedStorage:WaitForChild("Nevermore", 2))
local std = require("Std")

local wraptor = std.wraptor
local linq = std.linq
local rq = std.rquery

local module = {}

function module:GetSpawnerModels(categoryName)
    local wsRoot = game:WaitForChild("Workspace", 1)
    -- Get Spawners

    local spawnersFolder = wsRoot:WaitForChild("Spawners", 1)
    local vehicleSpawners = spawnersFolder:WaitForChild(categoryName, 1)
    local spawnerModels = linq(vehicleSpawners:GetChildren()):where(
        function (item) return item:FindFirstChild("Touchstone") ~= nil end)

    return spawnerModels.list()
end

function module.TouchedByAPlayerClosure(spawnerModel, touchedByPlayerDelegate)

    local touchHandler = function(part)
        local playerFromPart = spieler:GetPlayerFromPart(part)
        if (playerFromPart ~= nil) then
            return touchedByPlayerDelegate(spawnerModel, playerFromPart)
        end
    end

    return wraptor.WithCoolDown(5, touchHandler)
end

function module._vehicleSpawnerTouchedDelegate(spawnerModel, playerFromPart)
    print(
        "ALERT: " .. playerFromPart.Name .. " just touched me."
    )
    local prototypeToSpawn = rq.StringValueOrNil("SpawnsPrototypeId", spawnerModel)
    local touchStone = spawnerModel:FindFirstChild("SpawnPad")
    local spawnLocation = CFrame.new(touchStone.Position) + Vector3.new(0, 3, 0)
    return carAndDriver.CreateVehicleFromServerStorage(prototypeToSpawn, spawnLocation)
end

function module:ConfigureSpawners()
    
    for spwnrMdl in self:GetSpawnerModels("VehicleSpawners") do
        print(spwnrMdl)
        spwnrMdl:FindFirstChild("Touchstone").Touched:Connect(
            module.TouchedByAPlayerClosure(spwnrMdl, module._vehicleSpawnerTouchedDelegate)
        )
    end
end

function module:Init()
    self:ConfigureSpawners()
end

return module