Advertisement
Guest User

Untitled

a guest
Jan 15th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 95.30 KB | None | 0 0
  1. --SynapseX Decompiler
  2.  
  3. local _gui = game.ReplicatedStorage.GUILibrary.Guis:Clone()
  4. _gui.Parent = script
  5. local anims = require(_gui)
  6. local cr, cr2 = game.ReplicatedStorage.Calls.Cross, game.ReplicatedStorage.Calls.Parallel
  7. OriginFrame = {}
  8. function _crEvent(n)
  9. local f, e = cr:FindFirstChild(n)
  10. if f then
  11. e = f
  12. else
  13. e = Instance.new("RemoteEvent", cr)
  14. e.Name = n
  15. end
  16. return e
  17. end
  18. function _crFunction(n)
  19. local f, e = cr:FindFirstChild(n)
  20. if f then
  21. e = f
  22. else
  23. e = Instance.new("RemoteFunction", cr)
  24. e.Name = n
  25. end
  26. return e
  27. end
  28. function _prEvent(n)
  29. local f, e = cr2:FindFirstChild(n)
  30. if f then
  31. e = f
  32. else
  33. e = Instance.new("BindableEvent", cr2)
  34. e.Name = n
  35. end
  36. return e
  37. end
  38. function _prFunction(n)
  39. local f, e = cr2:FindFirstChild(n)
  40. if f then
  41. e = f
  42. else
  43. e = Instance.new("BindableFunction", cr2)
  44. e.Name = n
  45. end
  46. return e
  47. end
  48. function getLocalPlayer()
  49. if not game.Players.LocalPlayer then
  50. repeat
  51. wait()
  52. until game.Players.LocalPlayer
  53. end
  54. return game.Players.LocalPlayer
  55. end
  56. function getLocalCharacter()
  57. local pl = getLocalPlayer()
  58. if not pl.Character then
  59. repeat
  60. wait()
  61. until pl.Character
  62. end
  63. return pl.Character
  64. end
  65. function removeCorner()
  66. local assignview = getLocalPlayer().PlayerGui:WaitForChild("GameGUI"):FindFirstChild("AssignView")
  67. if assignview then
  68. assignview:TweenPosition(UDim2.new(1, 10, 1, 10), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.5)
  69. delay(0.5, function()
  70. assignview:Destroy()
  71. end)
  72. end
  73. end
  74. function getLocalCamera()
  75. if not workspace.CurrentCamera then
  76. repeat
  77. wait()
  78. until workspace.CurrentCamera
  79. end
  80. return workspace.CurrentCamera
  81. end
  82. function playing()
  83. return script.Parent.Enabled.Value
  84. end
  85. function clamp(n, bottom, top)
  86. return math.min(top, math.max(bottom, n))
  87. end
  88. function OriginFrame.new(v3)
  89. return CFrame.new(Vector3.new(0, 0, 0), v3)
  90. end
  91. for _, debugline in pairs(game.HttpService:JSONDecode(_crFunction("GetServerDebugs"):InvokeServer())) do
  92. print(debugline)
  93. end
  94. function enable()
  95. local GData = {
  96. Upgrades = game:GetService("HttpService"):JSONDecode(game.ReplicatedStorage.Calls.Cross.GetUpgrades:InvokeServer()),
  97. ItemDatabase = game.HttpService:JSONDecode(game.ReplicatedStorage.Calls.Cross.GetItemDictionary:InvokeServer()),
  98. ConfigAPI = require(game.ReplicatedStorage.GUILibrary.ConfigSurface_V1),
  99. O_BaseModel = game.ReplicatedStorage.Calls.Cross.GetBase:InvokeServer(),
  100. TierAPI = require(game.ReplicatedStorage.GUILibrary.TierImages),
  101. GuiAPI = anims,
  102. DB_Server = false,
  103. DB_Click = false,
  104. DB_Assign = false,
  105. O_LocalPlayer = getLocalPlayer(),
  106. O_PlayerFld = workspace.Players:WaitForChild(getLocalPlayer().Name, 1000000000),
  107. O_Mods = getLocalPlayer():WaitForChild("PlayerScripts", 1000000000):WaitForChild("Controller Modules", 1000000000),
  108. O_Selection = nil,
  109. O_SelectionGUI = nil,
  110. O_ButtonClick = nil,
  111. O_Difficulty = nil,
  112. O_ConfigureGUI = nil,
  113. T_SelectionBoxes = {},
  114. T_SelectionModels = {},
  115. T_SelectionMovingModels = {},
  116. OwnerCache = {},
  117. Selection_BoundingBox = {Anchor = nil},
  118. O_Mouse = getLocalPlayer():GetMouse(),
  119. Mouse_Offset = Vector3.new(-2, 0, -2),
  120. Skip_MBUFunction = false,
  121. MouseButton1_Down = false,
  122. KeyboardShift_Down = false,
  123. DontMBU = false,
  124. Rotation = 0,
  125. Placement_Model = nil,
  126. Placement_Count = 99,
  127. Placement_IsEmpty = false,
  128. Alignment = {X = 4, Z = 4},
  129. DefaultAlignment = {X = 4, Z = 4},
  130. CF_Placement = nil,
  131. O_Podium = nil,
  132. S_Automate = nil,
  133. S_Resource = nil,
  134. Gamepad = {
  135. Locked = false,
  136. Rotation = 0,
  137. Zoom = 0,
  138. Cursor = Vector3.new(0, 0, 0),
  139. Cursor_Turn = Vector3.new(0, 0, 0)
  140. },
  141. T_LastButtons = nil,
  142. Placement_Successful = false,
  143. InputType = "Keyboard",
  144. Undo_ActionList = {},
  145. TooMuchData = false,
  146. LastMenuCount = 4,
  147. S_StatusInfo = "",
  148. Menu_Open = false,
  149. Menus = {},
  150. Keys = {},
  151. T_Nodes = {},
  152. IsPlaying = playing
  153. }
  154. GData.API = {
  155. import = function(name, level)
  156. GData.imports = GData.imports or {}
  157. if GData.imports[name] then
  158. return GData.imports[name]
  159. else
  160. if not GData.O_Mods.Parent:FindFirstChild("Controller Module Structured") then
  161. GData.O_ModStructureFld = GData.O_ModStructureFld or Instance.new("Folder")
  162. GData.O_ModStructureFld.Name = "Controller Module Structured"
  163. GData.O_ModStructureFld.Parent = GData.O_Mods
  164. end
  165. local Import = GData.O_Mods:FindFirstChild(name, true):Clone()
  166. Import.Parent = GData.O_ModStructureFld
  167. if level then
  168. return require(Import)(GData)
  169. else
  170. return require(Import)
  171. end
  172. end
  173. end
  174. }
  175. GData.KeyBinds = {
  176. MouseButton2 = {
  177. rc_menu = {
  178. close = {
  179. ["Right Click"] = "Unknown"
  180. }
  181. }
  182. },
  183. Keyboard = {
  184. idle = {
  185. run = {Shift = "LeftShift"},
  186. inventory = {E = "E"},
  187. shop = {F = "F"}
  188. },
  189. rc_menu = {
  190. run = {Shift = "LeftShift"},
  191. move = {Z = "Z"},
  192. ["pick up"] = {X = "X"},
  193. upgrade = {C = "C"},
  194. close = {V = "V"}
  195. },
  196. inventory = {
  197. run = {Shift = "LeftShift"},
  198. inventory = {E = "E"},
  199. shop = {F = "F"}
  200. },
  201. build_map = {
  202. run = {Shift = "LeftShift"},
  203. undo = {F = "F"}
  204. },
  205. resource_map = {
  206. run = {Shift = "LeftShift"}
  207. }
  208. },
  209. Gamepad = {
  210. idle = {
  211. run = {LT = "ButtonL2"},
  212. inventory = {X = "ButtonX"},
  213. shop = {Y = "ButtonY"}
  214. },
  215. rc_menu = {
  216. run = {LT = "ButtonL2"},
  217. move = {Z = "Z"},
  218. ["pick up"] = {X = "X"},
  219. upgrade = {C = "C"},
  220. close = {V = "V"}
  221. },
  222. inventory = {
  223. run = {LT = "ButtonL2"},
  224. inventory = {X = "ButtonX"},
  225. shop = {Y = "ButtonY"}
  226. },
  227. build_map = {
  228. run = {LT = "ButtonL2"},
  229. undo = {F = "F"}
  230. },
  231. resource_map = {
  232. run = {LT = "ButtonL2"}
  233. }
  234. }
  235. }
  236. GData.O_Anchor = GData.O_BaseModel.PrimaryPart
  237. GData.T_TierImages = GData.TierAPI[1]
  238. GData.T_TierData = GData.TierAPI[2]
  239. GData.Actions = {
  240. Pickup = function(pickup_model)
  241. if type(pickup_model) == "table" then
  242. if GData.DB_Server then
  243. return
  244. end
  245. GData.DB_Server = true
  246. for _, model in pairs(GData.T_SelectionModels) do
  247. if model and model.Parent then
  248. game.ReplicatedStorage.Calls.Cross.PickupStructure:InvokeServer(model, true)
  249. end
  250. end
  251. GData.DB_Server = false
  252. return
  253. end
  254. if GData.DB_Server then
  255. return
  256. end
  257. GData.DB_Server = true
  258. if not pickup_model then
  259. GData.DB_Server = false
  260. return
  261. end
  262. game.ReplicatedStorage.Calls.Cross.PickupStructure:InvokeServer(pickup_model, true)
  263. if not pickup_model then
  264. GData.DB_Server = false
  265. return
  266. end
  267. pickup_model:Destroy()
  268. pickup_model = nil
  269. GData.DB_Server = false
  270. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.CloseMenu:Invoke()
  271. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
  272. end,
  273. Upgrade = function(upgrade_model, override_debounce)
  274. if type(upgrade_model) == "table" then
  275. if GData.DB_Server then
  276. return
  277. end
  278. for _, model in pairs(GData.T_SelectionModels) do
  279. if model and model.Parent then
  280. coroutine.wrap(function()
  281. GData.Actions.Upgrade(model, true)
  282. end)()
  283. end
  284. end
  285. GData.DB_Server = false
  286. return
  287. end
  288. if not override_debounce then
  289. if GData.DB_Server then
  290. return
  291. end
  292. GData.DB_Server = true
  293. end
  294. if not upgrade_model then
  295. GData.DB_Server = false
  296. return
  297. end
  298. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
  299. local result, model = game.ReplicatedStorage.Calls.Cross.IssueUpgrade:InvokeServer(upgrade_model)
  300. if result then
  301. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = true
  302. end
  303. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.CloseMenu:Invoke()
  304. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
  305. if not override_debounce then
  306. GData.DB_Server = false
  307. end
  308. end,
  309. Move = function(move_model)
  310. if type(move_model) == "table" then
  311. for i = 1, #move_model do
  312. end
  313. local resultfld = _crFunction("PickupStructures"):InvokeServer(GData.API.doUnpack(move_model))
  314. if resultfld == -1 then
  315. error("failed model pickup", 2)
  316. return
  317. end
  318. for i = 1, #GData.T_SelectionMovingModels do
  319. table.remove(GData.T_SelectionMovingModels, 1)
  320. end
  321. for _, v in pairs(resultfld:GetChildren()) do
  322. GData.T_SelectionMovingModels[#GData.T_SelectionMovingModels + 1] = v.Value
  323. end
  324. return
  325. end
  326. if GData.DB_Server then
  327. return
  328. end
  329. GData.DB_Server = true
  330. if not move_model then
  331. GData.DB_Server = false
  332. return
  333. end
  334. local mod = move_model
  335. local n, rot = game.ReplicatedStorage.Calls.Cross.PickupStructure:InvokeServer(mod, true)
  336. if not move_model then
  337. GData.DB_Server = false
  338. return
  339. end
  340. GData.Assign_As_Cursor(move_model, (n or 1) - 1, rot)
  341. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.CloseMenu:Invoke()
  342. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
  343. GData.DB_Server = false
  344. end,
  345. Close = function()
  346. print("clos?")
  347. if GData.DB_Server then
  348. return
  349. end
  350. print("cloz.")
  351. GData.DB_Server = true
  352. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.CloseMenu:Invoke()
  353. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
  354. GData.DB_Server = false
  355. end,
  356. CFG = function(configure_model)
  357. if not configure_model then
  358. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.CloseMenu:Invoke()
  359. return
  360. end
  361. if GData.DB_Server then
  362. return
  363. end
  364. GData.DB_Server = true
  365. if GData.O_ConfigureGUI and GData.O_ConfigureGUI.Parent then
  366. GData.O_ConfigureGUI:Destroy()
  367. GData.O_ConfigureGUI = nil
  368. end
  369. GData.O_ConfigureGUI = GData.ConfigAPI:Render(configure_model:FindFirstChild("CFG"))
  370. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.CloseMenu:Invoke()
  371. game:GetService("GuiService").GuiNavigationEnabled = true
  372. GData.DB_Server = false
  373. end
  374. }
  375. GData.Loopable_API_Order = {
  376. GData.API.import("CFGFunctionsLoop", true),
  377. GData.API.import("LoopYields", true),
  378. GData.API.import("Multi-Select API", true),
  379. GData.API.import("TileEditorCode", true)
  380. }
  381. local SaveVisualization = GData.API.import("SaveModule", true)
  382. SaveVisualization.init()
  383. local InitVisibility = function(visible, ...)
  384. local gui = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("GameGUI")
  385. for _, Name in pairs({
  386. ...
  387. }) do
  388. gui[Name].Visible = visible
  389. end
  390. end
  391. InitVisibility(true, "HUD2", "HUD3", "HUD4", "Menu", "InvInfo")
  392. script.Parent.Enabled.Value = true
  393. _prFunction("LocalGetImages").OnInvoke = function()
  394. return GData.ItemDatabase
  395. end
  396. _prFunction("GetMenuIsOpen").OnInvoke = function()
  397. return GData.Menu_Open
  398. end
  399. function GData.API.RetrieveModelConfig(mod)
  400. local t = {}
  401. local c = 0
  402. if mod:FindFirstChild("CFG") then
  403. for _, cfg in pairs(mod.CFG:GetChildren()) do
  404. c = c + 1
  405. t[cfg.Name] = cfg.Value
  406. end
  407. else
  408. return
  409. end
  410. if c > 0 then
  411. return t
  412. end
  413. end
  414. function GData.API.CheckIsOwner(opt)
  415. if GData.OwnerCache[opt.Parent] == nil then
  416. GData.OwnerCache[opt.Parent] = game.ReplicatedStorage.Calls.Cross.Client.IsOwner:InvokeServer(opt.Parent)
  417. end
  418. return GData.OwnerCache[opt.Parent] or false
  419. end
  420. function GData.API.MenuIsOpenBool()
  421. local pgui = getLocalPlayer():WaitForChild("PlayerGui")
  422. return pgui:WaitForChild("MenuOpen")
  423. end
  424. function GData.API.GetMenu()
  425. local pgui = getLocalPlayer():WaitForChild("PlayerGui")
  426. return pgui:WaitForChild("GameGUI"):WaitForChild("Menu")
  427. end
  428. function GData.API.ShowMenu(menu)
  429. if menu:FindFirstChild("MenuSpecial") then
  430. local funcs = require(menu.MenuSpecial)
  431. if funcs.OnLoad then
  432. funcs.OnLoad()
  433. end
  434. end
  435. menu.Visible = true
  436. GData.Menu_Open = true
  437. table.insert(GData.Menus, menu)
  438. end
  439. function GData.API.HideMenu(menu)
  440. if not menu then
  441. return
  442. end
  443. if not GData.Menus[menu] then
  444. return
  445. end
  446. local window = GData.Menus[menu]
  447. table.remove(GData.Menus, menu)
  448. if #GData.Menus < 1 then
  449. GData.Menu_Open = false
  450. end
  451. if window.Visible then
  452. window.Visible = false
  453. end
  454. end
  455. function GData.API.HideMenus()
  456. for i = #GData.Menus, 1, -1 do
  457. local window = GData.Menus[i]
  458. GData.API.HideMenu(i)
  459. window.Visible = false
  460. end
  461. GData.Menu_Open = false
  462. end
  463. _prEvent("CloseAllMenus").Event:connect(function()
  464. GData.API.HideMenus()
  465. end)
  466. function GData.API.ToggleMenu(key)
  467. local _menu = GData.Keys[key]
  468. local mn = _menu.Name
  469. if _menu.Visible then
  470. GData.API.HideMenu(GData.API.FindMenu(_menu.Name))
  471. _menu.Visible = false
  472. if mn == "Menu3" then
  473. GData.API.GetMenu().Parent.HUD2.Visible = true
  474. GData.API.GetMenu().Parent.HUD3.Visible = true
  475. GData.API.GetMenu().Parent.HUD4.Visible = true
  476. end
  477. else
  478. GData.API.ShowMenu(_menu)
  479. _menu.Visible = true
  480. if mn == "Menu3" then
  481. GData.API.GetMenu().Parent.HUD2.Visible = false
  482. GData.API.GetMenu().Parent.HUD3.Visible = false
  483. GData.API.GetMenu().Parent.HUD4.Visible = false
  484. end
  485. end
  486. GData.API.FixMenus()
  487. end
  488. function GData.API.FindMenu(name)
  489. local picked
  490. for i, c in ipairs(GData.Menus) do
  491. if not picked and c.Name == name then
  492. picked = i
  493. end
  494. end
  495. return picked
  496. end
  497. function GData.API.FixMenus()
  498. local lb = GData.API.GetMenu().Parent.Labels
  499. local iinfo = GData.API.GetMenu().Parent.InvInfo
  500. if GData.Menus[1] and GData.Menus[2] and GData.Menus[3] then
  501. GData.Menus[1].Position = UDim2.new(0.05, 0, 0.35, 11)
  502. GData.Menus[1].Size = UDim2.new(0.4, 0, 0.6, 0)
  503. GData.Menus[2].Position = UDim2.new(0.55, 0, 0.35, 11)
  504. GData.Menus[2].Size = UDim2.new(0.4, 0, 0.6, 0)
  505. GData.Menus[3].Position = UDim2.new(2, 0, 0, 0)
  506. lb.Position = UDim2.new(0.55, -1, 0.95, 0)
  507. elseif GData.Menus[1] and GData.Menus[2] then
  508. GData.Menus[1].Position = UDim2.new(0.05, 0, 0.35, 11)
  509. GData.Menus[1].Size = UDim2.new(0.4, 0, 0.6, 0)
  510. GData.Menus[2].Position = UDim2.new(0.55, 0, 0.35, 11)
  511. GData.Menus[2].Size = UDim2.new(0.4, 0, 0.6, 0)
  512. lb.Position = UDim2.new(0.55, -1, 0.95, 0)
  513. elseif GData.Menus[1] then
  514. GData.Menus[1].Position = UDim2.new(0.3, 0, 0.35, 11)
  515. GData.Menus[1].Size = UDim2.new(0.4, 0, 0.6, 0)
  516. lb.Position = UDim2.new(1, -1, 0.8, -1)
  517. end
  518. GData.Menu_Open = #GData.Menus > 0
  519. end
  520. function GData.API.AddMenu(Key, Object)
  521. GData.Keys[Key] = Object
  522. Object.Changed:connect(function(property)
  523. if property == "Visible" and GData.API.FindMenu(Object) and not Object.Visible then
  524. GData.API.HideMenu(GData.API.FindMenu(Object))
  525. end
  526. end)
  527. end
  528. GData.API.AddMenu("E", GData.API.GetMenu():WaitForChild("Menu1", 1000000000))
  529. GData.API.AddMenu("F", GData.API.GetMenu():WaitForChild("Menu2", 1000000000))
  530. function GData.API.ClientRcon(action, ...)
  531. local args = {
  532. ...
  533. }
  534. if action == "new-menu" then
  535. local __menu = args[1]:Clone()
  536. __menu.Parent = GData.API.GetMenu()
  537. GData.API.AddMenu(__menu.Key.Value, __menu)
  538. if __menu.Name == "MenuTrade" then
  539. GData.API.HideMenus()
  540. GData.API.ShowMenu(GData.API.GetMenu().Menu1)
  541. GData.API.ShowMenu(GData.API.GetMenu().MenuTrade)
  542. end
  543. elseif action == "remove-menu" then
  544. local __menu = GData.Keys[args[1]]
  545. if __menu then
  546. GData.Keys[args[1]] = nil
  547. __menu.Parent = nil
  548. GData.API.FixMenus()
  549. end
  550. elseif action == "menu-active" then
  551. return GData.Keys[args[1]] ~= nil
  552. end
  553. end
  554. _crFunction("FRcon").OnClientInvoke = GData.API.ClientRcon
  555. _crEvent("Rcon").OnClientEvent:connect(GData.API.ClientRcon)
  556. _prEvent("Rcon").Event:connect(GData.API.ClientRcon)
  557. GData.O_InvHelpLabels = game.Players.LocalPlayer:WaitForChild("PlayerGui", 1000000000):WaitForChild("GameGUI", 1000000000).InvInfo
  558. function GData.API.ClearButtonLabels()
  559. for _, c in pairs(GData.O_InvHelpLabels:GetChildren()) do
  560. c:Destroy()
  561. end
  562. end
  563. function GData.API.NewButtonLabel(Button, Alias)
  564. local n = #GData.O_InvHelpLabels:GetChildren()
  565. local bt = GData.API.ButtonLabel()
  566. bt.Label.Text = Button
  567. if #Button > 1 then
  568. bt.Image = ""
  569. bt.BackgroundTransparency = 0
  570. bt.BorderSizePixel = 3
  571. bt.Info.Position = UDim2.new(1, 11, 0.5, 0)
  572. bt.Size = UDim2.new(0, 105, 0, 35)
  573. end
  574. bt.Info.Text = Alias:sub(1, 1):upper() .. Alias:sub(2)
  575. bt.Visible = false
  576. bt.Position = UDim2.new(0, 5, 1, -65 - 40 * (n - 1))
  577. bt.Parent = GData.O_InvHelpLabels
  578. anims:WindowFadeIn(bt, 0.1)
  579. return bt
  580. end
  581. local btlb
  582. function GData.API.ButtonLabel()
  583. if btlb then
  584. return btlb:Clone()
  585. else
  586. local btlb = Instance.new("ImageLabel")
  587. btlb.Name = "ButtonImage"
  588. btlb.Size = UDim2.new(0, 35, 0, 35)
  589. btlb.Image = "rbxassetid://2065496223"
  590. btlb.AnchorPoint = Vector2.new(0, 0.5)
  591. btlb.BackgroundTransparency = 1
  592. btlb.BackgroundColor3 = Color3.fromRGB(127, 127, 255)
  593. btlb.BorderColor3 = Color3.fromRGB(63.5, 63.5, 127)
  594. local btxt = Instance.new("TextLabel", btlb)
  595. btxt.Name = "Label"
  596. btxt.Position = UDim2.new(0.5, 0, 0.5, 0)
  597. btxt.Size = UDim2.new(0.8, 0, 0.8, 0)
  598. btxt.TextXAlignment = "Center"
  599. btxt.TextYAlignment = "Center"
  600. btxt.Text = "X"
  601. btxt.Font = "Bodoni"
  602. btxt.TextStrokeTransparency = 0
  603. btxt.TextScaled = true
  604. btxt.TextColor3 = Color3.fromRGB(255, 255, 255)
  605. btxt.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
  606. btxt.BackgroundTransparency = 1
  607. btxt.AnchorPoint = Vector2.new(0.5, 0.5)
  608. local btxt2 = Instance.new("TextLabel", btlb)
  609. btxt2.Name = "Info"
  610. btxt2.Position = UDim2.new(1, 6, 0.5, 0)
  611. btxt2.Size = UDim2.new(5, 0, 1, 0)
  612. btxt2.TextXAlignment = "Left"
  613. btxt2.TextYAlignment = "Center"
  614. btxt2.Text = "X - Pick up"
  615. btxt2.Font = "Bodoni"
  616. btxt2.TextSize = 33
  617. btxt2.TextColor3 = Color3.fromRGB(255, 255, 255)
  618. btxt2.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
  619. btxt2.TextStrokeTransparency = 0
  620. btxt2.BackgroundTransparency = 1
  621. btxt2.AnchorPoint = Vector2.new(0, 0.5)
  622. return btlb:Clone()
  623. end
  624. end
  625. function GData.API.ChangeInvInfoStatus(iskb, stat)
  626. if stat == GData.S_StatusInfo then
  627. return
  628. end
  629. local EmptyTable = {}
  630. GData.O_InvHelpLabels.Text = ""
  631. GData.S_StatusInfo = stat
  632. GData.API.ClearButtonLabels()
  633. local pull = iskb and "Keyboard" or "Gamepad"
  634. for name, kmap in pairs(GData.KeyBinds[pull][stat] or EmptyTable) do
  635. for alias in pairs(kmap) do
  636. GData.API.NewButtonLabel(alias, name)
  637. end
  638. end
  639. for name, kmap in pairs(GData.KeyBinds.MouseButton2[stat] or EmptyTable) do
  640. for alias in pairs(kmap) do
  641. GData.API.NewButtonLabel(alias, name)
  642. end
  643. end
  644. end
  645. function GData.API.AddSelection(model, sbox, pgui)
  646. sbox.Name = "Multi-Selection Box"
  647. GData.T_SelectionBoxes[model] = sbox
  648. sbox.Parent = pgui
  649. sbox.Adornee = model
  650. table.insert(GData.T_SelectionModels, model)
  651. return sbox
  652. end
  653. function GData.API.ClearSelection()
  654. for model, sbox in pairs(GData.T_SelectionBoxes) do
  655. sbox.Adornee = nil
  656. sbox:Destroy()
  657. GData.T_SelectionBoxes[model] = nil
  658. end
  659. for i = 1, #GData.T_SelectionModels do
  660. table.remove(GData.T_SelectionModels, 1)
  661. end
  662. end
  663. function GData.API.RemoveSelection(model)
  664. local sbox = GData.T_SelectionBoxes[model]
  665. if sbox then
  666. sbox.Adornee = nil
  667. sbox:Destroy()
  668. GData.T_SelectionBoxes[model] = nil
  669. end
  670. for i, obj in ipairs(GData.T_SelectionModels) do
  671. if obj == model then
  672. table.remove(GData.T_SelectionModels, i)
  673. end
  674. end
  675. end
  676. function GData.API.SelectionExists(model)
  677. for _, obj in pairs(GData.T_SelectionModels) do
  678. if obj == model then
  679. return obj
  680. end
  681. end
  682. end
  683. function GData.API.SpawnNode(position)
  684. local p1, p2 = Instance.new("Part", workspace.CurrentCamera), Instance.new("Part", workspace.CurrentCamera)
  685. local t = {
  686. p1,
  687. p2,
  688. true,
  689. 0,
  690. position
  691. }
  692. local n = #GData.T_Nodes + 1
  693. GData.T_Nodes[n] = t
  694. p1.Size, p2.Size = Vector3.new(0.05, 0.05, 0.05), Vector3.new(0.05, 0.05, 0.05)
  695. p1.Name, p2.Name = "NodeBase", "NodeBeam"
  696. p1.BrickColor, p2.BrickColor = BrickColor.new(104), BrickColor.new("Bright yellow")
  697. p1.Material, p2.Material = "Neon", "Neon"
  698. p1.Transparency, p2.Transparency = 0.5, 0.5
  699. p1.CFrame, p2.CFrame = CFrame.new(t[5]), CFrame.new(t[5])
  700. p1.CanCollide, p2.CanCollide = false, false
  701. local cm, cm2 = Instance.new("CylinderMesh", p2), Instance.new("CylinderMesh", p1)
  702. cm.Name, cm2.Name = "BeamMesh", "GlowRound"
  703. coroutine.wrap(function()
  704. local rs = game:GetService("RunService").RenderStepped
  705. while t[4] < 1 and t[3] do
  706. local xa = t[4] ^ 0.5
  707. p1.Size = Vector3.new(0.05 + xa * 1.5, 0.05, 0.05 + xa * 1.5)
  708. p2.Size = Vector3.new(0.05 + xa * 0.2, 0.05 + xa * 25, 0.05 + xa * 0.2)
  709. p1.CFrame, p2.CFrame = CFrame.new(t[5]), CFrame.new(t[5])
  710. t[4] = t[4] + rs:wait() * 3
  711. end
  712. if t[3] then
  713. local xa = 1
  714. p1.Size = Vector3.new(0.05 + xa * 1.5, 0.05, 0.05 + xa * 1.5)
  715. p2.Size = Vector3.new(0.05 + xa * 0.2, 0.05 + xa * 25, 0.05 + xa * 0.2)
  716. while t[3] do
  717. p1.CFrame, p2.CFrame = CFrame.new(t[5]), CFrame.new(t[5])
  718. rs:wait()
  719. end
  720. t[3] = false
  721. end
  722. end)()
  723. return n
  724. end
  725. function GData.API.VanishNode(n)
  726. local t = GData.T_Nodes[n]
  727. table.remove(GData.T_Nodes, n)
  728. local p1 = t[1]
  729. local p2 = t[2]
  730. local position = t[5]
  731. if not t then
  732. return
  733. end
  734. coroutine.wrap(function()
  735. local rs = game:GetService("RunService").RenderStepped
  736. t[3] = false
  737. while t[4] > 0 do
  738. local xa = t[4] ^ 0.5
  739. p1.Size = Vector3.new(0.05 + xa * 1.5, 0.05, 0.05 + xa * 1.5)
  740. p2.Size = Vector3.new(0.05 + xa * 0.2, 0.05 + xa * 25, 0.05 + xa * 0.2)
  741. p1.CFrame, p2.CFrame = CFrame.new(position), CFrame.new(position)
  742. t[4] = t[4] - rs:wait() * 4
  743. end
  744. p1:Destroy()
  745. p2:Destroy()
  746. end)()
  747. end
  748. function GData.API.VanishNodes()
  749. for i = #GData.T_Nodes, 1, -1 do
  750. if GData.T_Nodes[i] then
  751. GData.API.VanishNode(i)
  752. end
  753. wait()
  754. end
  755. end
  756. function GData.API.GetSelectedModels(pos1, pos2, selected_models)
  757. local selected_models = selected_models or {}
  758. local start_point = pos1
  759. local end_point = pos2 + Vector3.new(0, 125, 0)
  760. local region = Region3.new(Vector3.new(math.min(start_point.X, end_point.X), math.min(start_point.Y, end_point.Y), math.min(start_point.Z, end_point.Z)), Vector3.new(math.max(start_point.X, end_point.X), math.max(start_point.Y, end_point.Y), math.max(start_point.Z, end_point.Z)))
  761. local parts = workspace:FindPartsInRegion3WithWhiteList(region, {
  762. workspace.Players[getLocalPlayer().Name].Tiles
  763. }, 5000)
  764. for _, part in pairs(parts) do
  765. local mod = part:FindFirstAncestorOfClass("Model")
  766. while mod and mod:FindFirstAncestorOfClass("Model") do
  767. mod = mod:FindFirstAncestorOfClass("Model")
  768. end
  769. if mod and mod:FindFirstChild("UnitOptions") and GData.API.CheckIsOwner(mod.UnitOptions) then
  770. selected_models[mod] = true
  771. end
  772. end
  773. return selected_models
  774. end
  775. function GData.API.CenterPoint(models)
  776. local pos = Vector3.new(0, 0, 0)
  777. for _, _model in pairs(models) do
  778. print(tostring(_model))
  779. if _model.PrimaryPart then
  780. pos = pos + _model.PrimaryPart.Position
  781. end
  782. end
  783. return pos / #models
  784. end
  785. function GData.API.doUnpack(models)
  786. local f = Instance.new("Folder", game.ReplicatedStorage.ClientReplications)
  787. f.Name = "Client Replication from " .. game.Players.LocalPlayer.Name
  788. for i = 1, #models do
  789. local v = Instance.new("ObjectValue", f)
  790. v.Value = models[i]
  791. v.Name = "Model Replication"
  792. end
  793. return f
  794. end
  795. local ibox
  796. function GData.API.IntermediateBox(pos1, pos3)
  797. local pos2, pos4 = Vector3.new(pos1.X, math.max(pos1.Y, pos3.Y), pos3.Z), Vector3.new(pos3.X, math.max(pos1.Y, pos3.Y), pos1.Z)
  798. local cam = getLocalCamera()
  799. local m = cam:FindFirstChild("Box") or Instance.new("Model", cam)
  800. m.Name = "Box"
  801. if not ibox then
  802. ibox = Instance.new("Part")
  803. ibox.Size = Vector3.new(10, 0.1, 0.1)
  804. ibox.Material = "Slate"
  805. ibox.BrickColor = BrickColor.Blue()
  806. ibox.Anchored = true
  807. ibox.CanCollide = false
  808. end
  809. local square_size = (pos2 - pos1).magnitude
  810. local square_size2 = (pos2 - pos3).magnitude
  811. local ib1 = m:FindFirstChild("IBox 1") or ibox:Clone()
  812. ib1.Name = "IBox 1"
  813. ib1.Size = Vector3.new(0.1, 0.1, square_size)
  814. ib1.CFrame = CFrame.new((pos2 + pos1) / 2, pos2)
  815. ib1.Parent = m
  816. local ib2 = m:FindFirstChild("IBox 2") or ibox:Clone()
  817. ib2.Name = "IBox 2"
  818. ib2.Size = Vector3.new(0.1, 0.1, square_size2)
  819. ib2.CFrame = CFrame.new((pos2 + pos3) / 2, pos3)
  820. ib2.Parent = m
  821. local ib3 = m:FindFirstChild("IBox 3") or ibox:Clone()
  822. ib3.Name = "IBox 3"
  823. ib3.Size = Vector3.new(0.1, 0.1, square_size)
  824. ib3.CFrame = CFrame.new((pos3 + pos4) / 2, pos4)
  825. ib3.Parent = m
  826. local ib4 = m:FindFirstChild("IBox 4") or ibox:Clone()
  827. ib4.Name = "IBox 4"
  828. ib4.Size = Vector3.new(0.1, 0.1, square_size2)
  829. ib4.CFrame = CFrame.new((pos4 + pos1) / 2, pos1)
  830. ib4.Parent = m
  831. end
  832. function GData.API.IntermediateBox_Clear()
  833. local cam = getLocalCamera()
  834. local m = cam:FindFirstChild("Box")
  835. if m then
  836. m:Destroy()
  837. end
  838. end
  839. function GData.API.lockOnModel(m)
  840. if GData.Gamepad.Locked then
  841. return
  842. end
  843. if GData.InputType ~= "Gamepad" then
  844. return
  845. end
  846. local cam = getLocalCamera()
  847. cam.CameraType = "Scriptable"
  848. local size = math.max(m.PrimaryPart.Size.X, m.PrimaryPart.Size.Z)
  849. if math.abs(GData.Gamepad.Cursor_Turn.X) > 0.25 then
  850. GData.Gamepad.Rotation = GData.Gamepad.Rotation + GData.Gamepad.Cursor_Turn.X
  851. end
  852. if 0.25 < math.abs(GData.Gamepad.Cursor_Turn.Y) then
  853. GData.Gamepad.Zoom = clamp(GData.Gamepad.Zoom + GData.Gamepad.Cursor_Turn.Y / 2, 5, 25)
  854. end
  855. cam:Interpolate(CFrame.new(m.PrimaryPart.CFrame.p) * CFrame.Angles(0, math.rad(GData.Gamepad.Rotation) * 5, 0) * CFrame.new(size + GData.Gamepad.Zoom, 15 + GData.Gamepad.Zoom, size + GData.Gamepad.Zoom), m.PrimaryPart.CFrame, 0.1)
  856. end
  857. function GData.API.lockOffModel()
  858. if not getLocalPlayer().PlayerGui.GameStatus.ShowingTutorial.Value then
  859. local cam = getLocalCamera()
  860. cam.CameraType = "Custom"
  861. end
  862. end
  863. function GData.round(x)
  864. return x - math.floor(x) >= 0.5 and math.ceil(x) or math.floor(x)
  865. end
  866. function GData.limitDig(num, amnt)
  867. local x = 10 ^ amnt
  868. return GData.round(num * x) / x
  869. end
  870. function GData.generateExtension(num, i)
  871. local exts = {
  872. "",
  873. "k",
  874. "M",
  875. "B",
  876. "T",
  877. "Qd",
  878. "Qtn",
  879. "Sxt",
  880. "Sp",
  881. "Oc",
  882. "No",
  883. "De",
  884. "Und",
  885. "Dud",
  886. "Trd",
  887. "Qtd",
  888. "Qnd",
  889. "Sxtd",
  890. "Spd",
  891. "Octd",
  892. "Nod",
  893. "Vit",
  894. "Unvit",
  895. "Duvit",
  896. "Trvit",
  897. "Quvit",
  898. "Qnvit",
  899. "Sxvit",
  900. "Spvit",
  901. "Ocvit",
  902. "Novit",
  903. "Tgt",
  904. "Untgt",
  905. "Dutgt",
  906. "Trtgt",
  907. "Qutgt",
  908. "Qntgt",
  909. "Sxtgt",
  910. "Sptgt",
  911. "Octgt",
  912. "Notgt",
  913. "Qdt",
  914. "Unqdt",
  915. "Duqdt",
  916. "Trqdt",
  917. "Quqdt",
  918. "Qnqdt",
  919. "Sxqdt",
  920. "Spqdt",
  921. "Ocqdt",
  922. "Noqdt",
  923. "Qnt",
  924. "Unqnt",
  925. "Duqnt",
  926. "Trqnt",
  927. "Quqnt",
  928. "Qnqnt",
  929. "Sxqnt",
  930. "Spqnt",
  931. "Ocqnt",
  932. "Noqnt",
  933. "Sgt",
  934. "Unsgt",
  935. "Dusgt",
  936. "Trsgt",
  937. "Qusgt",
  938. "Qnsgt",
  939. "Sxsgt",
  940. "Spsgt",
  941. "Ocsgt",
  942. "Nosgt",
  943. "Spt",
  944. "Unspt",
  945. "Duspt",
  946. "Trspt",
  947. "Quspt",
  948. "Qnspt",
  949. "Sxspt",
  950. "Spspt",
  951. "Ocspt",
  952. "Nospt",
  953. "Ocg",
  954. "Unocg",
  955. "Duocg",
  956. "Trocg",
  957. "Quocg",
  958. "Qnocg",
  959. "Sxocg",
  960. "Spocg",
  961. "Ococg",
  962. "Noocg",
  963. "Ngt",
  964. "Unngt",
  965. "Dungt",
  966. "Trngt",
  967. "Qungt",
  968. "Qnngt",
  969. "Sxngt",
  970. "Spngt",
  971. "Ocngt",
  972. "Nongt",
  973. "CNT"
  974. }
  975. local i = i or 1
  976. if 1 <= num / 1000 and exts[i + 1] then
  977. num = num / 1000
  978. i = i + 1
  979. num, i = GData.generateExtension(num, i)
  980. end
  981. return num, i, exts[i]
  982. end
  983. function onr(r, c, v3)
  984. if r == c then
  985. return v3
  986. end
  987. end
  988. function GData.API.GetOffset(Size, r)
  989. local foo, fof, oof, none = Vector3.new(GData.Alignment.X, 0, 0), Vector3.new(GData.Alignment.X, 0, GData.Alignment.Z), Vector3.new(0, 0, GData.Alignment.Z), Vector3.new(0, 0, 0)
  990. local a = Vector3.new(math.floor(Size.X + 0.5), math.floor(Size.Y + 0.5), math.floor(Size.Z + 0.5)) / 4
  991. local ax = a.X % (GData.Alignment.X / 2)
  992. local az = a.Z % (GData.Alignment.Z / 2)
  993. local pick
  994. if ax == 0 and az == 0 then
  995. pick = onr(r, 0, none) or onr(r, 90, none) or onr(r, 180, none) or onr(r, 270, none)
  996. return pick
  997. elseif ax == 0 and az == 1 then
  998. pick = onr(r, 0, none) or onr(r, 90, foo) or onr(r, 180, oof) or onr(r, 270, none)
  999. return pick
  1000. elseif ax == 1 and az == 0 then
  1001. pick = onr(r, 0, oof) or onr(r, 90, foo) or onr(r, 180, fof) or onr(r, 270, fof)
  1002. return pick
  1003. else
  1004. pick = onr(r, 0, none) or onr(r, 90, foo) or onr(r, 180, fof) or onr(r, 270, oof)
  1005. return pick
  1006. end
  1007. end
  1008. function GData.GhostizeModel(x)
  1009. for _, c in pairs(x:GetChildren()) do
  1010. if (c:IsA("BasePart") or c:IsA("UnionOperation")) and not c:FindFirstChild("PuttyTransparency") and c.Name ~= "Upgrader" then
  1011. local v = Instance.new("NumberValue", c)
  1012. v.Name = "PuttyTransparency"
  1013. v.Value = c.Transparency
  1014. local v2 = Instance.new("BoolValue", c)
  1015. v2.Name = "PuttyCollidable"
  1016. v2.Value = c.CanCollide
  1017. c.CanCollide = false
  1018. if c.Name:find("Marker") == nil then
  1019. c.Transparency = math.min(c.Transparency + 0.5, 1)
  1020. end
  1021. end
  1022. if c.Name:find("Marker") == nil then
  1023. GData.GhostizeModel(c)
  1024. end
  1025. end
  1026. end
  1027. function GData.UnghostizeModel(x)
  1028. for _, c in pairs(x:GetChildren()) do
  1029. if (c:IsA("BasePart") or c:IsA("UnionOperation")) and c:FindFirstChild("PuttyTransparency") then
  1030. c.Transparency = c.PuttyTransparency.Value
  1031. c.CanCollide = c.PuttyCollidable.Value
  1032. c.PuttyTransparency:Destroy()
  1033. c.PuttyCollidable:Destroy()
  1034. end
  1035. end
  1036. end
  1037. local count = 1
  1038. local radialMenu = {
  1039. {
  1040. i = "rbxgameasset://Images/Pickup",
  1041. f = function()
  1042. GData.Actions.Upgrade(#GData.T_SelectionModels > 0 and GData.T_SelectionModels or GData.O_SelectionGUI)
  1043. end,
  1044. n = "upgrade"
  1045. },
  1046. {
  1047. i = "rbxgameasset://Images/Pickup2",
  1048. f = function()
  1049. GData.Actions.Pickup(#GData.T_SelectionModels > 0 and GData.T_SelectionModels or GData.O_SelectionGUI)
  1050. end,
  1051. n = "Pick Up"
  1052. },
  1053. {
  1054. i = "rbxgameasset://Images/Move",
  1055. f = function()
  1056. GData.Actions.Move(#GData.T_SelectionModels > 0 and GData.T_SelectionModels or GData.O_SelectionGUI)
  1057. end,
  1058. n = "Move"
  1059. },
  1060. {
  1061. i = "rbxgameasset://Images/Close",
  1062. f = function()
  1063. GData.Actions.Close()
  1064. end,
  1065. n = "Close"
  1066. }
  1067. }
  1068. GData.CFG = {
  1069. i = "rbxgameasset://Images/CFG",
  1070. f = function()
  1071. GData.Actions.CFG(GData.O_SelectionGUI)
  1072. end,
  1073. n = "CFG"
  1074. }
  1075. local passive = {
  1076. 0,
  1077. 0,
  1078. function(btn)
  1079. if not GData.O_SelectionGUI then
  1080. btn.Visible = false
  1081. return
  1082. end
  1083. if GData.Upgrades[GData.O_SelectionGUI.Name] then
  1084. local upgrade = GData.Upgrades[GData.O_SelectionGUI.Name]
  1085. if upgrade.c == "Cash" then
  1086. local num, _, ext = GData.generateExtension(upgrade.a)
  1087. if ext ~= "" then
  1088. btn.Text = "Upgrade: $" .. GData.limitDig(num, 2) .. " " .. ext
  1089. else
  1090. btn.Text = "Upgrade: $" .. GData.limitDig(num, 2)
  1091. end
  1092. end
  1093. else
  1094. end
  1095. end,
  1096. 0
  1097. }
  1098. getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("GameGUI").Menu.GetUpgrade.OnInvoke = function()
  1099. if #GData.T_SelectionModels > 0 then
  1100. local uamnt, ucount = 0, 0
  1101. for _, c in pairs(GData.T_SelectionModels) do
  1102. if GData.Upgrades[c.Name] then
  1103. local upgrade = GData.Upgrades[c.Name]
  1104. if upgrade.c == "Cash" then
  1105. uamnt = uamnt + upgrade.a
  1106. ucount = ucount + 1
  1107. end
  1108. end
  1109. end
  1110. if uamnt > 0 then
  1111. local num, _, ext = GData.generateExtension(uamnt)
  1112. local suffix = ucount > 1 and " models" or " model"
  1113. if ext ~= "" then
  1114. return "Upgrade " .. ucount .. suffix .. ": $" .. GData.limitDig(num, 2) .. " " .. ext
  1115. else
  1116. return "Upgrade " .. ucount .. suffix .. ": $" .. GData.limitDig(num, 2)
  1117. end
  1118. end
  1119. return -1
  1120. end
  1121. if not GData.O_SelectionGUI then
  1122. return -1
  1123. end
  1124. if GData.Upgrades[GData.O_SelectionGUI.Name] then
  1125. local upgrade = GData.Upgrades[GData.O_SelectionGUI.Name]
  1126. if upgrade.c == "Cash" then
  1127. local num, _, ext = GData.generateExtension(upgrade.a)
  1128. if ext ~= "" then
  1129. return "Upgrade: $" .. GData.limitDig(num, 2) .. " " .. ext
  1130. else
  1131. return "Upgrade: $" .. GData.limitDig(num, 2)
  1132. end
  1133. end
  1134. end
  1135. return -1
  1136. end
  1137. function GData.getTiles(parts)
  1138. local l = {}
  1139. for _, part in pairs(parts) do
  1140. if part.Parent:FindFirstChild("UnitOptions") and part.Parent:FindFirstChild("Stack") and part:FindFirstAncestor("Tiles") and not l[part.Parent] then
  1141. l[part.Parent] = true
  1142. end
  1143. end
  1144. return l
  1145. end
  1146. function GData.checkEmpty(ppart, checkpos)
  1147. if not GData.Placement_Model then
  1148. return false
  1149. end
  1150. GData.Placement_IsEmpty = false
  1151. local bl = CFrame.new(GData.CF_Placement and GData.CF_Placement.p or checkpos or ppart.Position) * CFrame.Angles(0, math.rad(GData.Rotation), 0) * CFrame.new(-ppart.Size.X / 2 + 0.1, -ppart.Size.Y / 2 + 0.1, -ppart.Size.Z / 2 + 0.1)
  1152. local tr
  1153. if GData.Placement_Model:FindFirstChild("OffsetSizeY") then
  1154. tr = CFrame.new(checkpos or ppart.Position) * CFrame.Angles(0, math.rad(GData.Rotation), 0) * CFrame.new(ppart.Size.X / 2 - 0.1, ppart.Size.Y / 2 - 0.1 + GData.Placement_Model:FindFirstChild("OffsetSizeY").Value, ppart.Size.Z / 2 - 0.1)
  1155. else
  1156. tr = CFrame.new(checkpos or ppart.Position) * CFrame.Angles(0, math.rad(GData.Rotation), 0) * CFrame.new(ppart.Size.X / 2 - 0.1, ppart.Size.Y / 2 - 0.1, ppart.Size.Z / 2 - 0.1)
  1157. end
  1158. bl, tr = bl.p, tr.p
  1159. local region = Region3.new(Vector3.new(math.min(bl.X, tr.X) + 0.1, math.min(bl.Y, tr.Y) + 0.1, math.min(bl.Z, tr.Z) + 0.1), Vector3.new(math.max(bl.X, tr.X) - 0.1, math.max(bl.Y, tr.Y) - 0.1, math.max(bl.Z, tr.Z) - 0.1))
  1160. local parts = workspace:FindPartsInRegion3WithIgnoreList(region, {
  1161. workspace.CurrentCamera,
  1162. GData.O_BaseModel.BasePlate,
  1163. GData.O_BaseModel.BasePlate2,
  1164. game.Players.LocalPlayer.Character
  1165. })
  1166. GData.Placement_IsEmpty = #parts == 0
  1167. local ray = Ray.new(ppart.CFrame.p, Vector3.new(0, -20, 0))
  1168. local testpart = workspace:FindPartOnRayWithIgnoreList(ray, {
  1169. workspace.CurrentCamera,
  1170. workspace.Players[getLocalPlayer().Name].Tiles,
  1171. getLocalCharacter()
  1172. })
  1173. local moffset = Vector3.new(0, 0, 0)
  1174. if testpart and testpart.Name == "Water" then
  1175. GData.Placement_IsEmpty = false
  1176. end
  1177. local check = ppart.Position - (GData.AnchorPoint or GData.O_Anchor.Position)
  1178. local XValid, ZValid = math.abs(check.X) <= 512, math.abs(check.Z) <= 512
  1179. if XValid and ZValid then
  1180. else
  1181. GData.Placement_IsEmpty = false
  1182. end
  1183. if getLocalPlayer().PlayerGui:WaitForChild("DataLimit").Value >= 1 then
  1184. GData.Placement_IsEmpty = false
  1185. GData.TooMuchData = true
  1186. else
  1187. GData.TooMuchData = false
  1188. end
  1189. if not GData.Placement_IsEmpty then
  1190. return GData.getTiles(parts)
  1191. end
  1192. end
  1193. function GData.Do_Passive_Actions(buttons)
  1194. for n, c in ipairs(passive) do
  1195. if buttons and c ~= 0 then
  1196. c(buttons[n])
  1197. end
  1198. end
  1199. end
  1200. function GData.Assign_As_Cursor(mod1, amnt, rot, isresource, isautomate)
  1201. if GData.DB_Assign then
  1202. return
  1203. end
  1204. GData.DB_Assign = true
  1205. if GData.Placement_Model then
  1206. GData.Placement_Model:Destroy()
  1207. end
  1208. GData.API.HideMenus()
  1209. game:GetService("GuiService").GuiNavigationEnabled = false
  1210. if type(mod1) == "string" then
  1211. GData.Placement_Model = nil
  1212. if isautomate then
  1213. GData.S_Automate = mod1
  1214. GData.S_Resource = nil
  1215. else
  1216. GData.S_Resource = mod1
  1217. GData.S_Automate = nil
  1218. end
  1219. GData.Placement_Count = amnt
  1220. local pgui = getLocalPlayer():WaitForChild("PlayerGui")
  1221. local menuo = pgui:WaitForChild("MenuOpen")
  1222. GData.O_Selection = nil
  1223. GData.O_SelectionGUI = nil
  1224. pgui:WaitForChild("GameGUI").RightClick.Visible = false
  1225. if getLocalPlayer().PlayerGui.GameGUI.HUD.Position.Y.Offset < 1 then
  1226. getLocalPlayer():WaitForChild("PlayerGui").GameGUI.HUD:TweenPosition(UDim2.new(1, -474, 0, 0), nil, nil, 0.2, true)
  1227. end
  1228. pgui:WaitForChild("GameGUI").Menu:TweenPosition(UDim2.new(0, 0, 0, 0), nil, nil, 0.25)
  1229. menuo.Value = false
  1230. game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("OtherMenu", false)
  1231. delay(0.5, function()
  1232. GData.DB_Assign = false
  1233. end)
  1234. return
  1235. end
  1236. if rot then
  1237. GData.Rotation = rot
  1238. end
  1239. GData.Placement_Count = amnt
  1240. local pgui = getLocalPlayer():WaitForChild("PlayerGui")
  1241. local menuo = pgui:WaitForChild("MenuOpen")
  1242. GData.O_Selection = nil
  1243. GData.O_SelectionGUI = nil
  1244. GData.S_Automate = nil
  1245. pgui:WaitForChild("GameGUI").RightClick.Visible = false
  1246. pgui:WaitForChild("GameGUI").Menu:TweenPosition(UDim2.new(0, 0, 0, 0), nil, nil, 0.25)
  1247. if getLocalPlayer().PlayerGui.GameGUI.HUD.Position.Y.Offset < 1 then
  1248. getLocalPlayer():WaitForChild("PlayerGui").GameGUI.HUD:TweenPosition(UDim2.new(1, -474, 0, 0), nil, nil, 0.2, true)
  1249. end
  1250. menuo.Value = false
  1251. game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("OtherMenu", false)
  1252. GData.Placement_Model = mod1
  1253. delay(0.5, function()
  1254. GData.DB_Assign = false
  1255. end)
  1256. end
  1257. local functions = {
  1258. function(_x, _y, menuo)
  1259. if menuo.Value then
  1260. return
  1261. end
  1262. print("move")
  1263. GData.Actions.Move(#GData.T_SelectionModels > 0 and GData.T_SelectionModels or GData.O_SelectionGUI)
  1264. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.ForceClose:Invoke()
  1265. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
  1266. end,
  1267. function(_x, _y, menuo)
  1268. if menuo.Value then
  1269. return
  1270. end
  1271. print("pickup")
  1272. GData.Actions.Pickup(#GData.T_SelectionModels > 0 and GData.T_SelectionModels or GData.O_SelectionGUI)
  1273. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.ForceClose:Invoke()
  1274. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
  1275. end,
  1276. function(btn, buttons, menuo)
  1277. if menuo.Value then
  1278. return
  1279. end
  1280. print("upgrade")
  1281. GData.Actions.Upgrade(#GData.T_SelectionModels > 0 and GData.T_SelectionModels or GData.O_SelectionGUI)
  1282. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.ForceClose:Invoke()
  1283. end,
  1284. function(_x, _y, menuo)
  1285. if menuo.Value then
  1286. return
  1287. end
  1288. print("cloze")
  1289. GData.Actions.Close()
  1290. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.ForceClose:Invoke()
  1291. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
  1292. end
  1293. }
  1294. function GData.Check_Is_Pack(name)
  1295. if name and name:find(" Pack") then
  1296. print("Favorited pack")
  1297. local l = name:find(" Pack")
  1298. if not l then
  1299. return true
  1300. end
  1301. if game.Players.LocalPlayer.PlayerGui.PackOpenGUI.PackControls.Visible or #game.Players.LocalPlayer.PlayerGui.PackOpenGUI.CardsBin:GetChildren() > 0 then
  1302. return true
  1303. end
  1304. game.Players.LocalPlayer.PlayerGui.GameGUI.Menu:TweenPosition(UDim2.new(0, 0, 0, 0), nil, nil, 0.25)
  1305. game.ReplicatedStorage.Calls.Cross.OpenPack:FireServer(name:sub(1, l - 1), name)
  1306. return true
  1307. end
  1308. end
  1309. do
  1310. local favorites = {
  1311. -1,
  1312. -1,
  1313. -1,
  1314. -1,
  1315. -1,
  1316. -1,
  1317. -1,
  1318. -1,
  1319. -1,
  1320. -1
  1321. }
  1322. local inputs = {
  1323. "One",
  1324. "Two",
  1325. "Three",
  1326. "Four",
  1327. "Five",
  1328. "Six",
  1329. "Seven",
  1330. "Eight",
  1331. "Nine",
  1332. "Zero"
  1333. }
  1334. local finv = {}
  1335. game.ReplicatedStorage.Calls.Parallel.Favorites.Update.Event:connect(function(json)
  1336. finv = game.HttpService:JSONDecode(json)
  1337. end)
  1338. function game.ReplicatedStorage.Calls.Cross.Favorites.Load.OnClientInvoke(t)
  1339. if type(t) == "string" then
  1340. favorites = game.HttpService:JSONDecode(t)
  1341. for i = 0, 10 do
  1342. favorites[i] = favorites[i] or -1
  1343. end
  1344. end
  1345. end
  1346. function game.ReplicatedStorage.Calls.Cross.Favorites.AssignCursor.OnClientInvoke(name, num, isresource)
  1347. if GData.Check_Is_Pack(name) then
  1348. return
  1349. end
  1350. if isresource and name then
  1351. game.ReplicatedStorage.Calls.Parallel.AssignCursor:Fire(name, num)
  1352. return
  1353. end
  1354. if name then
  1355. local structure = game.ReplicatedStorage.Calls.Cross.SpawnStructure:InvokeServer(name)
  1356. if not structure then
  1357. getLocalPlayer():WaitForChild("PlayerGui").Sounds.WoodThumpBad:Play()
  1358. return -1
  1359. end
  1360. game.ReplicatedStorage.Calls.Parallel.AssignCursor:Fire(structure, num)
  1361. else
  1362. game.ReplicatedStorage.Calls.Parallel.AssignCursor:Fire()
  1363. end
  1364. end
  1365. local s = game.ReplicatedStorage.Calls.Cross.Favorites.Load:InvokeServer()
  1366. local fav = game.ReplicatedStorage.Calls.Parallel.Favorites
  1367. local checkInput = function(var)
  1368. return type(var) == "string"
  1369. end
  1370. function fav.Add.OnInvoke(name, target)
  1371. if type(name) ~= "number" then
  1372. warn("Invalid name!")
  1373. return
  1374. end
  1375. if name < 1 or name > 10 then
  1376. warn("Invalid name range!")
  1377. return
  1378. end
  1379. if math.floor(name) ~= name then
  1380. warn("Invalid name input!")
  1381. return
  1382. end
  1383. if not checkInput(target) then
  1384. warn("Invalid target!")
  1385. return
  1386. end
  1387. if target == favorites[name] then
  1388. favorites[name] = -1
  1389. game.ReplicatedStorage.Calls.Cross.Favorites.Save:FireServer(game.HttpService:JSONEncode(favorites))
  1390. return favorites
  1391. end
  1392. favorites[name] = target
  1393. game.ReplicatedStorage.Calls.Cross.Favorites.Save:FireServer(game.HttpService:JSONEncode(favorites))
  1394. return favorites
  1395. end
  1396. game:GetService("UserInputService").InputBegan:connect(function(K)
  1397. if GData.O_ConfigureGUI and GData.O_ConfigureGUI.Parent then
  1398. return
  1399. end
  1400. local s = pcall(function()
  1401. if game:GetService("UserInputService"):GetFocusedTextBox() and game:GetService("UserInputService"):GetFocusedTextBox():IsFocused() then
  1402. error("TestError", 2)
  1403. end
  1404. end)
  1405. if not s then
  1406. return
  1407. end
  1408. if GData.DB_Server then
  1409. return
  1410. end
  1411. local pgui = getLocalPlayer():WaitForChild("PlayerGui")
  1412. local menuo = pgui:WaitForChild("MenuOpen")
  1413. local Key = K.KeyCode.Name
  1414. local UType = K.UserInputType.Name
  1415. if UType:find("Gamepad") and menuo.Value == false then
  1416. if Key == "DPadRight" then
  1417. UType = "Keyboard"
  1418. Key = "Three"
  1419. elseif Key == "DPadLeft" then
  1420. UType = "Keyboard"
  1421. Key = "One"
  1422. elseif Key == "DPadUp" then
  1423. UType = "Keyboard"
  1424. Key = "Two"
  1425. elseif Key == "DPadDown" then
  1426. UType = "Keyboard"
  1427. Key = "Four"
  1428. end
  1429. end
  1430. if UType == "Keyboard" then
  1431. local n = -1
  1432. for i = 1, #inputs do
  1433. if inputs[i] == Key then
  1434. n = i
  1435. end
  1436. end
  1437. local menuo = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("MenuOpen")
  1438. if not menuo then
  1439. return
  1440. end
  1441. if n ~= -1 and menuo.Value == false and favorites[n] ~= -1 then
  1442. if GData.Check_Is_Pack(favorites[n]) then
  1443. return
  1444. end
  1445. game.ReplicatedStorage.Calls.Cross.Favorites.AssignCursor:InvokeServer(favorites[n], n)
  1446. end
  1447. end
  1448. end)
  1449. end
  1450. do
  1451. local buttons = {}
  1452. local tmp = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("GameGUI").RightClick:GetChildren()
  1453. for _, c in ipairs(tmp) do
  1454. if c:IsA("TextButton") then
  1455. buttons[#buttons + 1] = c
  1456. end
  1457. end
  1458. table.sort(buttons, function(n1, n2)
  1459. return n1.Name < n2.Name
  1460. end)
  1461. for n, c in ipairs(buttons) do
  1462. c.MouseButton1Click:connect(function()
  1463. if GData.DB_Server then
  1464. return
  1465. end
  1466. local menuo = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("MenuOpen")
  1467. if not menuo then
  1468. return
  1469. end
  1470. print("click!")
  1471. GData.DB_Server = true
  1472. functions[n](buttons[n], buttons, menuo)
  1473. GData.DB_Server = false
  1474. end)
  1475. end
  1476. end
  1477. function GData.onMouse1_Down(buttons)
  1478. GData.Placement_Successful = false
  1479. buttons = buttons or GData.T_LastButtons
  1480. GData.T_LastButtons = buttons
  1481. local pl = game.Players.LocalPlayer
  1482. local pgui = pl:WaitForChild("PlayerGui")
  1483. if GData.DB_Click then
  1484. return
  1485. end
  1486. GData.DB_Click = true
  1487. local status = game.ReplicatedStorage.Calls.Parallel.GetStatus:Invoke("ShowingTutorial")
  1488. if status then
  1489. GData.DB_Click = false
  1490. return
  1491. end
  1492. if GData.Placement_Model then
  1493. coroutine.wrap(function()
  1494. if not GData.Placement_Model then
  1495. return
  1496. end
  1497. if not GData.Placement_Model.PrimaryPart then
  1498. return
  1499. end
  1500. GData.checkEmpty(GData.Placement_Model.PrimaryPart)
  1501. local sbox = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("SelectionBox")
  1502. if GData.Placement_IsEmpty or GData.O_Podium and GData.O_Podium.CustomTile.Value == GData.Placement_Model.Name then
  1503. local extradata = {}
  1504. if GData.O_Podium then
  1505. extradata.tile = GData.O_Podium
  1506. end
  1507. if GData.Placement_Model.PrimaryPart then
  1508. local p = Instance.new("Part", workspace)
  1509. p.Name = "LocalHitboxPlaceholder"
  1510. p.Anchored = true
  1511. p.CanCollide = false
  1512. p.Transparency = 1
  1513. p.Size = GData.Placement_Model.PrimaryPart.Size
  1514. p.CFrame = GData.Placement_Model.PrimaryPart.CFrame
  1515. game:GetService("Debris"):AddItem(p, 1)
  1516. end
  1517. local modnew = _crFunction("PlaceAndWait"):InvokeServer(GData.Placement_Model.Name, GData.CF_Placement or GData.Placement_Model.PrimaryPart.CFrame, GData.Rotation, GData.API.RetrieveModelConfig(GData.Placement_Model), extradata)
  1518. GData.Undo_ActionList[#GData.Undo_ActionList + 1] = modnew
  1519. GData.O_Podium = nil
  1520. if GData.Placement_Model then
  1521. GData.checkEmpty(GData.Placement_Model.PrimaryPart)
  1522. end
  1523. getLocalPlayer():WaitForChild("PlayerGui").Sounds.WoodThumpPlace:Play()
  1524. if workspace.Players[GData.O_LocalPlayer.Name].PlayerData.Difficulty.Value ~= "Sandbox" then
  1525. GData.Placement_Count = GData.Placement_Count + 1
  1526. end
  1527. GData.Placement_Successful = true
  1528. else
  1529. getLocalPlayer():WaitForChild("PlayerGui").Sounds.WoodThumpBad:Play()
  1530. if GData.TooMuchData then
  1531. game.ReplicatedStorage.Calls.Parallel.SystemMessage:Fire("{red,b,out:Too much data is being used! Delete some buildings then wait about a minute for the data limit to refresh.}")
  1532. end
  1533. end
  1534. require(GData.API.GetMenu():WaitForChild("Interface Rendering", 1000000000):WaitForChild("ClientMods").CrossCode)().UpdateFavorites()
  1535. end)()
  1536. GData.DB_Click = false
  1537. return
  1538. end
  1539. if GData.S_Resource and GData.O_ButtonClick and GData.O_ButtonClick.Name ~= "DropperDrop" and GData.O_ButtonClick.Name ~= "UnitOptions" and GData.O_ButtonClick.Parent:FindFirstChild("UnitOptions") then
  1540. local ev = GData.O_ButtonClick.Parent.UnitOptions:FindFirstChild("Deposit")
  1541. if ev then
  1542. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").InputAmount.IDBox.Text = "How many to deposit?"
  1543. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").InputAmount.Ready.Value = false
  1544. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").InputAmount.Visible = true
  1545. while getLocalPlayer().PlayerGui:WaitForChild("GameGUI").InputAmount.Ready.Value ~= true do
  1546. wait()
  1547. end
  1548. local num = tonumber(getLocalPlayer().PlayerGui:WaitForChild("GameGUI").InputAmount.IDBox.Text)
  1549. if num then
  1550. ev:FireServer(GData.S_Resource, num)
  1551. GData.S_Resource = nil
  1552. removeCorner()
  1553. else
  1554. GData.S_Resource = nil
  1555. removeCorner()
  1556. end
  1557. end
  1558. elseif GData.O_ButtonClick and GData.O_ButtonClick.Name == "DropperDrop" and GData.KeyboardShift_Down then
  1559. game.ReplicatedStorage.Calls.Cross.RemoveDrop:FireServer(GData.O_ButtonClick)
  1560. GData.O_ButtonClick = nil
  1561. elseif GData.O_ButtonClick and GData.O_ButtonClick.Name == "UnitOptions" and not GData.S_Resource then
  1562. local ev = GData.O_ButtonClick:FindFirstChild("Quick")
  1563. if GData.KeyboardShift_Down and ev and ev:FindFirstChild("Activate") and ev:FindFirstChild("ActiveFire") then
  1564. ev.ActiveFire:FireServer("activate")
  1565. GData.DontMBU = true
  1566. end
  1567. elseif GData.O_ButtonClick and not GData.S_Resource and GData.O_ButtonClick.Name ~= "UnitOptions" and GData.O_ButtonClick.Name ~= "DropperDrop" and GData.O_ButtonClick.Parent:FindFirstChild("UnitOptions") then
  1568. if GData.O_ButtonClick.Parent == nil then
  1569. warn("Cant remote an invalid model.")
  1570. end
  1571. local ev = GData.O_ButtonClick.Parent.UnitOptions:FindFirstChild("Remote") or Instance.new("RemoteEvent", GData.O_ButtonClick.Parent.UnitOptions)
  1572. ev.Name = "Remote"
  1573. ev:FireServer()
  1574. GData.DontMBU = true
  1575. end
  1576. GData.DB_Click = false
  1577. end
  1578. function GData.On_Select()
  1579. local buttons = GData.T_LastButtons
  1580. GData.T_LastButtons = buttons
  1581. local pl = game.Players.LocalPlayer
  1582. local pgui = pl:WaitForChild("PlayerGui")
  1583. GData.O_SelectionGUI = GData.O_Selection
  1584. GData.O_Selection = nil
  1585. local opt = GData.O_SelectionGUI:FindFirstChild("UnitOptions")
  1586. if opt and not opt:FindFirstChild("ManualActivating") and not opt.Parent:FindFirstChild("DoNotScan") and not opt.Parent:FindFirstChild("Unselectable") and GData.API.CheckIsOwner(opt) and GData.KeyboardShift_Down then
  1587. if not GData.O_SelectionGUI then
  1588. GData.DB_Click = false
  1589. return
  1590. end
  1591. game.ReplicatedStorage.Calls.Cross.PickupStructure:InvokeServer(GData.O_SelectionGUI, true)
  1592. if not GData.O_SelectionGUI then
  1593. GData.DB_Click = false
  1594. return
  1595. end
  1596. GData.O_SelectionGUI:Destroy()
  1597. GData.O_SelectionGUI = nil
  1598. if getLocalPlayer().PlayerGui.GameGUI.HUD.Position.Y.Offset < 1 then
  1599. getLocalPlayer():WaitForChild("PlayerGui").GameGUI.HUD:TweenPosition(UDim2.new(1, -474, 0, 0), nil, nil, 0.2, true)
  1600. end
  1601. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
  1602. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.ForceClose:Invoke()
  1603. getLocalPlayer().PlayerGui:WaitForChild("Sounds").Click:Play()
  1604. GData.O_SelectionGUI = nil
  1605. GData.DB_Server = false
  1606. GData.DB_Click = false
  1607. return
  1608. end
  1609. local clamp = function(n, bottom, top)
  1610. return math.min(top, math.max(bottom, n))
  1611. end
  1612. local gui = pgui:WaitForChild("GameGUI").AbsoluteSize
  1613. local windowx, windowy = gui.X, gui.Y
  1614. local posx, posy = clamp(GData.O_Mouse.X + 40, 0, windowx - 330), clamp(GData.O_Mouse.Y, 120, windowy - 300 + 120)
  1615. local pmaxx, pminy = windowx - 175 - 474, 320
  1616. if posx > pmaxx and posy < pminy then
  1617. getLocalPlayer():WaitForChild("PlayerGui").GameGUI.HUD:TweenPosition(UDim2.new(1, -474, 0, -260), nil, nil, 0.2, true)
  1618. else
  1619. getLocalPlayer():WaitForChild("PlayerGui").GameGUI.HUD:TweenPosition(UDim2.new(1, -474, 0, 0), nil, nil, 0.2, true)
  1620. end
  1621. pgui:WaitForChild("GameGUI").RightClick.Position = UDim2.new(0, posx, 0, posy)
  1622. getLocalPlayer():WaitForChild("PlayerGui").Sounds.Click:Play()
  1623. if not pgui:WaitForChild("GameGUI").RightClick.Visible then
  1624. buttons = pgui:WaitForChild("GameGUI").RightClick:GetChildren()
  1625. table.sort(buttons, function(n1, n2)
  1626. return n1.Name < n2.Name
  1627. end)
  1628. GData.Do_Passive_Actions(buttons)
  1629. end
  1630. pgui:WaitForChild("GameGUI").RightClick.Visible = true
  1631. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.ForceClose:Invoke()
  1632. game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("OtherMenu", true)
  1633. local _tab = pgui:WaitForChild("GameGUI").Menu.ShowMenu:Invoke(clamp(GData.O_Mouse.X + 40, 0, windowx - 660), clamp(GData.O_Mouse.Y, 120, windowy - 300), radialMenu, GData.CFG, GData.O_SelectionGUI)
  1634. if _tab then
  1635. GData.LastMenuCount = #_tab
  1636. end
  1637. end
  1638. function GData.onMouse1_Up(buttons)
  1639. buttons = buttons or GData.T_LastButtons
  1640. GData.T_LastButtons = buttons
  1641. local pl = game.Players.LocalPlayer
  1642. local pgui = pl:WaitForChild("PlayerGui")
  1643. if GData.DB_Click then
  1644. return
  1645. end
  1646. GData.DB_Click = true
  1647. local status = game.ReplicatedStorage.Calls.Parallel.GetStatus:Invoke("ShowingTutorial")
  1648. if status then
  1649. GData.DB_Click = false
  1650. return
  1651. end
  1652. if GData.Placement_Model and (not GData.O_Difficulty or GData.O_Difficulty.Value ~= "Sandbox") and GData.Placement_Count <= 0.01 and GData.Placement_Successful then
  1653. GData.Placement_Model:Destroy()
  1654. GData.Placement_Model = nil
  1655. removeCorner()
  1656. elseif GData.O_ButtonClick and GData.S_Automate then
  1657. if GData.O_ButtonClick.Parent:FindFirstChild("ConnectionMod") and GData.O_ButtonClick.Parent.ConnectionMod:FindFirstChild("ListPulse") then
  1658. GData.O_ButtonClick.Parent.ConnectionMod.ListPulse:FireServer(GData.S_Automate, GData.Placement_Count)
  1659. end
  1660. GData.S_Automate = nil
  1661. GData.O_ButtonClick = nil
  1662. elseif GData.O_Selection and GData.O_ButtonClick == nil and GData.S_Automate == nil then
  1663. GData.On_Select()
  1664. end
  1665. local fn = require(GData.API.GetMenu():WaitForChild("Interface Rendering", 1000000000):WaitForChild("ClientMods").CrossCode)()
  1666. if fn.UpdateFavorites then
  1667. fn.UpdateFavorites()
  1668. end
  1669. GData.DontMBU = false
  1670. GData.DB_Click = false
  1671. GData.DB_Server = false
  1672. end
  1673. game:GetService("UserInputService").InputBegan:connect(function(K)
  1674. if GData.O_ConfigureGUI and GData.O_ConfigureGUI.Parent then
  1675. return
  1676. end
  1677. local s = pcall(function()
  1678. if game:GetService("UserInputService"):GetFocusedTextBox() and game:GetService("UserInputService"):GetFocusedTextBox():IsFocused() then
  1679. error("TestError", 2)
  1680. end
  1681. end)
  1682. if not s then
  1683. return
  1684. end
  1685. if GData.DB_Server then
  1686. return
  1687. end
  1688. local key = K.KeyCode.Name
  1689. local UType = K.UserInputType.Name
  1690. local pl = game.Players.LocalPlayer
  1691. local pgui = pl:WaitForChild("PlayerGui")
  1692. local buttons
  1693. if pgui:WaitForChild("GameGUI").RightClick.Visible then
  1694. buttons = {}
  1695. local tmp = pgui:WaitForChild("GameGUI").RightClick:GetChildren()
  1696. for _, c in ipairs(tmp) do
  1697. if c:IsA("TextButton") then
  1698. buttons[#buttons + 1] = c
  1699. end
  1700. end
  1701. table.sort(buttons, function(n1, n2)
  1702. return n1.Name < n2.Name
  1703. end)
  1704. end
  1705. if UType == "Keyboard" or UType:find("Mouse") then
  1706. GData.InputType = "Keyboard"
  1707. end
  1708. if UType:find("Gamepad") then
  1709. GData.InputType = "Gamepad"
  1710. if key == "ButtonR2" then
  1711. key = "MouseButton1"
  1712. UType = "MouseButton1"
  1713. end
  1714. if key == "ButtonL2" then
  1715. if not pgui:WaitForChild("GameGUI").RightClick.Visible then
  1716. GData.Gamepad.Locked = true
  1717. end
  1718. key = "LeftShift"
  1719. UType = "Keyboard"
  1720. local pgui = getLocalPlayer():WaitForChild("PlayerGui")
  1721. local menuo = pgui:WaitForChild("MenuOpen")
  1722. if menuo.Value then
  1723. key = "E"
  1724. end
  1725. end
  1726. if pgui:WaitForChild("GameGUI").RightClick.Visible then
  1727. if key == "ButtonA" then
  1728. key = "Z"
  1729. UType = "Keyboard"
  1730. elseif key == "ButtonB" then
  1731. key = "X"
  1732. UType = "Keyboard"
  1733. elseif key == "ButtonX" then
  1734. key = "C"
  1735. UType = "Keyboard"
  1736. elseif key == "ButtonY" then
  1737. key = "V"
  1738. UType = "Keyboard"
  1739. elseif key == "ButtonSelect" then
  1740. key = "CFG"
  1741. UType = "Keyboard"
  1742. end
  1743. else
  1744. local pgui = getLocalPlayer():WaitForChild("PlayerGui")
  1745. local menuo = pgui:WaitForChild("MenuOpen")
  1746. if key == "ButtonY" and menuo.Value == false then
  1747. key = "E"
  1748. UType = "Keyboard"
  1749. elseif key == "ButtonL1" then
  1750. key = "E"
  1751. UType = "Keyboard"
  1752. elseif key == "ButtonR1" then
  1753. key = "F"
  1754. UType = "Keyboard"
  1755. elseif key == "ButtonX" then
  1756. key = "R"
  1757. UType = "Keyboard"
  1758. elseif key == "ButtonB" then
  1759. key = "Q"
  1760. UType = "Keyboard"
  1761. end
  1762. end
  1763. end
  1764. if UType == "Keyboard" then
  1765. if pgui:WaitForChild("GameGUI").RightClick.Visible then
  1766. local menuo = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("MenuOpen")
  1767. if not menuo then
  1768. return
  1769. end
  1770. for n, c in ipairs(buttons) do
  1771. if key == buttons[n].Shortcut.Text then
  1772. if GData.DB_Server then
  1773. return
  1774. end
  1775. functions[n](buttons[n], buttons, menuo)
  1776. GData.DB_Server = false
  1777. end
  1778. end
  1779. if key == "CFG" and GData.LastMenuCount > 4 then
  1780. if GData.DB_Server then
  1781. return
  1782. end
  1783. print("do!")
  1784. GData.DB_Server = true
  1785. GData.CFG.f()
  1786. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.ForceClose:Invoke()
  1787. game:GetService("GuiService").GuiNavigationEnabled = true
  1788. GData.DB_Server = false
  1789. end
  1790. end
  1791. if key:find("Shift") then
  1792. local char = getLocalCharacter()
  1793. local hum = char:WaitForChild("Humanoid")
  1794. hum.WalkSpeed = 32
  1795. GData.KeyboardShift_Down = true
  1796. end
  1797. if key == "R" and GData.Placement_Model and GData.AnchorPoint == nil then
  1798. if GData.KeyboardShift_Down then
  1799. GData.Rotation = (GData.Rotation + 90) % 360
  1800. else
  1801. GData.Rotation = (GData.Rotation - 90) % 360
  1802. end
  1803. end
  1804. if GData.Keys[key] and not GData.Placement_Model and not game.ReplicatedStorage.Calls.Parallel.GetStatus:Invoke("ShowingTutorial") then
  1805. GData.API.GetMenu().Position = UDim2.new(0, 0, 0, 0)
  1806. local menuo = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("MenuOpen")
  1807. if not menuo then
  1808. return
  1809. end
  1810. if GData.S_Resource or GData.S_Automate then
  1811. return
  1812. end
  1813. if 1 > #getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("GameGUI").Window:GetChildren() then
  1814. GData.API.ToggleMenu(key)
  1815. end
  1816. end
  1817. if key == "F" and GData.Placement_Model then
  1818. local undmod = GData.Undo_ActionList[#GData.Undo_ActionList]
  1819. local modn = ""
  1820. if undmod and undmod.Parent then
  1821. modn = undmod.Name
  1822. game.ReplicatedStorage.Calls.Cross.PickupStructure:InvokeServer(undmod, true)
  1823. end
  1824. if GData.Placement_Model and modn == GData.Placement_Model.Name then
  1825. local n = _crFunction("ItemCount"):InvokeServer(GData.Placement_Model.Name)
  1826. if n then
  1827. GData.Placement_Count = n
  1828. end
  1829. end
  1830. table.remove(GData.Undo_ActionList, #GData.Undo_ActionList)
  1831. end
  1832. if key == "Q" and (GData.Placement_Model or GData.S_Resource or GData.S_Automate or 0 < #GData.T_SelectionMovingModels) then
  1833. if GData.Placement_Model then
  1834. GData.Placement_Model:Destroy()
  1835. end
  1836. GData.Placement_Model = nil
  1837. for index, model in ipairs(GData.T_SelectionMovingModels) do
  1838. model:Destroy()
  1839. GData.T_SelectionMovingModels[index] = nil
  1840. end
  1841. GData.S_Resource = nil
  1842. GData.S_Automate = nil
  1843. do
  1844. local assignview = getLocalPlayer().PlayerGui:WaitForChild("GameGUI"):FindFirstChild("AssignView")
  1845. if assignview then
  1846. assignview:TweenPosition(UDim2.new(1, 10, 1, 10), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.5)
  1847. delay(0.5, function()
  1848. assignview:Destroy()
  1849. end)
  1850. end
  1851. require(GData.API.GetMenu():WaitForChild("Interface Rendering", 1000000000):WaitForChild("ClientMods").CrossCode)().UpdateFavorites()
  1852. end
  1853. end
  1854. end
  1855. if UType:find("MouseButton2") then
  1856. if getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible then
  1857. GData.O_SelectionGUI = nil
  1858. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
  1859. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.ForceClose:Invoke()
  1860. if 1 > getLocalPlayer().PlayerGui.GameGUI.HUD.Position.Y.Offset then
  1861. getLocalPlayer():WaitForChild("PlayerGui").GameGUI.HUD:TweenPosition(UDim2.new(1, -474, 0, 0), nil, nil, 0.2, true)
  1862. end
  1863. else
  1864. GData.Gamepad.Locked = true
  1865. end
  1866. end
  1867. if UType:find("MouseButton1") and GData.Menu_Open == false then
  1868. GData.onMouse1_Down()
  1869. GData.MouseButton1_Down = true
  1870. end
  1871. end)
  1872. game:GetService("UserInputService").InputEnded:connect(function(K)
  1873. local s = pcall(function()
  1874. if game:GetService("UserInputService"):GetFocusedTextBox() and game:GetService("UserInputService"):GetFocusedTextBox():IsFocused() then
  1875. error("TestError", 2)
  1876. end
  1877. end)
  1878. if not s then
  1879. return
  1880. end
  1881. local key = K.KeyCode.Name
  1882. local UType = K.UserInputType.Name
  1883. if UType:find("Gamepad") then
  1884. GData.InputType = "Gamepad"
  1885. if key == "ButtonL2" then
  1886. GData.Gamepad.Locked = false
  1887. key = "LeftShift"
  1888. UType = "Keyboard"
  1889. end
  1890. end
  1891. if UType == "Keyboard" and key:find("Shift") then
  1892. local char = getLocalCharacter()
  1893. local hum = char:WaitForChild("Humanoid")
  1894. hum.WalkSpeed = 16
  1895. GData.KeyboardShift_Down = false
  1896. end
  1897. if UType:find("MouseButton2") then
  1898. GData.Gamepad.Locked = false
  1899. end
  1900. if UType:find("Gamepad") then
  1901. GData.InputType = "Gamepad"
  1902. if key == "ButtonR2" then
  1903. key = "MouseButton1"
  1904. UType = "MouseButton1"
  1905. end
  1906. end
  1907. if UType:find("MouseButton1") then
  1908. if GData.Skip_MBUFunction == false then
  1909. GData.onMouse1_Up()
  1910. end
  1911. GData.Skip_MBUFunction = false
  1912. GData.MouseButton1_Down = false
  1913. end
  1914. end)
  1915. game.ReplicatedStorage.Calls.Parallel.AssignCursor.Event:connect(GData.Assign_As_Cursor)
  1916. coroutine.wrap(function()
  1917. while wait() and playing() do
  1918. local pgui = getLocalPlayer():WaitForChild("PlayerGui")
  1919. if GData.O_SelectionGUI then
  1920. pgui.ItemName.Value = GData.O_SelectionGUI.Name
  1921. if GData.Upgrades[GData.O_SelectionGUI.Name] then
  1922. pgui.UpgradedName.Value = GData.Upgrades[GData.O_SelectionGUI.Name].n
  1923. else
  1924. pgui.UpgradedName.Value = ""
  1925. end
  1926. else
  1927. pgui.ItemName.Value = ""
  1928. pgui.UpgradedName.Value = ""
  1929. end
  1930. if pgui:FindFirstChild("IntroGUI") and pgui.IntroGUI.FadeGUI.BackgroundTransparency > 0.99 then
  1931. pgui.IntroGUI:Destroy()
  1932. end
  1933. end
  1934. end)()
  1935. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.CloseMenu.OnInvoke = function()
  1936. GData.O_SelectionGUI = nil
  1937. end
  1938. function GData.Update_MenuOpen_Status()
  1939. if GData.API.MenuIsOpenBool().Value then
  1940. local shopopen = GData.API.GetMenu().Menu2.Visible
  1941. local invopen = GData.API.GetMenu().Menu1.Visible
  1942. game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("Shop", shopopen)
  1943. game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("Inventory", invopen)
  1944. else
  1945. game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("Shop", false)
  1946. game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("Inventory", false)
  1947. end
  1948. end
  1949. function GData.UndoSSelectionHitbox(sbox)
  1950. GData.O_ButtonClick = nil
  1951. GData.O_Selection = nil
  1952. sbox.Transparency = 0
  1953. sbox.Adornee = nil
  1954. local mousetip = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("MouseTooltip")
  1955. mousetip.Visible = false
  1956. end
  1957. GData.Multi_Invocation_Cache = {}
  1958. function GData.Update_MHighlightTip(Title, Tier, TierTextColor, ShowQuick, Emblem, InfoBoxText, UniformFontInfoBox)
  1959. local mousetip = getLocalPlayer():WaitForChild("PlayerGui", 1000000000):WaitForChild("GameGUI", 1000000000):WaitForChild("MouseTooltip", 1000000000)
  1960. if mousetip then
  1961. if not Title then
  1962. mousetip.Visible = false
  1963. return
  1964. end
  1965. mousetip.Visible = true
  1966. mousetip.Title.Text = Title
  1967. mousetip.Tier.Visible = Tier ~= nil
  1968. mousetip.Tier.Text = Tier or ""
  1969. mousetip.Tier.Thumbnail.Visible = Emblem ~= nil
  1970. mousetip.Tier.Thumbnail.Image = Emblem or ""
  1971. mousetip.Tier.TextColor3 = TierTextColor or Color3.new(1, 1, 1)
  1972. mousetip.Quick.Visible = ShowQuick ~= nil and ShowQuick ~= false
  1973. mousetip.Quick.Text = ShowQuick or ""
  1974. mousetip.Position = UDim2.new(0, GData.O_Mouse.X, 0, GData.O_Mouse.Y)
  1975. mousetip.Extra.Visible = InfoBoxText ~= nil
  1976. mousetip.Help.Visible = not mousetip.Extra.Visible
  1977. mousetip.Extra.Text = InfoBoxText or ""
  1978. mousetip.Extra.Size = UDim2.new(0, mousetip.Extra.TextBounds.X, 0, mousetip.Extra.TextBounds.Y)
  1979. if UniformFontInfoBox then
  1980. mousetip.Extra.Font = Enum.Font.Code
  1981. mousetip.Extra.TextSize = 16
  1982. else
  1983. mousetip.Extra.Font = Enum.Font.Bodoni
  1984. mousetip.Extra.TextSize = 18
  1985. end
  1986. end
  1987. end
  1988. local Click_Blacklist = {
  1989. MusicBox = true,
  1990. Water = true,
  1991. Screen = true
  1992. }
  1993. function GData.Activate_MHighlightTip()
  1994. local sbox = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("SelectionBox")
  1995. local mouseRay = Ray.new(GData.O_Mouse.UnitRay.Origin, GData.O_Mouse.UnitRay.Direction * 500)
  1996. local targ, intersection = workspace:FindPartOnRayWithIgnoreList(mouseRay, {
  1997. workspace.CurrentCamera,
  1998. getLocalCharacter()
  1999. })
  2000. local status = game.ReplicatedStorage.Calls.Parallel.GetStatus:Invoke("ShowingTutorial")
  2001. local diff = intersection - (GData.AnchorPoint or GData.O_Anchor.Position)
  2002. local XValid, ZValid = math.abs(diff.X) <= 512, 512 >= math.abs(diff.Z)
  2003. if not status then
  2004. if targ and targ.Parent then
  2005. if Click_Blacklist[targ.Name] then
  2006. GData.UndoSSelectionHitbox(sbox)
  2007. GData.Update_MHighlightTip()
  2008. return
  2009. end
  2010. if targ:IsDescendantOf(workspace.Players[getLocalPlayer().Name].Tiles) then
  2011. local UnitOptions = targ.Parent:FindFirstChild("UnitOptions") or targ.Parent.Parent:FindFirstChild("UnitOptions") or targ.Parent.Parent.Parent:FindFirstChild("UnitOptions")
  2012. if UnitOptions and GData.API.CheckIsOwner(UnitOptions) then
  2013. if GData.S_Automate then
  2014. if targ.Parent:FindFirstChild("btnAutomate") then
  2015. end
  2016. elseif GData.S_Resource == nil and UnitOptions:FindFirstChild("Quick") and UnitOptions.Quick:FindFirstChild("Activate") then
  2017. local Action, Action2 = UnitOptions.Quick:FindFirstChild("Activate"), UnitOptions.Quick:FindFirstChild("ActiveFire")
  2018. local qa = GData.Multi_Invocation_Cache[Action] or Action:InvokeServer("get-qa")
  2019. GData.Multi_Invocation_Cache[Action] = qa
  2020. GData.O_ButtonClick = UnitOptions
  2021. sbox.Color3 = UnitOptions.Parent.PrimaryPart.BrickColor.Color
  2022. sbox.Transparency = 0.5
  2023. sbox.Adornee = UnitOptions.Parent
  2024. GData.Update_MHighlightTip("Quick Action", "Hold shift and click to activate!", nil, GData.KeyboardShift_Down and "Quick: Button" or "Quick Action Available [Hold RUN]")
  2025. elseif UnitOptions:FindFirstChild("Manual") and (targ.Name == UnitOptions.Manual.Value or GData.KeyboardShift_Down or GData.S_Resource ~= nil) and not UnitOptions.Parent:FindFirstChild("DoNotScan") then
  2026. GData.O_ButtonClick = UnitOptions.Parent[UnitOptions.Manual.Value]
  2027. sbox.Color3 = UnitOptions.Parent[UnitOptions.Manual.Value].BrickColor.Color
  2028. sbox.Transparency = 0.5
  2029. sbox.Adornee = UnitOptions.Parent[UnitOptions.Manual.Value]
  2030. GData.Update_MHighlightTip("Button", "Click to activate!", nil, GData.KeyboardShift_Down and "Quick: Button" or "Quick Action Available [Hold RUN]")
  2031. elseif UnitOptions.Parent:FindFirstChild("Unselectable") == nil then
  2032. GData.O_ButtonClick = nil
  2033. GData.O_Selection = UnitOptions.Parent
  2034. sbox.Transparency = 0.5
  2035. sbox.Adornee = UnitOptions.Parent
  2036. local aliases = require(game.ReplicatedStorage.GUILibrary.Aliases)
  2037. local image, tier, tierimage = GData.ItemDatabase.Stone, GData.T_TierData[1], GData.T_TierImages[1]
  2038. if GData.ItemDatabase[UnitOptions.Parent.Name] then
  2039. image = GData.ItemDatabase[UnitOptions.Parent.Name]
  2040. tier = GData.T_TierData[GData.ItemDatabase[UnitOptions.Parent.Name].l or 1]
  2041. tierimage = GData.T_TierImages[GData.ItemDatabase[UnitOptions.Parent.Name].l or 1]
  2042. end
  2043. sbox.Color3 = GData.KeyboardShift_Down and Color3.new(1, 0.4, 0.4) or Color3.new(0.6, 0.6, 0.6)
  2044. GData.Update_MHighlightTip(aliases[UnitOptions.Parent.Name] or UnitOptions.Parent.Name, tier.n, tier.c, GData.KeyboardShift_Down and "Quick: Delete" or nil, tierimage, GData.KeyboardShift_Down and (UnitOptions:FindFirstChild("IG_Tooltip") ~= nil and UnitOptions.IG_Tooltip.Value or UnitOptions:FindFirstChild("NetworkStatus") ~= nil and UnitOptions.NetworkStatus.Value) or nil, UnitOptions:FindFirstChild("IG_Tooltip") ~= nil)
  2045. end
  2046. elseif targ.Name == "DropperDrop" and targ:FindFirstChild("DropData") then
  2047. local dvalue, _, ext = GData.generateExtension(targ.DropData.DropValue.Value)
  2048. dvalue = math.floor(dvalue * 100 + 0.5) / 100
  2049. if targ:FindFirstChild("rdeb") then
  2050. GData.Update_MHighlightTip("Dropper Drop", nil, nil, GData.KeyboardShift_Down and "Quick: Delete" or nil, nil, "Resource Value: " .. dvalue .. " " .. ext .. string.format("\n") .. "Resource: " .. targ.rdeb.Value, true)
  2051. else
  2052. local DisplayTip = "Drop Value: $" .. dvalue .. ext .. string.format("\n")
  2053. local tmp = targ.DropData.DropValue.Value
  2054. if targ:FindFirstChild("Ore") then
  2055. DisplayTip = DisplayTip .. "Ore Entry: " .. targ.Ore.Value .. string.format("\n")
  2056. end
  2057. DisplayTip = DisplayTip .. "Advanced: " .. (tmp >= 1.0E57 and "Yes" or "No") .. string.format("\n") .. "Entropic: " .. (tmp >= 1.0E127 and "Yes" or "No") .. string.format("\n") .. "Chaotic: " .. (tmp >= 1.0E303 and "Yes" or "No")
  2058. GData.Update_MHighlightTip("Dropper Drop", nil, nil, GData.KeyboardShift_Down and "Quick: Delete" or "Quick Action Available [Hold RUN]", nil, DisplayTip, true)
  2059. end
  2060. else
  2061. GData.UndoSSelectionHitbox(sbox)
  2062. GData.Update_MHighlightTip()
  2063. end
  2064. elseif targ.Parent and targ.Parent.Parent and targ.Parent.Parent.Parent then
  2065. local UnitOptions = targ.Parent:FindFirstChild("UnitOptions") or targ.Parent.Parent:FindFirstChild("UnitOptions") or targ.Parent.Parent.Parent:FindFirstChild("UnitOptions")
  2066. if UnitOptions then
  2067. else
  2068. GData.UndoSSelectionHitbox(sbox)
  2069. GData.Update_MHighlightTip()
  2070. end
  2071. end
  2072. else
  2073. GData.UndoSSelectionHitbox(sbox)
  2074. GData.Update_MHighlightTip()
  2075. end
  2076. else
  2077. GData.UndoSSelectionHitbox(sbox)
  2078. GData.Update_MHighlightTip()
  2079. end
  2080. do return end
  2081. if not status and targ and targ.Parent and targ.Parent ~= workspace and targ.Name ~= "MusicBox" and targ.Name ~= "Water" then
  2082. local opt = targ.Parent:FindFirstChild("UnitOptions") or targ.Parent.Parent:FindFirstChild("UnitOptions") or targ.Parent.Parent.Parent:FindFirstChild("UnitOptions")
  2083. local mousetip = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("MouseTooltip")
  2084. if GData.S_Automate then
  2085. if targ and targ.Parent:FindFirstChild("btnAutomate") then
  2086. if (opt.Parent:FindFirstChild("Screen") or targ:FindFirstChild("OwnerOnly")) and not GData.API.CheckIsOwner(opt) then
  2087. return
  2088. end
  2089. if GData.KeyboardShift_Down then
  2090. mousetip.Quick.Text = "Quick: Pulse Automate Button"
  2091. mousetip.Quick.Visible = true
  2092. else
  2093. mousetip.Quick.Visible = false
  2094. end
  2095. GData.O_ButtonClick = targ.Parent.btnAutomate
  2096. sbox.Color3 = targ.Parent.btnAutomate.BrickColor.Color
  2097. sbox.Transparency = 0.5
  2098. sbox.Adornee = targ.Parent.btnAutomate
  2099. mousetip.Title.Text = "Send Pulse"
  2100. mousetip.Tier.Text = "Click to send!"
  2101. mousetip.Tier.Position = UDim2.new(0, 20, 0, 38)
  2102. mousetip.Tier.TextColor3 = targ.Parent.btnAutomate.Color
  2103. mousetip.Tier.Thumbnail.Visible = false
  2104. mousetip.Extra.Visible = false
  2105. mousetip.Visible = true
  2106. mousetip.Position = UDim2.new(0, GData.O_Mouse.X, 0, GData.O_Mouse.Y)
  2107. else
  2108. GData.O_ButtonClick = nil
  2109. GData.O_Selection = nil
  2110. sbox.Transparency = 0
  2111. sbox.Adornee = nil
  2112. mousetip.Visible = false
  2113. mousetip.Help.Visible = false
  2114. end
  2115. return
  2116. elseif targ.Name == "DropperDrop" and targ:FindFirstChild("DropData") then
  2117. if GData.S_Resource ~= nil then
  2118. return
  2119. end
  2120. if GData.S_Automate then
  2121. return
  2122. end
  2123. if GData.KeyboardShift_Down then
  2124. mousetip.Quick.Text = "Quick: Delete"
  2125. mousetip.Quick.Visible = true
  2126. mousetip.Help.Visible = false
  2127. mousetip.Extra.Visible = true
  2128. else
  2129. mousetip.Quick.Visible = false
  2130. mousetip.Help.Visible = true
  2131. mousetip.Extra.Visible = false
  2132. end
  2133. GData.O_ButtonClick = targ
  2134. sbox.Color3 = targ.Color
  2135. sbox.Transparency = 0.5
  2136. sbox.Adornee = targ
  2137. mousetip.Tier.Text = ""
  2138. mousetip.Tier.Position = UDim2.new(0, 20, 0, 38)
  2139. mousetip.Tier.TextColor3 = Color3.new(1, 1, 1)
  2140. mousetip.Tier.Thumbnail.Visible = false
  2141. mousetip.Visible = true
  2142. mousetip.Position = UDim2.new(0, GData.O_Mouse.X, 0, GData.O_Mouse.Y)
  2143. mousetip.Extra.TextSize = 16
  2144. local dvalue, _, ext = GData.generateExtension(targ.DropData.DropValue.Value)
  2145. dvalue = math.floor(dvalue * 100 + 0.5) / 100
  2146. if targ:FindFirstChild("rdeb") then
  2147. mousetip.Title.Text = "Depot Drop"
  2148. mousetip.Extra.Text = "Resource Value: " .. dvalue .. " " .. ext
  2149. mousetip.Extra.Text = mousetip.Extra.Text .. string.format("\n")
  2150. mousetip.Extra.Text = mousetip.Extra.Text .. "Resource: " .. targ.rdeb.Value
  2151. else
  2152. mousetip.Title.Text = "Dropper Drop"
  2153. mousetip.Extra.Text = "Drop Value: $" .. dvalue .. ext
  2154. mousetip.Extra.Text = mousetip.Extra.Text .. string.format("\n")
  2155. local tmp = targ.DropData.DropValue.Value
  2156. if targ:FindFirstChild("Ore") then
  2157. mousetip.Extra.Text = mousetip.Extra.Text .. "Ore Entry: " .. targ.Ore.Value .. string.format("\n")
  2158. end
  2159. mousetip.Extra.Text = mousetip.Extra.Text .. "Advanced: " .. (tmp >= 1.0E57 and "Yes" or "No") .. string.format("\n")
  2160. mousetip.Extra.Text = mousetip.Extra.Text .. "Entropic: " .. (tmp >= 1.0E127 and "Yes" or "No") .. string.format("\n")
  2161. mousetip.Extra.Text = mousetip.Extra.Text .. "Chaotic: " .. (tmp >= 1.0E303 and "Yes" or "No")
  2162. end
  2163. mousetip.Extra.Size = UDim2.new(0, mousetip.Extra.TextBounds.X, 0, mousetip.Extra.TextBounds.Y)
  2164. elseif GData.KeyboardShift_Down and opt and opt:FindFirstChild("Quick") and opt.Quick:FindFirstChild("Activate") then
  2165. local act, act2 = opt.Quick:FindFirstChild("Activate"), opt.Quick:FindFirstChild("ActiveFire")
  2166. if GData.S_Resource ~= nil and not GData.API.CheckIsOwner(opt) then
  2167. return
  2168. end
  2169. local qa = GData.Multi_Invocation_Cache[act] or act:InvokeServer("get-qa")
  2170. GData.Multi_Invocation_Cache[act] = qa
  2171. if GData.KeyboardShift_Down then
  2172. mousetip.Quick.Text = "Quick: Button"
  2173. mousetip.Quick.Visible = true
  2174. else
  2175. mousetip.Quick.Text = "Quick Action Available [Hold RUN]"
  2176. mousetip.Quick.Visible = true
  2177. end
  2178. GData.O_ButtonClick = opt
  2179. sbox.Color3 = opt.Parent.PrimaryPart.BrickColor.Color
  2180. sbox.Transparency = 0.5
  2181. sbox.Adornee = opt.Parent
  2182. mousetip.Title.Text = "Quick Action"
  2183. mousetip.Tier.Text = "Click to activate!"
  2184. mousetip.Tier.Position = UDim2.new(0, 20, 0, 38)
  2185. mousetip.Tier.TextColor3 = Color3.new(1, 1, 1)
  2186. mousetip.Tier.Thumbnail.Visible = false
  2187. mousetip.Extra.Visible = false
  2188. mousetip.Visible = true
  2189. mousetip.Position = UDim2.new(0, GData.O_Mouse.X, 0, GData.O_Mouse.Y)
  2190. elseif opt and opt:FindFirstChild("Manual") and (targ.Name == opt.Manual.Value or GData.KeyboardShift_Down) and not opt.Parent:FindFirstChild("DoNotScan") then
  2191. if GData.S_Resource ~= nil and not GData.API.CheckIsOwner(opt) then
  2192. return
  2193. end
  2194. if GData.S_Automate then
  2195. return
  2196. end
  2197. if (opt.Parent:FindFirstChild("Screen") or targ:FindFirstChild("OwnerOnly")) and not GData.API.CheckIsOwner(opt) then
  2198. return
  2199. end
  2200. if GData.KeyboardShift_Down then
  2201. mousetip.Quick.Text = "Quick: Button"
  2202. mousetip.Quick.Visible = true
  2203. else
  2204. mousetip.Quick.Visible = false
  2205. end
  2206. GData.O_ButtonClick = opt.Parent[opt.Manual.Value]
  2207. sbox.Color3 = opt.Parent[opt.Manual.Value].BrickColor.Color
  2208. sbox.Transparency = 0.5
  2209. sbox.Adornee = opt.Parent[opt.Manual.Value]
  2210. mousetip.Title.Text = "Button"
  2211. mousetip.Tier.Text = "Click to activate!"
  2212. mousetip.Tier.Position = UDim2.new(0, 20, 0, 38)
  2213. mousetip.Tier.TextColor3 = opt.Parent[opt.Manual.Value].Color
  2214. mousetip.Tier.Thumbnail.Visible = false
  2215. mousetip.Extra.Visible = false
  2216. mousetip.Visible = true
  2217. mousetip.Position = UDim2.new(0, GData.O_Mouse.X, 0, GData.O_Mouse.Y)
  2218. elseif opt and not opt:FindFirstChild("ManualActivating") and not opt.Parent:FindFirstChild("DoNotScan") and not opt.Parent:FindFirstChild("Unselectable") and GData.API.CheckIsOwner(opt) then
  2219. GData.O_ButtonClick = nil
  2220. GData.O_Selection = opt.Parent
  2221. if GData.KeyboardShift_Down then
  2222. sbox.Color3 = Color3.new(1, 0.4, 0.4)
  2223. mousetip.Quick.Text = "Quick: Delete"
  2224. mousetip.Quick.Visible = true
  2225. else
  2226. sbox.Color3 = Color3.new(0.6, 0.6, 0.6)
  2227. mousetip.Quick.Visible = false
  2228. end
  2229. sbox.Transparency = 0.5
  2230. sbox.Adornee = opt.Parent
  2231. local aliases = require(game.ReplicatedStorage.GUILibrary.Aliases)
  2232. mousetip.Title.Text = aliases[opt.Parent.Name] or opt.Parent.Name
  2233. mousetip.Tier.Text = "Primitive"
  2234. mousetip.Tier.TextColor3 = GData.T_TierData[1].c
  2235. if GData.ItemDatabase[opt.Parent.Name] then
  2236. local _ti = GData.ItemDatabase[opt.Parent.Name].l or 1
  2237. local tier = GData.T_TierData[_ti]
  2238. mousetip.Tier.Text = tier.n
  2239. mousetip.Tier.TextColor3 = tier.c
  2240. mousetip.Tier.Thumbnail.Image = GData.T_TierImages[_ti]
  2241. mousetip.Tier.Thumbnail.Visible = true
  2242. if GData.T_TierImages[_ti] == "" then
  2243. mousetip.Tier.Position = UDim2.new(0, 20, 0, 38)
  2244. else
  2245. mousetip.Tier.Position = UDim2.new(0, 46, 0, 38)
  2246. end
  2247. else
  2248. mousetip.Tier.Thumbnail.Visible = false
  2249. mousetip.Tier.Position = UDim2.new(0, 20, 0, 38)
  2250. end
  2251. if opt:FindFirstChild("IG_Tooltip") and GData.KeyboardShift_Down then
  2252. mousetip.Extra.Visible = true
  2253. mousetip.Extra.TextSize = 16
  2254. mousetip.Extra.Text = opt.IG_Tooltip.Value
  2255. mousetip.Help.Visible = false
  2256. mousetip.Extra.Size = UDim2.new(0, mousetip.Extra.TextBounds.X, 0, mousetip.Extra.TextBounds.Y)
  2257. elseif opt:FindFirstChild("NetworkStatus") and GData.KeyboardShift_Down then
  2258. mousetip.Extra.Visible = true
  2259. mousetip.Extra.TextSize = 18
  2260. mousetip.Extra.Text = opt.NetworkStatus.Value
  2261. mousetip.Help.Visible = false
  2262. mousetip.Extra.Size = UDim2.new(0, mousetip.Extra.TextBounds.X, 0, mousetip.Extra.TextBounds.Y)
  2263. elseif opt:FindFirstChild("IG_Tooltip") or opt:FindFirstChild("NetworkStatus") then
  2264. mousetip.Help.Visible = true
  2265. mousetip.Extra.Visible = false
  2266. else
  2267. mousetip.Extra.Visible = false
  2268. mousetip.Help.Visible = false
  2269. end
  2270. mousetip.Visible = true
  2271. mousetip.Position = UDim2.new(0, GData.O_Mouse.X, 0, GData.O_Mouse.Y)
  2272. else
  2273. GData.O_ButtonClick = nil
  2274. GData.O_Selection = nil
  2275. sbox.Transparency = 0
  2276. sbox.Adornee = nil
  2277. mousetip.Visible = false
  2278. mousetip.Help.Visible = false
  2279. end
  2280. else
  2281. GData.UndoSSelectionHitbox(sbox)
  2282. end
  2283. end
  2284. local selection_lastModel
  2285. function GData.CheckMouseRegion_Multi(position1, position2)
  2286. local pgui = getLocalPlayer():WaitForChild("PlayerGui")
  2287. local models = GData.API.GetSelectedModels(position1, position2)
  2288. for i = #GData.T_SelectionModels, 1, -1 do
  2289. if not models[GData.T_SelectionModels[i]] then
  2290. GData.API.RemoveSelection(GData.T_SelectionModels[i])
  2291. end
  2292. end
  2293. for model in pairs(models) do
  2294. if not GData.API.SelectionExists(model) and model:FindFirstChild("Unselectable") == nil then
  2295. GData.API.AddSelection(model, script.SelectionBox:Clone(), pgui)
  2296. end
  2297. end
  2298. end
  2299. local run = game:GetService("RunService")
  2300. local selecting = false
  2301. local selectnode
  2302. coroutine.wrap(function()
  2303. GData.O_Difficulty = workspace.Players[game.Players.LocalPlayer.Name].PlayerData.Difficulty
  2304. local tmp1, tmp2
  2305. local newgame = true
  2306. if newgame then
  2307. while playing() do
  2308. run.RenderStepped:wait()
  2309. GData.API.FixMenus()
  2310. GData.Update_MenuOpen_Status()
  2311. for _, API in pairs(GData.Loopable_API_Order) do
  2312. API.loop()
  2313. end
  2314. GData.Activate_MHighlightTip()
  2315. end
  2316. return
  2317. end
  2318. while playing() do
  2319. run.RenderStepped:wait()
  2320. GData.API.FixMenus()
  2321. local gmenu = GData.API.GetMenu()
  2322. GData.Update_MenuOpen_Status()
  2323. while GData.O_ConfigureGUI and GData.O_ConfigureGUI.Parent do
  2324. GData.Update_MenuOpen_Status()
  2325. wait()
  2326. end
  2327. local sbox = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("SelectionBox")
  2328. if GData.MouseButton1_Down and GData.DontMBU == false then
  2329. local mouseRay = Ray.new(GData.O_Mouse.UnitRay.Origin, GData.O_Mouse.UnitRay.Direction * 500)
  2330. local part, intersection = workspace:FindPartOnRayWithIgnoreList(mouseRay, {
  2331. workspace.CurrentCamera,
  2332. getLocalCharacter(),
  2333. workspace.Players[game.Players.LocalPlayer.Name].Tiles
  2334. })
  2335. if part and part.Name:find("BasePlate") then
  2336. GData.Selection_BoundingBox.Anchor = intersection
  2337. end
  2338. selecting = false
  2339. end
  2340. while playing() and GData.MouseButton1_Down and GData.Selection_BoundingBox.Anchor and GData.DontMBU == false do
  2341. local mouseRay = Ray.new(GData.O_Mouse.UnitRay.Origin, GData.O_Mouse.UnitRay.Direction * 500)
  2342. local part, intersection = workspace:FindPartOnRayWithIgnoreList(mouseRay, {
  2343. workspace.CurrentCamera,
  2344. getLocalCharacter(),
  2345. workspace.Players[getLocalPlayer().Name]
  2346. })
  2347. if selecting == false and part and part.Name:find("BasePlate") and (intersection - GData.Selection_BoundingBox.Anchor).magnitude > 2 then
  2348. GData.UndoSSelectionHitbox(sbox)
  2349. selecting = true
  2350. GData.API.SpawnNode(GData.Selection_BoundingBox.Anchor)
  2351. end
  2352. if selecting then
  2353. GData.CheckMouseRegion_Multi(GData.Selection_BoundingBox.Anchor, intersection)
  2354. GData.API.IntermediateBox(GData.Selection_BoundingBox.Anchor, intersection)
  2355. if selectnode == nil then
  2356. selectnode = GData.API.SpawnNode(GData.Selection_BoundingBox.Anchor)
  2357. elseif GData.T_Nodes[selectnode] then
  2358. local mouseRay = Ray.new(GData.O_Mouse.UnitRay.Origin, GData.O_Mouse.UnitRay.Direction * 500)
  2359. local part, intersection = workspace:FindPartOnRayWithIgnoreList(mouseRay, {
  2360. workspace.CurrentCamera,
  2361. getLocalCharacter(),
  2362. workspace.Players[game.Players.LocalPlayer.Name]
  2363. })
  2364. GData.T_Nodes[selectnode][5] = intersection
  2365. end
  2366. end
  2367. run.RenderStepped:wait()
  2368. end
  2369. if #GData.T_SelectionModels > 1 then
  2370. local gui = getLocalPlayer().PlayerGui:WaitForChild("GameGUI").AbsoluteSize
  2371. local windowx, windowy = gui.X, gui.Y
  2372. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = true
  2373. getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.ForceClose:Invoke()
  2374. game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("OtherMenu", true)
  2375. local _tab = getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.ShowMenu:Invoke(clamp(GData.O_Mouse.X + 40, 0, windowx - 660), clamp(GData.O_Mouse.Y, 120, windowy - 300), radial2Menu, GData.CFG, GData.T_SelectionModels[1])
  2376. if _tab then
  2377. GData.LastMenuCount = #_tab
  2378. end
  2379. while playing() and getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible do
  2380. GData.Update_MenuOpen_Status()
  2381. run.RenderStepped:wait()
  2382. end
  2383. elseif #GData.T_SelectionModels == 1 then
  2384. GData.O_Selection = GData.T_SelectionModels[1]
  2385. GData.On_Select()
  2386. end
  2387. GData.API.IntermediateBox_Clear()
  2388. GData.API.VanishNodes()
  2389. selectnode = nil
  2390. selecting = false
  2391. GData.API.ClearSelection()
  2392. GData.Selection_BoundingBox.Anchor = nil
  2393. while playing() and GData.Menu_Open do
  2394. GData.UndoSSelectionHitbox(sbox)
  2395. GData.Update_MenuOpen_Status()
  2396. GData.O_ButtonClick = nil
  2397. wait()
  2398. GData.API.ChangeInvInfoStatus(GData.InputType == "Keyboard", "inventory")
  2399. end
  2400. while playing() and GData.O_SelectionGUI do
  2401. GData.Update_MenuOpen_Status()
  2402. GData.O_ButtonClick = nil
  2403. GData.API.ChangeInvInfoStatus(GData.InputType == "Keyboard", "rc_menu")
  2404. sbox.Adornee = GData.O_SelectionGUI
  2405. sbox.Transparency = 0
  2406. local mousetip = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("MouseTooltip")
  2407. mousetip.Visible = false
  2408. wait()
  2409. end
  2410. GData.API.VanishNodes()
  2411. selectnode = nil
  2412. selecting = false
  2413. GData.API.ClearSelection()
  2414. local pl = getLocalPlayer()
  2415. GData.API.ChangeInvInfoStatus(GData.InputType == "Keyboard", "idle")
  2416. local mouseRay, int, Hit, startpos
  2417. if GData.InputType == "Gamepad" then
  2418. mouseRay = Ray.new(GData.O_Mouse.UnitRay.Origin, GData.O_Mouse.UnitRay.Direction * 500)
  2419. int, Hit = workspace:FindPartOnRayWithIgnoreList(mouseRay, {
  2420. workspace.CurrentCamera,
  2421. workspace.Players[pl.Name].Tiles,
  2422. getLocalCharacter()
  2423. })
  2424. if int then
  2425. startpos = Hit
  2426. end
  2427. end
  2428. local hlabel = game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("GameGUI").HUD.Harvest
  2429. if GData.O_ButtonClick and GData.O_ButtonClick.Name == "Harvest" then
  2430. hlabel.Visible = true
  2431. local HP, Max = GData.O_ButtonClick.Parent.UnitOptions.HP.Value, 5
  2432. hlabel.Level.Percent:TweenSize(UDim2.new(HP / Max, 0, 1, 0), nil, nil, 0.1)
  2433. hlabel.Label.Text = "Harvest (" .. GData.O_ButtonClick.Parent.UnitOptions.Deposit.Value .. ")"
  2434. else
  2435. hlabel.Visible = false
  2436. end
  2437. if GData.Placement_Model then
  2438. startpos = GData.Placement_Model.PrimaryPart.Position * Vector3.new(1, 0, 1)
  2439. end
  2440. game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("Building", false)
  2441. local offs = Vector3.new(0, 0, 0)
  2442. tmp1, tmp2 = gmenu.Menu1.Visible, gmenu.Menu2.Visible
  2443. local gplaced = false
  2444. local lastundmod
  2445. while playing() and GData.Placement_Model and 0 < GData.Placement_Count and GData.Placement_Model.PrimaryPart do
  2446. local undmod = GData.Undo_ActionList[#GData.Undo_ActionList]
  2447. if undmod and undmod.Parent and lastundmod ~= undmod and not undmod:IsDescendantOf(workspace.CurrentCamera) then
  2448. GData.API.TriangleHide()
  2449. ShowPart.Size = undmod.PrimaryPart.Size
  2450. ShowPart.CFrame = undmod.PrimaryPart.CFrame + Vector3.new(0, 1, 0)
  2451. GData.API.TriangleShow(undmod)
  2452. lastundmod = undmod
  2453. elseif 1 > #GData.Undo_ActionList and lastundmod ~= nil then
  2454. GData.API.TriangleHide()
  2455. undmod, lastundmod = nil, nil
  2456. elseif 0 < #GData.Undo_ActionList then
  2457. lastundmod = undmod
  2458. end
  2459. local mousetip = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("MouseTooltip")
  2460. mousetip.Visible = false
  2461. gplaced = true
  2462. GData.API.HideMenus()
  2463. local doMbd = false
  2464. game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("Building", true)
  2465. GData.Update_MenuOpen_Status()
  2466. if GData.InputType == "Gamepad" then
  2467. local inputs = game:GetService("UserInputService"):GetGamepadState(Enum.UserInputType.Gamepad1)
  2468. for _, K in pairs(inputs) do
  2469. if K.KeyCode.Name:find("Thumbstick1") then
  2470. GData.Gamepad.Cursor = K.Position
  2471. elseif K.KeyCode.Name:find("Thumbstick2") then
  2472. GData.Gamepad.Cursor_Turn = K.Position
  2473. end
  2474. end
  2475. end
  2476. GData.API.ChangeInvInfoStatus(GData.InputType == "Keyboard", "build_map")
  2477. pl:WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("BuildHUD").Visible = true
  2478. local assignview = getLocalPlayer().PlayerGui:WaitForChild("GameGUI"):FindFirstChild("AssignView")
  2479. if assignview then
  2480. pl:WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("BuildHUD").Visible = false
  2481. if assignview:FindFirstChild("ItemHolder") then
  2482. assignview.ItemHolder.Amnt.Text = GData.Placement_Count
  2483. end
  2484. else
  2485. pl:WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("BuildHUD").Visible = true
  2486. pl:WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("BuildHUD").Amount.Text = "x" .. GData.Placement_Count
  2487. end
  2488. GData.O_ButtonClick = nil
  2489. GData.O_Selection = nil
  2490. sbox.Transparency = 0
  2491. GData.Placement_Model.Parent = workspace.CurrentCamera
  2492. local ppart = GData.Placement_Model.PrimaryPart or GData.Placement_Model:FindFirstChild("Base Platform")
  2493. if not ppart then
  2494. error("Error 1: Could not resolve primary part. Report error to nickcool9999.", 2)
  2495. end
  2496. GData.GhostizeModel(GData.Placement_Model)
  2497. sbox.Adornee = GData.Placement_Model
  2498. local cam = getLocalCamera()
  2499. if GData.InputType ~= "Gamepad" then
  2500. mouseRay = Ray.new(GData.O_Mouse.UnitRay.Origin, GData.O_Mouse.UnitRay.Direction * 500)
  2501. int, Hit = workspace:FindPartOnRayWithIgnoreList(mouseRay, {
  2502. workspace.CurrentCamera,
  2503. workspace.Players[pl.Name].Tiles,
  2504. getLocalCharacter()
  2505. })
  2506. Hit = Hit + GData.Mouse_Offset
  2507. elseif GData.Gamepad.Cursor and GData.Gamepad.Cursor.magnitude > 0.25 then
  2508. local look = OriginFrame.new((cam.CFrame.lookVector * Vector3.new(1, 0, 1)).unit)
  2509. Hit = Hit + (look * CFrame.new(GData.Gamepad.Cursor.X, 0, -GData.Gamepad.Cursor.Y)).p
  2510. print(GData.Gamepad.Cursor.X, GData.Gamepad.Cursor.Y, GData.Gamepad.Cursor.Z)
  2511. end
  2512. if GData.Placement_Model:FindFirstChild("Phantom Brick") then
  2513. Hit = Hit + (GData.Placement_Model.PrimaryPart.Position - GData.Placement_Model["Phantom Brick"].Position)
  2514. end
  2515. local ray = Ray.new(ppart.CFrame.p, Vector3.new(0, -20, 0))
  2516. local testpart = workspace:FindPartOnRayWithIgnoreList(ray, {
  2517. workspace.CurrentCamera,
  2518. workspace.Players[pl.Name].Tiles,
  2519. getLocalCharacter()
  2520. })
  2521. local moffset = Vector3.new(0, 0, 0)
  2522. moffset = GData.API.GetOffset(ppart.Size, GData.Rotation)
  2523. local diff = Hit - (GData.AnchorPoint or GData.O_Anchor.Position)
  2524. local XValid, ZValid = math.abs(diff.X) <= 512, math.abs(diff.Z) <= 512
  2525. local movePos, cf2
  2526. local isSmooth = pl:WaitForChild("PlayerGui"):WaitForChild("SmoothPlacement").Value
  2527. if int and XValid and ZValid then
  2528. GData.O_Podium = nil
  2529. local psx, psz = ppart.Size.X / 2, ppart.Size.Z / 2
  2530. local mousePos = Vector3.new(GData.round(Hit.X / GData.Alignment.X) * GData.Alignment.X, 0, GData.round(Hit.Z / GData.Alignment.Z) * GData.Alignment.Z)
  2531. local look = CFrame.new(mousePos) * CFrame.Angles(0, -math.rad(GData.Rotation), 0) * CFrame.new(-psx % GData.Alignment.X, 0, -psz % GData.Alignment.Z) + moffset
  2532. local offsety = GData.Placement_Model:FindFirstChild("OffsetY")
  2533. local phantom = GData.Placement_Model:FindFirstChild("Phantom Brick")
  2534. if offsety then
  2535. cf2 = look + Vector3.new(0, ppart.Size.Y / 2 + offsety.Value, 0) + offs
  2536. elseif phantom then
  2537. cf2 = look + Vector3.new(0, ppart.Size.Y / 2 + (ppart.Position.Y - phantom.Position.Y), 0) + offs
  2538. else
  2539. cf2 = look + Vector3.new(0, ppart.Size.Y / 2, 0) + offs
  2540. end
  2541. local dist = (cf2.p - GData.Placement_Model.PrimaryPart.CFrame.p).magnitude
  2542. GData.CF_Placement = cf2
  2543. if dist < 0.2 or dist > 64 then
  2544. GData.Placement_Model:SetPrimaryPartCFrame(cf2)
  2545. else
  2546. GData.Placement_Model:SetPrimaryPartCFrame(GData.Placement_Model.PrimaryPart.CFrame:lerp(cf2, not isSmooth and 1 or 0.6))
  2547. if GData.MouseButton1_Down and doMbd == false then
  2548. doMbd = true
  2549. end
  2550. end
  2551. end
  2552. GData.checkEmpty(ppart, ppart.Position - Vector3.new(0, 4, 0))
  2553. local canGoDown = GData.Placement_IsEmpty
  2554. local r = GData.checkEmpty(ppart)
  2555. local num = function(t)
  2556. local l = 0
  2557. for n in pairs(t) do
  2558. l = l + 1
  2559. end
  2560. return l
  2561. end
  2562. if r and num(r) > 0 and num(r) < 5 then
  2563. local botpos = GData.Placement_Model.PrimaryPart.CFrame
  2564. local top = 0
  2565. offs = Vector3.new(0, 0, 0)
  2566. repeat
  2567. for model in pairs(r) do
  2568. if model:IsA("Model") then
  2569. local s = model:GetExtentsSize()
  2570. local Y = model.PrimaryPart.CFrame.Y
  2571. local Ys = model.PrimaryPart.Size.Y / 2
  2572. top = math.max(Y + math.ceil(s.Y / 4) * 4 - Ys, top)
  2573. end
  2574. end
  2575. offs = Vector3.new(0, top, 0)
  2576. r = GData.checkEmpty(ppart, botpos.p + offs)
  2577. until not r or num(r) < 1 or num(r) > 4
  2578. if r then
  2579. GData.Placement_IsEmpty = false
  2580. else
  2581. GData.Placement_Model:SetPrimaryPartCFrame(botpos + offs)
  2582. end
  2583. elseif canGoDown then
  2584. local botpos = GData.Placement_Model.PrimaryPart.CFrame
  2585. r = GData.checkEmpty(ppart, botpos.p - Vector3.new(0, 4, 0))
  2586. while offs.Y > 0 and GData.Placement_IsEmpty do
  2587. offs = offs - Vector3.new(0, 4, 0)
  2588. r = GData.checkEmpty(ppart, botpos.p + offs)
  2589. end
  2590. offs = Vector3.new(offs.X, math.max(0, offs.Y), offs.Z)
  2591. GData.Placement_Model:SetPrimaryPartCFrame(botpos + offs)
  2592. end
  2593. local gridPos = Vector3.new(ppart.Position.X / GData.Alignment.X, ppart.Position.Y / 4, ppart.Position.Z / GData.Alignment.Z)
  2594. gridPos = Vector3.new(math.floor(gridPos.X + 0.5) * GData.Alignment.X, 0, math.floor(gridPos.Z + 0.5) * GData.Alignment.Z)
  2595. getLocalPlayer().PlayerGui.Grid.BuildPos:Fire(gridPos, ppart.BrickColor.Color, ppart.Size, GData.Alignment)
  2596. local r = GData.checkEmpty(ppart)
  2597. local targ = GData.O_Mouse.Target
  2598. if targ and targ:FindFirstChild("CustomTile") then
  2599. GData.O_Podium = targ
  2600. end
  2601. if GData.O_Podium then
  2602. local docf = CFrame.new(GData.O_Podium.Position + Vector3.new(0, GData.Placement_Model.PrimaryPart.Size.Y / 2 + GData.O_Podium.Size.Y / 2, 0))
  2603. GData.Placement_Model:SetPrimaryPartCFrame(docf * CFrame.Angles(GData.O_Podium.CFrame:toEulerAnglesXYZ()))
  2604. GData.CF_Placement = docf
  2605. print(GData.Placement_Model.Name)
  2606. GData.Placement_IsEmpty = GData.O_Podium.CustomTile.Value == GData.Placement_Model.Name
  2607. end
  2608. if 1 <= getLocalPlayer().PlayerGui:WaitForChild("DataLimit").Value then
  2609. sbox.Color3 = Color3.new(1, 0.5, 0)
  2610. sbox.SurfaceTransparency = 0.5
  2611. elseif GData.Placement_IsEmpty then
  2612. sbox.Color3 = Color3.new(0, 1, 0)
  2613. sbox.SurfaceTransparency = 1
  2614. else
  2615. sbox.Color3 = Color3.new(1, 0, 0)
  2616. sbox.SurfaceTransparency = 0.6
  2617. end
  2618. GData.API.lockOnModel(ppart.Parent)
  2619. if getLocalCamera().CameraType.Name == "Scriptable" then
  2620. getLocalCharacter():WaitForChild("Humanoid").WalkSpeed = 0
  2621. end
  2622. if doMbd then
  2623. if GData.AnchorPoint == nil then
  2624. end
  2625. if GData.Rotation == 0 or GData.Rotation == 180 then
  2626. else
  2627. end
  2628. GData.DontMBU = true
  2629. GData.onMouse1_Down()
  2630. GData.Skip_MBUFunction = true
  2631. elseif GData.MouseButton1_Down == false then
  2632. GData.AnchorPoint = nil
  2633. GData.Alignment = {
  2634. X = GData.DefaultAlignment.X,
  2635. Z = GData.DefaultAlignment.Z
  2636. }
  2637. end
  2638. game:GetService("RunService").RenderStepped:wait()
  2639. end
  2640. GData.AnchorPoint = nil
  2641. GData.Alignment = {X = 2, Z = 2}
  2642. GData.API.TriangleHide()
  2643. if GData.Placement_Model then
  2644. GData.Placement_Model:Destroy()
  2645. end
  2646. removeCorner()
  2647. GData.Placement_Model = nil
  2648. local center, anchor_points
  2649. if 0 < #GData.T_SelectionMovingModels then
  2650. center = CFrame.new(GData.API.CenterPoint(GData.T_SelectionMovingModels))
  2651. GData.Rotation = 0
  2652. anchor_points = {}
  2653. for _, model in pairs(GData.T_SelectionMovingModels) do
  2654. anchor_points[model] = model.PrimaryPart.Position - center
  2655. GData.GhostizeModel(model)
  2656. end
  2657. end
  2658. while 0 < #GData.T_SelectionMovingModels do
  2659. local cam = getLocalCamera()
  2660. if GData.InputType ~= "Gamepad" then
  2661. mouseRay = Ray.new(GData.O_Mouse.UnitRay.Origin, GData.O_Mouse.UnitRay.Direction * 500)
  2662. int, Hit = workspace:FindPartOnRayWithIgnoreList(mouseRay, {
  2663. workspace.CurrentCamera,
  2664. workspace.Players[pl.Name].Tiles,
  2665. getLocalCharacter()
  2666. })
  2667. Hit = Hit + GData.Mouse_Offset
  2668. elseif GData.Gamepad.Cursor and GData.Gamepad.Cursor.magnitude > 0.25 then
  2669. local look = OriginFrame.new((cam.CFrame.lookVector * Vector3.new(1, 0, 1)).unit)
  2670. Hit = Hit + (look * CFrame.new(GData.Gamepad.Cursor.X, 0, -GData.Gamepad.Cursor.Y)).p
  2671. end
  2672. for _, model in pairs(GData.T_SelectionMovingModels) do
  2673. local end_goal = CFrame.new(Hit + anchor_points[model]) * CFrame.Angles(0, math.rad(GData.Rotation - model.Rotation.Value), 0)
  2674. model:SetPrimaryPartCFrame(end_goal)
  2675. end
  2676. game:GetService("RunService").RenderStepped:wait()
  2677. end
  2678. if gplaced then
  2679. gmenu.Menu1.Visible, gmenu.Menu2.Visible = tmp1, tmp2
  2680. end
  2681. game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("Building", false)
  2682. if getLocalCamera().CameraType.Name == "Scriptable" then
  2683. getLocalCharacter():WaitForChild("Humanoid").WalkSpeed = 16
  2684. end
  2685. GData.API.lockOffModel()
  2686. GData.O_Mouse.TargetFilter = nil
  2687. pl:WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("BuildHUD").Visible = false
  2688. sbox.SurfaceTransparency = 1
  2689. tmp1, tmp2 = gmenu.Menu1.Visible, gmenu.Menu2.Visible
  2690. end
  2691. end)()
  2692. end
  2693. script.Parent.Enabled.Enable.OnInvoke = enable
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement