The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
Ultimate Tower Defense Sim script pastebin roblox
By LINK GAME on 2024-09-19 08:00 am | Syntax: LUA | Views: 14



New Script | Raw | Show/Hide line no. | Copy text to clipboard
  1. getgenv().Map = "City" -- City, Subzero, Jungle, Military, Japan, Castle, Space, Asgard, Atlantis, Dark Dimension, Marineford, Trost District, Planet Namek, Kamii University
  2. getgenv().Difficulty = "Easy" -- Easy, Normal, Hard, Insane
  3. getgenv().AutoPlace = true
  4. getgenv().Troops = 3 -- If this is 3 then it'll place the troops in your first 3 slots.
  5. getgenv().UpgradeLevel = 2 -- Troops will be upgraded to this level before placing another one.
  6. getgenv().FrontPreference,BackPreference = 0,0 -- Determines how close to the front and back of the map troops are placed. FrontPreference should be >= 0, BackPreference should be <= 0. The acceptable range for both variables changes depending on the map, use single integer increments and only change this setting if you understand what it does.
  7.  
  8. local RS = game:GetService("ReplicatedStorage")
  9. local PS = game:GetService("Players")
  10. repeat wait() until PS.LocalPlayer repeat wait() until PS.LocalPlayer.Character repeat wait() until PS.LocalPlayer.Character.HumanoidRootPart
  11. local HRP = PS.LocalPlayer.Character.HumanoidRootPart
  12.  
  13. if game.PlaceId == 5902977746 and not workspace:FindFirstChild("Map") then
  14.    local RE = RS.Modules.GlobalInit.RemoteEvents
  15.    for _,v in pairs(workspace.Lobby.ClassicPartyTeleporters:GetDescendants()) do
  16.        if v:IsA("TextLabel") and v.Name == "Status" and v.Text == "0 Players" then
  17.            HRP.CFrame = v.Parent.Parent.CFrame
  18.            wait(3/2)
  19.            RE.PlayerSelectedMap:FireServer(Map)
  20.            wait(3/2)
  21.            RE.PlayerQuickstartTeleport:FireServer()
  22.            wait(3/2)
  23.        end
  24.    end
  25. elseif game.PlaceId == 5902977746 and workspace:FindFirstChild("Map") then
  26.    local RE = RS.Modules.GlobalInit.RemoteEvents
  27.    local NE = RS.GenericModules.Service.Network
  28.    NE:WaitForChild("PlayerVoteForDifficulty")
  29.    NE.PlayerVoteForDifficulty:FireServer(Difficulty)
  30.    RE:WaitForChild("PlayerReadyForNextWave")
  31.    if AutoPlace then
  32.        getgenv().Points = BackPreference-1
  33.        for _,v in pairs(workspace.Map.Checkpoints:GetChildren()) do
  34.            Points = Points+1
  35.        end
  36.        local function placetroop()
  37.            R1 = tostring(math.random(FrontPreference+2,Points))
  38.            R2 = math.random(-10,10)
  39.            X,Y,Z = workspace.Map.Checkpoints[R1].CFrame:components()
  40.            NE.PlayerPlaceTower:FireServer(math.random(1,Troops), Vector3.new(X+R2,Y,Z+R2), 0)
  41.        end
  42.        placetroop()
  43.        while wait() do
  44.            getgenv().Num = workspace.EntityModels.Towers:GetChildren()
  45.            if #Num ~= 0 then
  46.                for k,d in pairs(workspace.EntityModels.Towers:GetDescendants()) do
  47.                    if d:IsA("ImageLabel") and d.Name == tostring(UpgradeLevel) then
  48.                        if not d.Visible then
  49.                            NE.PlayerUpgradeTower:FireServer(d.Parent.Parent.Parent.Parent.Name)
  50.                        elseif d.Visible then
  51.                            d.Parent.Parent.Parent.Parent.Parent = workspace.EntityModels.Enemies
  52.                        end
  53.                    end
  54.                end
  55.            else
  56.                placetroop()
  57.            end
  58.        end
  59.    end
  60. end