From venuslock, 20 Hours ago, written in Lua.
Embed
  1. local Tank
  2. local Map
  3. local OMap
  4. local Players = game.Players
  5. local LocalPlayer = Players.LocalPlayer
  6.  
  7.  
  8. local function search(map)
  9.   for i,v in pairs(map:GetChildren()) do
  10.     if v.ClassName == 'Model' and v:FindFirstChild('Seat') and 2 > (game.Workspace[LocalPlayer.Name].HumanoidRootPart.Position - v.Seat.Position).Magnitude then -- LocalPlayer.Character is nil
  11.       Tank = v
  12.       Map = map
  13.       if OMap == nil then
  14.         OMap = map.Name
  15.       end
  16.     end
  17.   end
  18. end
  19.  
  20. for i,v in pairs(game:GetService("ReplicatedStorage")["RemoteEvents Folder"]:GetChildren()) do
  21.   v.Name = i
  22. end
  23.  
  24. for i,v in pairs(game:GetService("ReplicatedStorage")["RemoteFunctions Folder"]:GetChildren()) do
  25.   v.Name = i
  26. end
  27.  
  28. local function set()
  29.   for i,v in pairs(game.Workspace:GetChildren()) do
  30.     if v.ClassName == 'Folder' and v.Name ~= '[DeathEffects]' then
  31.       search(v)
  32.       return
  33.     end
  34.   end
  35. end
  36. set()
  37.  
  38. game.Workspace.ChildAdded:Connect(
  39.   function(c)
  40.     if c.Name == LocalPlayer.Name then
  41.       wait()
  42.       Char = c
  43.       set()
  44.     end
  45.   end
  46. )
  47.  
  48. local function destroyAll()
  49.   for i,model in pairs(Map:GetChildren()) do
  50.     if model.ClassName == 'Model' and not model:FindFirstChild('Hull') then
  51.       for i,v in pairs(model:GetDescendants()) do
  52.         if v.ClassName == 'TouchTransmitter' then
  53.           spawn(function()
  54.             while v.Parent do
  55.               firetouchinterest(Tank.BUMPER, v.Parent, 0)
  56.               wait()
  57.               if v.Parent then
  58.                 firetouchinterest(Tank.BUMPER, v.Parent, 1)
  59.               end
  60.             end
  61.           end)
  62.         end
  63.       end
  64.     end
  65.   end
  66. end
  67.  
  68. if Map.Name ~= 'MapOne' then
  69.   while true do
  70.     wait(3)
  71.     destroyAll()
  72.     wait(5)
  73.     game:GetService("ReplicatedStorage")["RemoteFunctions Folder"]['8']:InvokeServer('MapOne')
  74.     wait()
  75.     game:GetService("ReplicatedStorage")["RemoteFunctions Folder"]['8']:InvokeServer(OMap)
  76.   end
  77. end
  78.  
  79. while wait(5) do
  80.   destroyAll()
  81. end

captcha