TDS Automation API
Macro Recorder API
API-only reference for Space Hub Tower Defense Simulator automation. Use this page for recorder loading, global settings, tower methods, abilities, lobby control, and complete Lua snippets.
Premium required
Tower Defense Simulator
Lua snippets
How to Use
- Get your Premium key.
- Load the recorder script in your executor.
- Configure global _G settings before loading the library.
- For 24/7 auto-farm, place the script in autoexec and set _G.AutoRejoin = true.
loader.lua
script_key = "your_premium_key";
loadstring(game:HttpGet("https://f.spacehub.wtf/loader.lua"))()
Record files are saved to executor/workspace/Space-Hub/Games/TDS V2/script.lua. Put script.lua in executor/autoexec or run it manually.
example.lua
loadstring(game:HttpGet("https://f.spacehub.wtf/Scripts/TDS/Recorder/Library.lua"))()
Core Engine Methods + Global Config
| Variable | Type | Description |
|---|---|---|
| _G.AutoPickups | bool | Auto-collect SnowCharms / Lorebooks. |
| _G.AutoSkip | bool | Automatically vote to skip waves. |
| _G.AutoChain | bool | Cycle Commander "Call Of Arms". |
| _G.AutoDJ | bool | Auto-activate DJ Booth "Drop The Beat". |
| _G.AutoNecro | bool | Auto-activate Necromancer "Raise The Dead". |
| _G.AutoMercenary | bool | Auto Air-Drop from Mercenary Base. |
| _G.AutoMilitary | bool | Auto Airstrike from Military Base. |
| _G.AntiLag | bool | Remove effects/projectiles to reduce lag. |
| _G.AutoRejoin | bool | Auto-rejoin after match with webhook logging. |
| _G.SendWebhook | bool | Send match results to Discord. |
| _G.Webhook | string | Discord webhook URL. |
| Method | Parameters | Description |
|---|---|---|
| TDS:Place(name, x, y, z) | name, coordinates | Place tower and return a 1-based index. |
| TDS:Upgrade(idx, path) | index, path 1/2 | Upgrade tower. Path defaults to 1. |
| TDS:Sell(idx, reqWave) | index, optional wave | Sell tower and remove it from list. |
| TDS:SellAll(reqWave) | optional wave | Sell all placed towers. |
| TDS:SetTarget(idx, mode, reqWave) | First, Strong, Last, Random | Set targeting mode. |
| TDS:GetWave() | none | Returns current wave number. |
| TDS:VoteSkip(start, end) | start wave, optional end wave | Auto vote-skip from start to end. |
| TDS:UnlockTimeScale() | none | Unlock timescale tickets. |
| TDS:TimeScale(val) | 0.5, 1, 1.5, 2 | Cycle to desired speed. |
| TDS:Ready() | none | Ready up during match intermission. |
config.lua
_G.AutoPickups = true
_G.AutoSkip = true
_G.AutoRejoin = true
local TDS = loadstring(game:HttpGet("...Library.lua"))()
TDS:Place("Scout", 0.29, -6.36, 17.00)
TDS:SetOption
TDS:SetOption(index, "OptionName", "Value", requiredWave)
| Tower | Option | Values |
|---|---|---|
| Mercenary Base | "Unit 1" / "Unit 2" / "Unit 3" | "Grenadier", "Rifleman", "Riot Guard", "Field Medic" |
| Trapper | "Trap" | "Spike" or "Landmine" |
| DJ Booth | "Track" | "Green", "Red", "Purple" |
setoption.lua
TDS:SetOption(1, "Unit 1", "Grenadier")
TDS:SetOption(2, "Trap", "Landmine")
TDS:SetOption(3, "Track", "Purple", 10)
TDS:Ability
TDS:Ability(index, "AbilityName", dataTable, loop)
| Tower | Ability | Data format |
|---|---|---|
| Commander | "Call Of Arms" / "Support Caravan" | No data. |
| DJ Booth | "Drop The Beat" | No data. |
| Medic | "Ubercharge" | No data. |
| Hacker | "Hologram Tower" | { towerToClone = index, towerPosition = Vector3 } |
| Pursuit | "Patrol" | { ["position"] = Vector3 } |
| Gatling Gun | "FPS" | { ["enabled"] = true } |
| Brawler | "Reposition" | { ["position"] = Vector3 } |
| Mercenary / Military | "Air-Drop" / "Airstrike" | { pathName = 1, dist = number, directionCFrame = CFrame.new() } |
abilities.lua
TDS:Ability(1, "Call Of Arms", {}, true)
TDS:Ability(2, "Support Caravan", {})
TDS:Ability(3, "Drop The Beat", {})
TDS:Ability(4, "Ubercharge", {})
TDS:Ability(5, "Hologram Tower", { towerToClone = 6, towerPosition = Vector3.new(25, 10, 30) })
TDS:Ability(7, "Patrol", { ["position"] = Vector3.new(15, 5, 45) })
TDS:Ability(8, "FPS", { ["enabled"] = true })
TDS:Ability(9, "Reposition", { ["position"] = Vector3.new(30, 5, 60) })
TDS:Ability(10, "Air-Drop", { ["pathName"] = 1, ["dist"] = 100 })
TDS:Ability(11, "Airstrike", { ["pathName"] = 1, ["pointToEnd"] = 150, ["directionCFrame"] = CFrame.new(0, 0, 0) })
For Mercenary/Military, dist and pointToEnd
control path position. 0 means enemy spawn; max value depends on the map.
Advanced
Use autoexec for 24/7 AFK automation and set _G.AutoRejoin = true.
- dist defines where Mercenary Base Air-Drop triggers on the path.
- pointToEnd defines where Military Base Airstrike triggers on the path.
- 0 is enemy spawn; higher values are further down the path.
- 999 often targets the very end.
airstrike.lua
TDS:Ability(militaryIdx, "Airstrike", { pathName = 1, pointToEnd = 110 })
| Method | Description |
|---|---|
| TDS:GetGameState() | Returns "LOBBY" or "GAME". |
| TDS:GetRewards() | Parses post-game screen into rewards data. |
| TDS:RestartWithRejoin() | Resets and teleports back to game. |
Your GitHub strategy should start only after START STRATEGY.
You do not need TDS:Loadout(), TDS:Mode(),
or TDS:GameInfo() inside the strategy body.
If you were teleported to lobby unexpectedly, make sure _G.AutoRejoin = false
when you do not want rejoin automation.
Lobby Methods
| Method | Parameters | Description |
|---|---|---|
| TDS:Mode(difficulty) | string | Select matchmaking mode, for example "Frost", "Hardcore", "Pizza Party". |
| TDS:Loadout(...) | tower names | Equip towers and unequip current loadout. |
| TDS:GameInfo(map, modifiers) | map name, modifiers table | Vote for map and modifiers. VIP uses override. |
| TDS:StartGame() | none | Send ready in lobby. |
lobby.lua
TDS:Loadout("Mercenary Base", "DJ Booth", "Hacker", "Scout", "Necromancer")
TDS:Mode("Frost")
TDS:GameInfo("Honey Valley", {})
TDS:StartGame()
Complete Configuration Snippet
complete_config.lua
_G.AutoPickups = true
_G.AutoSkip = true
_G.AutoChain = false
_G.AutoDJ = false
_G.AutoNecro = false
_G.AutoMercenary = false
_G.AutoMilitary = false
_G.AntiLag = true
_G.AutoRejoin = true
_G.SendWebhook = false
local TDS = loadstring(game:HttpGet("https://f.spacehub.wtf/Scripts/TDS/Recorder/Library.lua"))()
TDS:Loadout("Mercenary Base", "DJ Booth", "Hacker", "Scout", "Necromancer")
TDS:Mode("Frost")
TDS:GameInfo("Honey Valley", {})
TDS:UnlockTimeScale()
TDS:TimeScale(2)
TDS:Place("Scout", 0.2901, -6.3679, 17.0009, true)
TDS:Place("Scout", -1.0073, -6.3679, 17.8993, true)
TDS:Upgrade(1)
TDS:SetOption(19, "Track", "Red")
TDS:Ability(26, "Call Of Arms", nil, true)