Advertisement
RgRacks

Roblox Tower Hero's Auto Placement Script (Works)

Apr 13th, 2020
4,821
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.43 KB | None | 0 0
  1. -- Auto Placement
  2. _G.AutoPlacer = true; -- change to false to stop.
  3.  
  4. while _G.AutoPlacer do
  5.     wait(5)
  6.    
  7.    -- Placed Troops (All of them)
  8.    local placedtroops = game.Workspace.Troop:GetChildren()
  9.    
  10.    -- See what player has to select from
  11.    local menu = game.Players.LocalPlayer.PlayerGui.Menu.Inventory
  12.    local mitem1 = menu["1"].TroopFrame.TroopModule.Value
  13.    local mitem2 = menu["2"].TroopFrame.TroopModule.Value
  14.    local mitem3 = menu["3"].TroopFrame.TroopModule.Value
  15.    local mitem4 = menu["4"].TroopFrame.TroopModule.Value
  16.    
  17.    -- Put menu items into table to random select.
  18.    local menutable = {mitem1, mitem2, mitem3, mitem4}
  19.    local value = math.random(1, #menutable) -- Random Select.
  20.    
  21.    -- Select randomly and place em for us
  22.    local otroopselect =  math.random(1, #placedtroops)
  23.    local otroop = placedtroops[otroopselect]
  24.    
  25.     if otroop.Stats.Owner.Value ~= game.Players.LocalPlayer.Name then
  26.         if otroop.Name ~= "Lemonade Cat" and otroop.Name ~= "Slime King" then -- Normally people stick these out of the way and you don't want troops doing nothing.
  27.            local value = math.random(1, #menutable) -- Random Select from our menu..
  28.            warn("Placing: " .. tostring(value))
  29.            game:GetService("ReplicatedStorage").Events.TroopPlace:FireServer(game:GetService("ReplicatedStorage").Troops[tostring(menutable[value])], otroop.PrimaryPart.Position, 0)
  30.        end
  31.    end
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement