Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --SynapseX Decompiler
- local _gui = game.ReplicatedStorage.GUILibrary.Guis:Clone()
- _gui.Parent = script
- local anims = require(_gui)
- local cr, cr2 = game.ReplicatedStorage.Calls.Cross, game.ReplicatedStorage.Calls.Parallel
- OriginFrame = {}
- function _crEvent(n)
- local f, e = cr:FindFirstChild(n)
- if f then
- e = f
- else
- e = Instance.new("RemoteEvent", cr)
- e.Name = n
- end
- return e
- end
- function _crFunction(n)
- local f, e = cr:FindFirstChild(n)
- if f then
- e = f
- else
- e = Instance.new("RemoteFunction", cr)
- e.Name = n
- end
- return e
- end
- function _prEvent(n)
- local f, e = cr2:FindFirstChild(n)
- if f then
- e = f
- else
- e = Instance.new("BindableEvent", cr2)
- e.Name = n
- end
- return e
- end
- function _prFunction(n)
- local f, e = cr2:FindFirstChild(n)
- if f then
- e = f
- else
- e = Instance.new("BindableFunction", cr2)
- e.Name = n
- end
- return e
- end
- function getLocalPlayer()
- if not game.Players.LocalPlayer then
- repeat
- wait()
- until game.Players.LocalPlayer
- end
- return game.Players.LocalPlayer
- end
- function getLocalCharacter()
- local pl = getLocalPlayer()
- if not pl.Character then
- repeat
- wait()
- until pl.Character
- end
- return pl.Character
- end
- function removeCorner()
- local assignview = getLocalPlayer().PlayerGui:WaitForChild("GameGUI"):FindFirstChild("AssignView")
- if assignview then
- assignview:TweenPosition(UDim2.new(1, 10, 1, 10), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.5)
- delay(0.5, function()
- assignview:Destroy()
- end)
- end
- end
- function getLocalCamera()
- if not workspace.CurrentCamera then
- repeat
- wait()
- until workspace.CurrentCamera
- end
- return workspace.CurrentCamera
- end
- function playing()
- return script.Parent.Enabled.Value
- end
- function clamp(n, bottom, top)
- return math.min(top, math.max(bottom, n))
- end
- function OriginFrame.new(v3)
- return CFrame.new(Vector3.new(0, 0, 0), v3)
- end
- for _, debugline in pairs(game.HttpService:JSONDecode(_crFunction("GetServerDebugs"):InvokeServer())) do
- print(debugline)
- end
- function enable()
- local GData = {
- Upgrades = game:GetService("HttpService"):JSONDecode(game.ReplicatedStorage.Calls.Cross.GetUpgrades:InvokeServer()),
- ItemDatabase = game.HttpService:JSONDecode(game.ReplicatedStorage.Calls.Cross.GetItemDictionary:InvokeServer()),
- ConfigAPI = require(game.ReplicatedStorage.GUILibrary.ConfigSurface_V1),
- O_BaseModel = game.ReplicatedStorage.Calls.Cross.GetBase:InvokeServer(),
- TierAPI = require(game.ReplicatedStorage.GUILibrary.TierImages),
- GuiAPI = anims,
- DB_Server = false,
- DB_Click = false,
- DB_Assign = false,
- O_LocalPlayer = getLocalPlayer(),
- O_PlayerFld = workspace.Players:WaitForChild(getLocalPlayer().Name, 1000000000),
- O_Mods = getLocalPlayer():WaitForChild("PlayerScripts", 1000000000):WaitForChild("Controller Modules", 1000000000),
- O_Selection = nil,
- O_SelectionGUI = nil,
- O_ButtonClick = nil,
- O_Difficulty = nil,
- O_ConfigureGUI = nil,
- T_SelectionBoxes = {},
- T_SelectionModels = {},
- T_SelectionMovingModels = {},
- OwnerCache = {},
- Selection_BoundingBox = {Anchor = nil},
- O_Mouse = getLocalPlayer():GetMouse(),
- Mouse_Offset = Vector3.new(-2, 0, -2),
- Skip_MBUFunction = false,
- MouseButton1_Down = false,
- KeyboardShift_Down = false,
- DontMBU = false,
- Rotation = 0,
- Placement_Model = nil,
- Placement_Count = 99,
- Placement_IsEmpty = false,
- Alignment = {X = 4, Z = 4},
- DefaultAlignment = {X = 4, Z = 4},
- CF_Placement = nil,
- O_Podium = nil,
- S_Automate = nil,
- S_Resource = nil,
- Gamepad = {
- Locked = false,
- Rotation = 0,
- Zoom = 0,
- Cursor = Vector3.new(0, 0, 0),
- Cursor_Turn = Vector3.new(0, 0, 0)
- },
- T_LastButtons = nil,
- Placement_Successful = false,
- InputType = "Keyboard",
- Undo_ActionList = {},
- TooMuchData = false,
- LastMenuCount = 4,
- S_StatusInfo = "",
- Menu_Open = false,
- Menus = {},
- Keys = {},
- T_Nodes = {},
- IsPlaying = playing
- }
- GData.API = {
- import = function(name, level)
- GData.imports = GData.imports or {}
- if GData.imports[name] then
- return GData.imports[name]
- else
- if not GData.O_Mods.Parent:FindFirstChild("Controller Module Structured") then
- GData.O_ModStructureFld = GData.O_ModStructureFld or Instance.new("Folder")
- GData.O_ModStructureFld.Name = "Controller Module Structured"
- GData.O_ModStructureFld.Parent = GData.O_Mods
- end
- local Import = GData.O_Mods:FindFirstChild(name, true):Clone()
- Import.Parent = GData.O_ModStructureFld
- if level then
- return require(Import)(GData)
- else
- return require(Import)
- end
- end
- end
- }
- GData.KeyBinds = {
- MouseButton2 = {
- rc_menu = {
- close = {
- ["Right Click"] = "Unknown"
- }
- }
- },
- Keyboard = {
- idle = {
- run = {Shift = "LeftShift"},
- inventory = {E = "E"},
- shop = {F = "F"}
- },
- rc_menu = {
- run = {Shift = "LeftShift"},
- move = {Z = "Z"},
- ["pick up"] = {X = "X"},
- upgrade = {C = "C"},
- close = {V = "V"}
- },
- inventory = {
- run = {Shift = "LeftShift"},
- inventory = {E = "E"},
- shop = {F = "F"}
- },
- build_map = {
- run = {Shift = "LeftShift"},
- undo = {F = "F"}
- },
- resource_map = {
- run = {Shift = "LeftShift"}
- }
- },
- Gamepad = {
- idle = {
- run = {LT = "ButtonL2"},
- inventory = {X = "ButtonX"},
- shop = {Y = "ButtonY"}
- },
- rc_menu = {
- run = {LT = "ButtonL2"},
- move = {Z = "Z"},
- ["pick up"] = {X = "X"},
- upgrade = {C = "C"},
- close = {V = "V"}
- },
- inventory = {
- run = {LT = "ButtonL2"},
- inventory = {X = "ButtonX"},
- shop = {Y = "ButtonY"}
- },
- build_map = {
- run = {LT = "ButtonL2"},
- undo = {F = "F"}
- },
- resource_map = {
- run = {LT = "ButtonL2"}
- }
- }
- }
- GData.O_Anchor = GData.O_BaseModel.PrimaryPart
- GData.T_TierImages = GData.TierAPI[1]
- GData.T_TierData = GData.TierAPI[2]
- GData.Actions = {
- Pickup = function(pickup_model)
- if type(pickup_model) == "table" then
- if GData.DB_Server then
- return
- end
- GData.DB_Server = true
- for _, model in pairs(GData.T_SelectionModels) do
- if model and model.Parent then
- game.ReplicatedStorage.Calls.Cross.PickupStructure:InvokeServer(model, true)
- end
- end
- GData.DB_Server = false
- return
- end
- if GData.DB_Server then
- return
- end
- GData.DB_Server = true
- if not pickup_model then
- GData.DB_Server = false
- return
- end
- game.ReplicatedStorage.Calls.Cross.PickupStructure:InvokeServer(pickup_model, true)
- if not pickup_model then
- GData.DB_Server = false
- return
- end
- pickup_model:Destroy()
- pickup_model = nil
- GData.DB_Server = false
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.CloseMenu:Invoke()
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
- end,
- Upgrade = function(upgrade_model, override_debounce)
- if type(upgrade_model) == "table" then
- if GData.DB_Server then
- return
- end
- for _, model in pairs(GData.T_SelectionModels) do
- if model and model.Parent then
- coroutine.wrap(function()
- GData.Actions.Upgrade(model, true)
- end)()
- end
- end
- GData.DB_Server = false
- return
- end
- if not override_debounce then
- if GData.DB_Server then
- return
- end
- GData.DB_Server = true
- end
- if not upgrade_model then
- GData.DB_Server = false
- return
- end
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
- local result, model = game.ReplicatedStorage.Calls.Cross.IssueUpgrade:InvokeServer(upgrade_model)
- if result then
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = true
- end
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.CloseMenu:Invoke()
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
- if not override_debounce then
- GData.DB_Server = false
- end
- end,
- Move = function(move_model)
- if type(move_model) == "table" then
- for i = 1, #move_model do
- end
- local resultfld = _crFunction("PickupStructures"):InvokeServer(GData.API.doUnpack(move_model))
- if resultfld == -1 then
- error("failed model pickup", 2)
- return
- end
- for i = 1, #GData.T_SelectionMovingModels do
- table.remove(GData.T_SelectionMovingModels, 1)
- end
- for _, v in pairs(resultfld:GetChildren()) do
- GData.T_SelectionMovingModels[#GData.T_SelectionMovingModels + 1] = v.Value
- end
- return
- end
- if GData.DB_Server then
- return
- end
- GData.DB_Server = true
- if not move_model then
- GData.DB_Server = false
- return
- end
- local mod = move_model
- local n, rot = game.ReplicatedStorage.Calls.Cross.PickupStructure:InvokeServer(mod, true)
- if not move_model then
- GData.DB_Server = false
- return
- end
- GData.Assign_As_Cursor(move_model, (n or 1) - 1, rot)
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.CloseMenu:Invoke()
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
- GData.DB_Server = false
- end,
- Close = function()
- print("clos?")
- if GData.DB_Server then
- return
- end
- print("cloz.")
- GData.DB_Server = true
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.CloseMenu:Invoke()
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
- GData.DB_Server = false
- end,
- CFG = function(configure_model)
- if not configure_model then
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.CloseMenu:Invoke()
- return
- end
- if GData.DB_Server then
- return
- end
- GData.DB_Server = true
- if GData.O_ConfigureGUI and GData.O_ConfigureGUI.Parent then
- GData.O_ConfigureGUI:Destroy()
- GData.O_ConfigureGUI = nil
- end
- GData.O_ConfigureGUI = GData.ConfigAPI:Render(configure_model:FindFirstChild("CFG"))
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.CloseMenu:Invoke()
- game:GetService("GuiService").GuiNavigationEnabled = true
- GData.DB_Server = false
- end
- }
- GData.Loopable_API_Order = {
- GData.API.import("CFGFunctionsLoop", true),
- GData.API.import("LoopYields", true),
- GData.API.import("Multi-Select API", true),
- GData.API.import("TileEditorCode", true)
- }
- local SaveVisualization = GData.API.import("SaveModule", true)
- SaveVisualization.init()
- local InitVisibility = function(visible, ...)
- local gui = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("GameGUI")
- for _, Name in pairs({
- ...
- }) do
- gui[Name].Visible = visible
- end
- end
- InitVisibility(true, "HUD2", "HUD3", "HUD4", "Menu", "InvInfo")
- script.Parent.Enabled.Value = true
- _prFunction("LocalGetImages").OnInvoke = function()
- return GData.ItemDatabase
- end
- _prFunction("GetMenuIsOpen").OnInvoke = function()
- return GData.Menu_Open
- end
- function GData.API.RetrieveModelConfig(mod)
- local t = {}
- local c = 0
- if mod:FindFirstChild("CFG") then
- for _, cfg in pairs(mod.CFG:GetChildren()) do
- c = c + 1
- t[cfg.Name] = cfg.Value
- end
- else
- return
- end
- if c > 0 then
- return t
- end
- end
- function GData.API.CheckIsOwner(opt)
- if GData.OwnerCache[opt.Parent] == nil then
- GData.OwnerCache[opt.Parent] = game.ReplicatedStorage.Calls.Cross.Client.IsOwner:InvokeServer(opt.Parent)
- end
- return GData.OwnerCache[opt.Parent] or false
- end
- function GData.API.MenuIsOpenBool()
- local pgui = getLocalPlayer():WaitForChild("PlayerGui")
- return pgui:WaitForChild("MenuOpen")
- end
- function GData.API.GetMenu()
- local pgui = getLocalPlayer():WaitForChild("PlayerGui")
- return pgui:WaitForChild("GameGUI"):WaitForChild("Menu")
- end
- function GData.API.ShowMenu(menu)
- if menu:FindFirstChild("MenuSpecial") then
- local funcs = require(menu.MenuSpecial)
- if funcs.OnLoad then
- funcs.OnLoad()
- end
- end
- menu.Visible = true
- GData.Menu_Open = true
- table.insert(GData.Menus, menu)
- end
- function GData.API.HideMenu(menu)
- if not menu then
- return
- end
- if not GData.Menus[menu] then
- return
- end
- local window = GData.Menus[menu]
- table.remove(GData.Menus, menu)
- if #GData.Menus < 1 then
- GData.Menu_Open = false
- end
- if window.Visible then
- window.Visible = false
- end
- end
- function GData.API.HideMenus()
- for i = #GData.Menus, 1, -1 do
- local window = GData.Menus[i]
- GData.API.HideMenu(i)
- window.Visible = false
- end
- GData.Menu_Open = false
- end
- _prEvent("CloseAllMenus").Event:connect(function()
- GData.API.HideMenus()
- end)
- function GData.API.ToggleMenu(key)
- local _menu = GData.Keys[key]
- local mn = _menu.Name
- if _menu.Visible then
- GData.API.HideMenu(GData.API.FindMenu(_menu.Name))
- _menu.Visible = false
- if mn == "Menu3" then
- GData.API.GetMenu().Parent.HUD2.Visible = true
- GData.API.GetMenu().Parent.HUD3.Visible = true
- GData.API.GetMenu().Parent.HUD4.Visible = true
- end
- else
- GData.API.ShowMenu(_menu)
- _menu.Visible = true
- if mn == "Menu3" then
- GData.API.GetMenu().Parent.HUD2.Visible = false
- GData.API.GetMenu().Parent.HUD3.Visible = false
- GData.API.GetMenu().Parent.HUD4.Visible = false
- end
- end
- GData.API.FixMenus()
- end
- function GData.API.FindMenu(name)
- local picked
- for i, c in ipairs(GData.Menus) do
- if not picked and c.Name == name then
- picked = i
- end
- end
- return picked
- end
- function GData.API.FixMenus()
- local lb = GData.API.GetMenu().Parent.Labels
- local iinfo = GData.API.GetMenu().Parent.InvInfo
- if GData.Menus[1] and GData.Menus[2] and GData.Menus[3] then
- GData.Menus[1].Position = UDim2.new(0.05, 0, 0.35, 11)
- GData.Menus[1].Size = UDim2.new(0.4, 0, 0.6, 0)
- GData.Menus[2].Position = UDim2.new(0.55, 0, 0.35, 11)
- GData.Menus[2].Size = UDim2.new(0.4, 0, 0.6, 0)
- GData.Menus[3].Position = UDim2.new(2, 0, 0, 0)
- lb.Position = UDim2.new(0.55, -1, 0.95, 0)
- elseif GData.Menus[1] and GData.Menus[2] then
- GData.Menus[1].Position = UDim2.new(0.05, 0, 0.35, 11)
- GData.Menus[1].Size = UDim2.new(0.4, 0, 0.6, 0)
- GData.Menus[2].Position = UDim2.new(0.55, 0, 0.35, 11)
- GData.Menus[2].Size = UDim2.new(0.4, 0, 0.6, 0)
- lb.Position = UDim2.new(0.55, -1, 0.95, 0)
- elseif GData.Menus[1] then
- GData.Menus[1].Position = UDim2.new(0.3, 0, 0.35, 11)
- GData.Menus[1].Size = UDim2.new(0.4, 0, 0.6, 0)
- lb.Position = UDim2.new(1, -1, 0.8, -1)
- end
- GData.Menu_Open = #GData.Menus > 0
- end
- function GData.API.AddMenu(Key, Object)
- GData.Keys[Key] = Object
- Object.Changed:connect(function(property)
- if property == "Visible" and GData.API.FindMenu(Object) and not Object.Visible then
- GData.API.HideMenu(GData.API.FindMenu(Object))
- end
- end)
- end
- GData.API.AddMenu("E", GData.API.GetMenu():WaitForChild("Menu1", 1000000000))
- GData.API.AddMenu("F", GData.API.GetMenu():WaitForChild("Menu2", 1000000000))
- function GData.API.ClientRcon(action, ...)
- local args = {
- ...
- }
- if action == "new-menu" then
- local __menu = args[1]:Clone()
- __menu.Parent = GData.API.GetMenu()
- GData.API.AddMenu(__menu.Key.Value, __menu)
- if __menu.Name == "MenuTrade" then
- GData.API.HideMenus()
- GData.API.ShowMenu(GData.API.GetMenu().Menu1)
- GData.API.ShowMenu(GData.API.GetMenu().MenuTrade)
- end
- elseif action == "remove-menu" then
- local __menu = GData.Keys[args[1]]
- if __menu then
- GData.Keys[args[1]] = nil
- __menu.Parent = nil
- GData.API.FixMenus()
- end
- elseif action == "menu-active" then
- return GData.Keys[args[1]] ~= nil
- end
- end
- _crFunction("FRcon").OnClientInvoke = GData.API.ClientRcon
- _crEvent("Rcon").OnClientEvent:connect(GData.API.ClientRcon)
- _prEvent("Rcon").Event:connect(GData.API.ClientRcon)
- GData.O_InvHelpLabels = game.Players.LocalPlayer:WaitForChild("PlayerGui", 1000000000):WaitForChild("GameGUI", 1000000000).InvInfo
- function GData.API.ClearButtonLabels()
- for _, c in pairs(GData.O_InvHelpLabels:GetChildren()) do
- c:Destroy()
- end
- end
- function GData.API.NewButtonLabel(Button, Alias)
- local n = #GData.O_InvHelpLabels:GetChildren()
- local bt = GData.API.ButtonLabel()
- bt.Label.Text = Button
- if #Button > 1 then
- bt.Image = ""
- bt.BackgroundTransparency = 0
- bt.BorderSizePixel = 3
- bt.Info.Position = UDim2.new(1, 11, 0.5, 0)
- bt.Size = UDim2.new(0, 105, 0, 35)
- end
- bt.Info.Text = Alias:sub(1, 1):upper() .. Alias:sub(2)
- bt.Visible = false
- bt.Position = UDim2.new(0, 5, 1, -65 - 40 * (n - 1))
- bt.Parent = GData.O_InvHelpLabels
- anims:WindowFadeIn(bt, 0.1)
- return bt
- end
- local btlb
- function GData.API.ButtonLabel()
- if btlb then
- return btlb:Clone()
- else
- local btlb = Instance.new("ImageLabel")
- btlb.Name = "ButtonImage"
- btlb.Size = UDim2.new(0, 35, 0, 35)
- btlb.Image = "rbxassetid://2065496223"
- btlb.AnchorPoint = Vector2.new(0, 0.5)
- btlb.BackgroundTransparency = 1
- btlb.BackgroundColor3 = Color3.fromRGB(127, 127, 255)
- btlb.BorderColor3 = Color3.fromRGB(63.5, 63.5, 127)
- local btxt = Instance.new("TextLabel", btlb)
- btxt.Name = "Label"
- btxt.Position = UDim2.new(0.5, 0, 0.5, 0)
- btxt.Size = UDim2.new(0.8, 0, 0.8, 0)
- btxt.TextXAlignment = "Center"
- btxt.TextYAlignment = "Center"
- btxt.Text = "X"
- btxt.Font = "Bodoni"
- btxt.TextStrokeTransparency = 0
- btxt.TextScaled = true
- btxt.TextColor3 = Color3.fromRGB(255, 255, 255)
- btxt.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
- btxt.BackgroundTransparency = 1
- btxt.AnchorPoint = Vector2.new(0.5, 0.5)
- local btxt2 = Instance.new("TextLabel", btlb)
- btxt2.Name = "Info"
- btxt2.Position = UDim2.new(1, 6, 0.5, 0)
- btxt2.Size = UDim2.new(5, 0, 1, 0)
- btxt2.TextXAlignment = "Left"
- btxt2.TextYAlignment = "Center"
- btxt2.Text = "X - Pick up"
- btxt2.Font = "Bodoni"
- btxt2.TextSize = 33
- btxt2.TextColor3 = Color3.fromRGB(255, 255, 255)
- btxt2.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
- btxt2.TextStrokeTransparency = 0
- btxt2.BackgroundTransparency = 1
- btxt2.AnchorPoint = Vector2.new(0, 0.5)
- return btlb:Clone()
- end
- end
- function GData.API.ChangeInvInfoStatus(iskb, stat)
- if stat == GData.S_StatusInfo then
- return
- end
- local EmptyTable = {}
- GData.O_InvHelpLabels.Text = ""
- GData.S_StatusInfo = stat
- GData.API.ClearButtonLabels()
- local pull = iskb and "Keyboard" or "Gamepad"
- for name, kmap in pairs(GData.KeyBinds[pull][stat] or EmptyTable) do
- for alias in pairs(kmap) do
- GData.API.NewButtonLabel(alias, name)
- end
- end
- for name, kmap in pairs(GData.KeyBinds.MouseButton2[stat] or EmptyTable) do
- for alias in pairs(kmap) do
- GData.API.NewButtonLabel(alias, name)
- end
- end
- end
- function GData.API.AddSelection(model, sbox, pgui)
- sbox.Name = "Multi-Selection Box"
- GData.T_SelectionBoxes[model] = sbox
- sbox.Parent = pgui
- sbox.Adornee = model
- table.insert(GData.T_SelectionModels, model)
- return sbox
- end
- function GData.API.ClearSelection()
- for model, sbox in pairs(GData.T_SelectionBoxes) do
- sbox.Adornee = nil
- sbox:Destroy()
- GData.T_SelectionBoxes[model] = nil
- end
- for i = 1, #GData.T_SelectionModels do
- table.remove(GData.T_SelectionModels, 1)
- end
- end
- function GData.API.RemoveSelection(model)
- local sbox = GData.T_SelectionBoxes[model]
- if sbox then
- sbox.Adornee = nil
- sbox:Destroy()
- GData.T_SelectionBoxes[model] = nil
- end
- for i, obj in ipairs(GData.T_SelectionModels) do
- if obj == model then
- table.remove(GData.T_SelectionModels, i)
- end
- end
- end
- function GData.API.SelectionExists(model)
- for _, obj in pairs(GData.T_SelectionModels) do
- if obj == model then
- return obj
- end
- end
- end
- function GData.API.SpawnNode(position)
- local p1, p2 = Instance.new("Part", workspace.CurrentCamera), Instance.new("Part", workspace.CurrentCamera)
- local t = {
- p1,
- p2,
- true,
- 0,
- position
- }
- local n = #GData.T_Nodes + 1
- GData.T_Nodes[n] = t
- p1.Size, p2.Size = Vector3.new(0.05, 0.05, 0.05), Vector3.new(0.05, 0.05, 0.05)
- p1.Name, p2.Name = "NodeBase", "NodeBeam"
- p1.BrickColor, p2.BrickColor = BrickColor.new(104), BrickColor.new("Bright yellow")
- p1.Material, p2.Material = "Neon", "Neon"
- p1.Transparency, p2.Transparency = 0.5, 0.5
- p1.CFrame, p2.CFrame = CFrame.new(t[5]), CFrame.new(t[5])
- p1.CanCollide, p2.CanCollide = false, false
- local cm, cm2 = Instance.new("CylinderMesh", p2), Instance.new("CylinderMesh", p1)
- cm.Name, cm2.Name = "BeamMesh", "GlowRound"
- coroutine.wrap(function()
- local rs = game:GetService("RunService").RenderStepped
- while t[4] < 1 and t[3] do
- local xa = t[4] ^ 0.5
- p1.Size = Vector3.new(0.05 + xa * 1.5, 0.05, 0.05 + xa * 1.5)
- p2.Size = Vector3.new(0.05 + xa * 0.2, 0.05 + xa * 25, 0.05 + xa * 0.2)
- p1.CFrame, p2.CFrame = CFrame.new(t[5]), CFrame.new(t[5])
- t[4] = t[4] + rs:wait() * 3
- end
- if t[3] then
- local xa = 1
- p1.Size = Vector3.new(0.05 + xa * 1.5, 0.05, 0.05 + xa * 1.5)
- p2.Size = Vector3.new(0.05 + xa * 0.2, 0.05 + xa * 25, 0.05 + xa * 0.2)
- while t[3] do
- p1.CFrame, p2.CFrame = CFrame.new(t[5]), CFrame.new(t[5])
- rs:wait()
- end
- t[3] = false
- end
- end)()
- return n
- end
- function GData.API.VanishNode(n)
- local t = GData.T_Nodes[n]
- table.remove(GData.T_Nodes, n)
- local p1 = t[1]
- local p2 = t[2]
- local position = t[5]
- if not t then
- return
- end
- coroutine.wrap(function()
- local rs = game:GetService("RunService").RenderStepped
- t[3] = false
- while t[4] > 0 do
- local xa = t[4] ^ 0.5
- p1.Size = Vector3.new(0.05 + xa * 1.5, 0.05, 0.05 + xa * 1.5)
- p2.Size = Vector3.new(0.05 + xa * 0.2, 0.05 + xa * 25, 0.05 + xa * 0.2)
- p1.CFrame, p2.CFrame = CFrame.new(position), CFrame.new(position)
- t[4] = t[4] - rs:wait() * 4
- end
- p1:Destroy()
- p2:Destroy()
- end)()
- end
- function GData.API.VanishNodes()
- for i = #GData.T_Nodes, 1, -1 do
- if GData.T_Nodes[i] then
- GData.API.VanishNode(i)
- end
- wait()
- end
- end
- function GData.API.GetSelectedModels(pos1, pos2, selected_models)
- local selected_models = selected_models or {}
- local start_point = pos1
- local end_point = pos2 + Vector3.new(0, 125, 0)
- 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)))
- local parts = workspace:FindPartsInRegion3WithWhiteList(region, {
- workspace.Players[getLocalPlayer().Name].Tiles
- }, 5000)
- for _, part in pairs(parts) do
- local mod = part:FindFirstAncestorOfClass("Model")
- while mod and mod:FindFirstAncestorOfClass("Model") do
- mod = mod:FindFirstAncestorOfClass("Model")
- end
- if mod and mod:FindFirstChild("UnitOptions") and GData.API.CheckIsOwner(mod.UnitOptions) then
- selected_models[mod] = true
- end
- end
- return selected_models
- end
- function GData.API.CenterPoint(models)
- local pos = Vector3.new(0, 0, 0)
- for _, _model in pairs(models) do
- print(tostring(_model))
- if _model.PrimaryPart then
- pos = pos + _model.PrimaryPart.Position
- end
- end
- return pos / #models
- end
- function GData.API.doUnpack(models)
- local f = Instance.new("Folder", game.ReplicatedStorage.ClientReplications)
- f.Name = "Client Replication from " .. game.Players.LocalPlayer.Name
- for i = 1, #models do
- local v = Instance.new("ObjectValue", f)
- v.Value = models[i]
- v.Name = "Model Replication"
- end
- return f
- end
- local ibox
- function GData.API.IntermediateBox(pos1, pos3)
- 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)
- local cam = getLocalCamera()
- local m = cam:FindFirstChild("Box") or Instance.new("Model", cam)
- m.Name = "Box"
- if not ibox then
- ibox = Instance.new("Part")
- ibox.Size = Vector3.new(10, 0.1, 0.1)
- ibox.Material = "Slate"
- ibox.BrickColor = BrickColor.Blue()
- ibox.Anchored = true
- ibox.CanCollide = false
- end
- local square_size = (pos2 - pos1).magnitude
- local square_size2 = (pos2 - pos3).magnitude
- local ib1 = m:FindFirstChild("IBox 1") or ibox:Clone()
- ib1.Name = "IBox 1"
- ib1.Size = Vector3.new(0.1, 0.1, square_size)
- ib1.CFrame = CFrame.new((pos2 + pos1) / 2, pos2)
- ib1.Parent = m
- local ib2 = m:FindFirstChild("IBox 2") or ibox:Clone()
- ib2.Name = "IBox 2"
- ib2.Size = Vector3.new(0.1, 0.1, square_size2)
- ib2.CFrame = CFrame.new((pos2 + pos3) / 2, pos3)
- ib2.Parent = m
- local ib3 = m:FindFirstChild("IBox 3") or ibox:Clone()
- ib3.Name = "IBox 3"
- ib3.Size = Vector3.new(0.1, 0.1, square_size)
- ib3.CFrame = CFrame.new((pos3 + pos4) / 2, pos4)
- ib3.Parent = m
- local ib4 = m:FindFirstChild("IBox 4") or ibox:Clone()
- ib4.Name = "IBox 4"
- ib4.Size = Vector3.new(0.1, 0.1, square_size2)
- ib4.CFrame = CFrame.new((pos4 + pos1) / 2, pos1)
- ib4.Parent = m
- end
- function GData.API.IntermediateBox_Clear()
- local cam = getLocalCamera()
- local m = cam:FindFirstChild("Box")
- if m then
- m:Destroy()
- end
- end
- function GData.API.lockOnModel(m)
- if GData.Gamepad.Locked then
- return
- end
- if GData.InputType ~= "Gamepad" then
- return
- end
- local cam = getLocalCamera()
- cam.CameraType = "Scriptable"
- local size = math.max(m.PrimaryPart.Size.X, m.PrimaryPart.Size.Z)
- if math.abs(GData.Gamepad.Cursor_Turn.X) > 0.25 then
- GData.Gamepad.Rotation = GData.Gamepad.Rotation + GData.Gamepad.Cursor_Turn.X
- end
- if 0.25 < math.abs(GData.Gamepad.Cursor_Turn.Y) then
- GData.Gamepad.Zoom = clamp(GData.Gamepad.Zoom + GData.Gamepad.Cursor_Turn.Y / 2, 5, 25)
- end
- 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)
- end
- function GData.API.lockOffModel()
- if not getLocalPlayer().PlayerGui.GameStatus.ShowingTutorial.Value then
- local cam = getLocalCamera()
- cam.CameraType = "Custom"
- end
- end
- function GData.round(x)
- return x - math.floor(x) >= 0.5 and math.ceil(x) or math.floor(x)
- end
- function GData.limitDig(num, amnt)
- local x = 10 ^ amnt
- return GData.round(num * x) / x
- end
- function GData.generateExtension(num, i)
- local exts = {
- "",
- "k",
- "M",
- "B",
- "T",
- "Qd",
- "Qtn",
- "Sxt",
- "Sp",
- "Oc",
- "No",
- "De",
- "Und",
- "Dud",
- "Trd",
- "Qtd",
- "Qnd",
- "Sxtd",
- "Spd",
- "Octd",
- "Nod",
- "Vit",
- "Unvit",
- "Duvit",
- "Trvit",
- "Quvit",
- "Qnvit",
- "Sxvit",
- "Spvit",
- "Ocvit",
- "Novit",
- "Tgt",
- "Untgt",
- "Dutgt",
- "Trtgt",
- "Qutgt",
- "Qntgt",
- "Sxtgt",
- "Sptgt",
- "Octgt",
- "Notgt",
- "Qdt",
- "Unqdt",
- "Duqdt",
- "Trqdt",
- "Quqdt",
- "Qnqdt",
- "Sxqdt",
- "Spqdt",
- "Ocqdt",
- "Noqdt",
- "Qnt",
- "Unqnt",
- "Duqnt",
- "Trqnt",
- "Quqnt",
- "Qnqnt",
- "Sxqnt",
- "Spqnt",
- "Ocqnt",
- "Noqnt",
- "Sgt",
- "Unsgt",
- "Dusgt",
- "Trsgt",
- "Qusgt",
- "Qnsgt",
- "Sxsgt",
- "Spsgt",
- "Ocsgt",
- "Nosgt",
- "Spt",
- "Unspt",
- "Duspt",
- "Trspt",
- "Quspt",
- "Qnspt",
- "Sxspt",
- "Spspt",
- "Ocspt",
- "Nospt",
- "Ocg",
- "Unocg",
- "Duocg",
- "Trocg",
- "Quocg",
- "Qnocg",
- "Sxocg",
- "Spocg",
- "Ococg",
- "Noocg",
- "Ngt",
- "Unngt",
- "Dungt",
- "Trngt",
- "Qungt",
- "Qnngt",
- "Sxngt",
- "Spngt",
- "Ocngt",
- "Nongt",
- "CNT"
- }
- local i = i or 1
- if 1 <= num / 1000 and exts[i + 1] then
- num = num / 1000
- i = i + 1
- num, i = GData.generateExtension(num, i)
- end
- return num, i, exts[i]
- end
- function onr(r, c, v3)
- if r == c then
- return v3
- end
- end
- function GData.API.GetOffset(Size, r)
- 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)
- local a = Vector3.new(math.floor(Size.X + 0.5), math.floor(Size.Y + 0.5), math.floor(Size.Z + 0.5)) / 4
- local ax = a.X % (GData.Alignment.X / 2)
- local az = a.Z % (GData.Alignment.Z / 2)
- local pick
- if ax == 0 and az == 0 then
- pick = onr(r, 0, none) or onr(r, 90, none) or onr(r, 180, none) or onr(r, 270, none)
- return pick
- elseif ax == 0 and az == 1 then
- pick = onr(r, 0, none) or onr(r, 90, foo) or onr(r, 180, oof) or onr(r, 270, none)
- return pick
- elseif ax == 1 and az == 0 then
- pick = onr(r, 0, oof) or onr(r, 90, foo) or onr(r, 180, fof) or onr(r, 270, fof)
- return pick
- else
- pick = onr(r, 0, none) or onr(r, 90, foo) or onr(r, 180, fof) or onr(r, 270, oof)
- return pick
- end
- end
- function GData.GhostizeModel(x)
- for _, c in pairs(x:GetChildren()) do
- if (c:IsA("BasePart") or c:IsA("UnionOperation")) and not c:FindFirstChild("PuttyTransparency") and c.Name ~= "Upgrader" then
- local v = Instance.new("NumberValue", c)
- v.Name = "PuttyTransparency"
- v.Value = c.Transparency
- local v2 = Instance.new("BoolValue", c)
- v2.Name = "PuttyCollidable"
- v2.Value = c.CanCollide
- c.CanCollide = false
- if c.Name:find("Marker") == nil then
- c.Transparency = math.min(c.Transparency + 0.5, 1)
- end
- end
- if c.Name:find("Marker") == nil then
- GData.GhostizeModel(c)
- end
- end
- end
- function GData.UnghostizeModel(x)
- for _, c in pairs(x:GetChildren()) do
- if (c:IsA("BasePart") or c:IsA("UnionOperation")) and c:FindFirstChild("PuttyTransparency") then
- c.Transparency = c.PuttyTransparency.Value
- c.CanCollide = c.PuttyCollidable.Value
- c.PuttyTransparency:Destroy()
- c.PuttyCollidable:Destroy()
- end
- end
- end
- local count = 1
- local radialMenu = {
- {
- i = "rbxgameasset://Images/Pickup",
- f = function()
- GData.Actions.Upgrade(#GData.T_SelectionModels > 0 and GData.T_SelectionModels or GData.O_SelectionGUI)
- end,
- n = "upgrade"
- },
- {
- i = "rbxgameasset://Images/Pickup2",
- f = function()
- GData.Actions.Pickup(#GData.T_SelectionModels > 0 and GData.T_SelectionModels or GData.O_SelectionGUI)
- end,
- n = "Pick Up"
- },
- {
- i = "rbxgameasset://Images/Move",
- f = function()
- GData.Actions.Move(#GData.T_SelectionModels > 0 and GData.T_SelectionModels or GData.O_SelectionGUI)
- end,
- n = "Move"
- },
- {
- i = "rbxgameasset://Images/Close",
- f = function()
- GData.Actions.Close()
- end,
- n = "Close"
- }
- }
- GData.CFG = {
- i = "rbxgameasset://Images/CFG",
- f = function()
- GData.Actions.CFG(GData.O_SelectionGUI)
- end,
- n = "CFG"
- }
- local passive = {
- 0,
- 0,
- function(btn)
- if not GData.O_SelectionGUI then
- btn.Visible = false
- return
- end
- if GData.Upgrades[GData.O_SelectionGUI.Name] then
- local upgrade = GData.Upgrades[GData.O_SelectionGUI.Name]
- if upgrade.c == "Cash" then
- local num, _, ext = GData.generateExtension(upgrade.a)
- if ext ~= "" then
- btn.Text = "Upgrade: $" .. GData.limitDig(num, 2) .. " " .. ext
- else
- btn.Text = "Upgrade: $" .. GData.limitDig(num, 2)
- end
- end
- else
- end
- end,
- 0
- }
- getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("GameGUI").Menu.GetUpgrade.OnInvoke = function()
- if #GData.T_SelectionModels > 0 then
- local uamnt, ucount = 0, 0
- for _, c in pairs(GData.T_SelectionModels) do
- if GData.Upgrades[c.Name] then
- local upgrade = GData.Upgrades[c.Name]
- if upgrade.c == "Cash" then
- uamnt = uamnt + upgrade.a
- ucount = ucount + 1
- end
- end
- end
- if uamnt > 0 then
- local num, _, ext = GData.generateExtension(uamnt)
- local suffix = ucount > 1 and " models" or " model"
- if ext ~= "" then
- return "Upgrade " .. ucount .. suffix .. ": $" .. GData.limitDig(num, 2) .. " " .. ext
- else
- return "Upgrade " .. ucount .. suffix .. ": $" .. GData.limitDig(num, 2)
- end
- end
- return -1
- end
- if not GData.O_SelectionGUI then
- return -1
- end
- if GData.Upgrades[GData.O_SelectionGUI.Name] then
- local upgrade = GData.Upgrades[GData.O_SelectionGUI.Name]
- if upgrade.c == "Cash" then
- local num, _, ext = GData.generateExtension(upgrade.a)
- if ext ~= "" then
- return "Upgrade: $" .. GData.limitDig(num, 2) .. " " .. ext
- else
- return "Upgrade: $" .. GData.limitDig(num, 2)
- end
- end
- end
- return -1
- end
- function GData.getTiles(parts)
- local l = {}
- for _, part in pairs(parts) do
- if part.Parent:FindFirstChild("UnitOptions") and part.Parent:FindFirstChild("Stack") and part:FindFirstAncestor("Tiles") and not l[part.Parent] then
- l[part.Parent] = true
- end
- end
- return l
- end
- function GData.checkEmpty(ppart, checkpos)
- if not GData.Placement_Model then
- return false
- end
- GData.Placement_IsEmpty = false
- 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)
- local tr
- if GData.Placement_Model:FindFirstChild("OffsetSizeY") then
- 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)
- else
- 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)
- end
- bl, tr = bl.p, tr.p
- 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))
- local parts = workspace:FindPartsInRegion3WithIgnoreList(region, {
- workspace.CurrentCamera,
- GData.O_BaseModel.BasePlate,
- GData.O_BaseModel.BasePlate2,
- game.Players.LocalPlayer.Character
- })
- GData.Placement_IsEmpty = #parts == 0
- local ray = Ray.new(ppart.CFrame.p, Vector3.new(0, -20, 0))
- local testpart = workspace:FindPartOnRayWithIgnoreList(ray, {
- workspace.CurrentCamera,
- workspace.Players[getLocalPlayer().Name].Tiles,
- getLocalCharacter()
- })
- local moffset = Vector3.new(0, 0, 0)
- if testpart and testpart.Name == "Water" then
- GData.Placement_IsEmpty = false
- end
- local check = ppart.Position - (GData.AnchorPoint or GData.O_Anchor.Position)
- local XValid, ZValid = math.abs(check.X) <= 512, math.abs(check.Z) <= 512
- if XValid and ZValid then
- else
- GData.Placement_IsEmpty = false
- end
- if getLocalPlayer().PlayerGui:WaitForChild("DataLimit").Value >= 1 then
- GData.Placement_IsEmpty = false
- GData.TooMuchData = true
- else
- GData.TooMuchData = false
- end
- if not GData.Placement_IsEmpty then
- return GData.getTiles(parts)
- end
- end
- function GData.Do_Passive_Actions(buttons)
- for n, c in ipairs(passive) do
- if buttons and c ~= 0 then
- c(buttons[n])
- end
- end
- end
- function GData.Assign_As_Cursor(mod1, amnt, rot, isresource, isautomate)
- if GData.DB_Assign then
- return
- end
- GData.DB_Assign = true
- if GData.Placement_Model then
- GData.Placement_Model:Destroy()
- end
- GData.API.HideMenus()
- game:GetService("GuiService").GuiNavigationEnabled = false
- if type(mod1) == "string" then
- GData.Placement_Model = nil
- if isautomate then
- GData.S_Automate = mod1
- GData.S_Resource = nil
- else
- GData.S_Resource = mod1
- GData.S_Automate = nil
- end
- GData.Placement_Count = amnt
- local pgui = getLocalPlayer():WaitForChild("PlayerGui")
- local menuo = pgui:WaitForChild("MenuOpen")
- GData.O_Selection = nil
- GData.O_SelectionGUI = nil
- pgui:WaitForChild("GameGUI").RightClick.Visible = false
- if getLocalPlayer().PlayerGui.GameGUI.HUD.Position.Y.Offset < 1 then
- getLocalPlayer():WaitForChild("PlayerGui").GameGUI.HUD:TweenPosition(UDim2.new(1, -474, 0, 0), nil, nil, 0.2, true)
- end
- pgui:WaitForChild("GameGUI").Menu:TweenPosition(UDim2.new(0, 0, 0, 0), nil, nil, 0.25)
- menuo.Value = false
- game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("OtherMenu", false)
- delay(0.5, function()
- GData.DB_Assign = false
- end)
- return
- end
- if rot then
- GData.Rotation = rot
- end
- GData.Placement_Count = amnt
- local pgui = getLocalPlayer():WaitForChild("PlayerGui")
- local menuo = pgui:WaitForChild("MenuOpen")
- GData.O_Selection = nil
- GData.O_SelectionGUI = nil
- GData.S_Automate = nil
- pgui:WaitForChild("GameGUI").RightClick.Visible = false
- pgui:WaitForChild("GameGUI").Menu:TweenPosition(UDim2.new(0, 0, 0, 0), nil, nil, 0.25)
- if getLocalPlayer().PlayerGui.GameGUI.HUD.Position.Y.Offset < 1 then
- getLocalPlayer():WaitForChild("PlayerGui").GameGUI.HUD:TweenPosition(UDim2.new(1, -474, 0, 0), nil, nil, 0.2, true)
- end
- menuo.Value = false
- game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("OtherMenu", false)
- GData.Placement_Model = mod1
- delay(0.5, function()
- GData.DB_Assign = false
- end)
- end
- local functions = {
- function(_x, _y, menuo)
- if menuo.Value then
- return
- end
- print("move")
- GData.Actions.Move(#GData.T_SelectionModels > 0 and GData.T_SelectionModels or GData.O_SelectionGUI)
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.ForceClose:Invoke()
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
- end,
- function(_x, _y, menuo)
- if menuo.Value then
- return
- end
- print("pickup")
- GData.Actions.Pickup(#GData.T_SelectionModels > 0 and GData.T_SelectionModels or GData.O_SelectionGUI)
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.ForceClose:Invoke()
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
- end,
- function(btn, buttons, menuo)
- if menuo.Value then
- return
- end
- print("upgrade")
- GData.Actions.Upgrade(#GData.T_SelectionModels > 0 and GData.T_SelectionModels or GData.O_SelectionGUI)
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.ForceClose:Invoke()
- end,
- function(_x, _y, menuo)
- if menuo.Value then
- return
- end
- print("cloze")
- GData.Actions.Close()
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.ForceClose:Invoke()
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
- end
- }
- function GData.Check_Is_Pack(name)
- if name and name:find(" Pack") then
- print("Favorited pack")
- local l = name:find(" Pack")
- if not l then
- return true
- end
- if game.Players.LocalPlayer.PlayerGui.PackOpenGUI.PackControls.Visible or #game.Players.LocalPlayer.PlayerGui.PackOpenGUI.CardsBin:GetChildren() > 0 then
- return true
- end
- game.Players.LocalPlayer.PlayerGui.GameGUI.Menu:TweenPosition(UDim2.new(0, 0, 0, 0), nil, nil, 0.25)
- game.ReplicatedStorage.Calls.Cross.OpenPack:FireServer(name:sub(1, l - 1), name)
- return true
- end
- end
- do
- local favorites = {
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1
- }
- local inputs = {
- "One",
- "Two",
- "Three",
- "Four",
- "Five",
- "Six",
- "Seven",
- "Eight",
- "Nine",
- "Zero"
- }
- local finv = {}
- game.ReplicatedStorage.Calls.Parallel.Favorites.Update.Event:connect(function(json)
- finv = game.HttpService:JSONDecode(json)
- end)
- function game.ReplicatedStorage.Calls.Cross.Favorites.Load.OnClientInvoke(t)
- if type(t) == "string" then
- favorites = game.HttpService:JSONDecode(t)
- for i = 0, 10 do
- favorites[i] = favorites[i] or -1
- end
- end
- end
- function game.ReplicatedStorage.Calls.Cross.Favorites.AssignCursor.OnClientInvoke(name, num, isresource)
- if GData.Check_Is_Pack(name) then
- return
- end
- if isresource and name then
- game.ReplicatedStorage.Calls.Parallel.AssignCursor:Fire(name, num)
- return
- end
- if name then
- local structure = game.ReplicatedStorage.Calls.Cross.SpawnStructure:InvokeServer(name)
- if not structure then
- getLocalPlayer():WaitForChild("PlayerGui").Sounds.WoodThumpBad:Play()
- return -1
- end
- game.ReplicatedStorage.Calls.Parallel.AssignCursor:Fire(structure, num)
- else
- game.ReplicatedStorage.Calls.Parallel.AssignCursor:Fire()
- end
- end
- local s = game.ReplicatedStorage.Calls.Cross.Favorites.Load:InvokeServer()
- local fav = game.ReplicatedStorage.Calls.Parallel.Favorites
- local checkInput = function(var)
- return type(var) == "string"
- end
- function fav.Add.OnInvoke(name, target)
- if type(name) ~= "number" then
- warn("Invalid name!")
- return
- end
- if name < 1 or name > 10 then
- warn("Invalid name range!")
- return
- end
- if math.floor(name) ~= name then
- warn("Invalid name input!")
- return
- end
- if not checkInput(target) then
- warn("Invalid target!")
- return
- end
- if target == favorites[name] then
- favorites[name] = -1
- game.ReplicatedStorage.Calls.Cross.Favorites.Save:FireServer(game.HttpService:JSONEncode(favorites))
- return favorites
- end
- favorites[name] = target
- game.ReplicatedStorage.Calls.Cross.Favorites.Save:FireServer(game.HttpService:JSONEncode(favorites))
- return favorites
- end
- game:GetService("UserInputService").InputBegan:connect(function(K)
- if GData.O_ConfigureGUI and GData.O_ConfigureGUI.Parent then
- return
- end
- local s = pcall(function()
- if game:GetService("UserInputService"):GetFocusedTextBox() and game:GetService("UserInputService"):GetFocusedTextBox():IsFocused() then
- error("TestError", 2)
- end
- end)
- if not s then
- return
- end
- if GData.DB_Server then
- return
- end
- local pgui = getLocalPlayer():WaitForChild("PlayerGui")
- local menuo = pgui:WaitForChild("MenuOpen")
- local Key = K.KeyCode.Name
- local UType = K.UserInputType.Name
- if UType:find("Gamepad") and menuo.Value == false then
- if Key == "DPadRight" then
- UType = "Keyboard"
- Key = "Three"
- elseif Key == "DPadLeft" then
- UType = "Keyboard"
- Key = "One"
- elseif Key == "DPadUp" then
- UType = "Keyboard"
- Key = "Two"
- elseif Key == "DPadDown" then
- UType = "Keyboard"
- Key = "Four"
- end
- end
- if UType == "Keyboard" then
- local n = -1
- for i = 1, #inputs do
- if inputs[i] == Key then
- n = i
- end
- end
- local menuo = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("MenuOpen")
- if not menuo then
- return
- end
- if n ~= -1 and menuo.Value == false and favorites[n] ~= -1 then
- if GData.Check_Is_Pack(favorites[n]) then
- return
- end
- game.ReplicatedStorage.Calls.Cross.Favorites.AssignCursor:InvokeServer(favorites[n], n)
- end
- end
- end)
- end
- do
- local buttons = {}
- local tmp = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("GameGUI").RightClick:GetChildren()
- for _, c in ipairs(tmp) do
- if c:IsA("TextButton") then
- buttons[#buttons + 1] = c
- end
- end
- table.sort(buttons, function(n1, n2)
- return n1.Name < n2.Name
- end)
- for n, c in ipairs(buttons) do
- c.MouseButton1Click:connect(function()
- if GData.DB_Server then
- return
- end
- local menuo = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("MenuOpen")
- if not menuo then
- return
- end
- print("click!")
- GData.DB_Server = true
- functions[n](buttons[n], buttons, menuo)
- GData.DB_Server = false
- end)
- end
- end
- function GData.onMouse1_Down(buttons)
- GData.Placement_Successful = false
- buttons = buttons or GData.T_LastButtons
- GData.T_LastButtons = buttons
- local pl = game.Players.LocalPlayer
- local pgui = pl:WaitForChild("PlayerGui")
- if GData.DB_Click then
- return
- end
- GData.DB_Click = true
- local status = game.ReplicatedStorage.Calls.Parallel.GetStatus:Invoke("ShowingTutorial")
- if status then
- GData.DB_Click = false
- return
- end
- if GData.Placement_Model then
- coroutine.wrap(function()
- if not GData.Placement_Model then
- return
- end
- if not GData.Placement_Model.PrimaryPart then
- return
- end
- GData.checkEmpty(GData.Placement_Model.PrimaryPart)
- local sbox = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("SelectionBox")
- if GData.Placement_IsEmpty or GData.O_Podium and GData.O_Podium.CustomTile.Value == GData.Placement_Model.Name then
- local extradata = {}
- if GData.O_Podium then
- extradata.tile = GData.O_Podium
- end
- if GData.Placement_Model.PrimaryPart then
- local p = Instance.new("Part", workspace)
- p.Name = "LocalHitboxPlaceholder"
- p.Anchored = true
- p.CanCollide = false
- p.Transparency = 1
- p.Size = GData.Placement_Model.PrimaryPart.Size
- p.CFrame = GData.Placement_Model.PrimaryPart.CFrame
- game:GetService("Debris"):AddItem(p, 1)
- end
- 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)
- GData.Undo_ActionList[#GData.Undo_ActionList + 1] = modnew
- GData.O_Podium = nil
- if GData.Placement_Model then
- GData.checkEmpty(GData.Placement_Model.PrimaryPart)
- end
- getLocalPlayer():WaitForChild("PlayerGui").Sounds.WoodThumpPlace:Play()
- if workspace.Players[GData.O_LocalPlayer.Name].PlayerData.Difficulty.Value ~= "Sandbox" then
- GData.Placement_Count = GData.Placement_Count + 1
- end
- GData.Placement_Successful = true
- else
- getLocalPlayer():WaitForChild("PlayerGui").Sounds.WoodThumpBad:Play()
- if GData.TooMuchData then
- 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.}")
- end
- end
- require(GData.API.GetMenu():WaitForChild("Interface Rendering", 1000000000):WaitForChild("ClientMods").CrossCode)().UpdateFavorites()
- end)()
- GData.DB_Click = false
- return
- end
- 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
- local ev = GData.O_ButtonClick.Parent.UnitOptions:FindFirstChild("Deposit")
- if ev then
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").InputAmount.IDBox.Text = "How many to deposit?"
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").InputAmount.Ready.Value = false
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").InputAmount.Visible = true
- while getLocalPlayer().PlayerGui:WaitForChild("GameGUI").InputAmount.Ready.Value ~= true do
- wait()
- end
- local num = tonumber(getLocalPlayer().PlayerGui:WaitForChild("GameGUI").InputAmount.IDBox.Text)
- if num then
- ev:FireServer(GData.S_Resource, num)
- GData.S_Resource = nil
- removeCorner()
- else
- GData.S_Resource = nil
- removeCorner()
- end
- end
- elseif GData.O_ButtonClick and GData.O_ButtonClick.Name == "DropperDrop" and GData.KeyboardShift_Down then
- game.ReplicatedStorage.Calls.Cross.RemoveDrop:FireServer(GData.O_ButtonClick)
- GData.O_ButtonClick = nil
- elseif GData.O_ButtonClick and GData.O_ButtonClick.Name == "UnitOptions" and not GData.S_Resource then
- local ev = GData.O_ButtonClick:FindFirstChild("Quick")
- if GData.KeyboardShift_Down and ev and ev:FindFirstChild("Activate") and ev:FindFirstChild("ActiveFire") then
- ev.ActiveFire:FireServer("activate")
- GData.DontMBU = true
- end
- 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
- if GData.O_ButtonClick.Parent == nil then
- warn("Cant remote an invalid model.")
- end
- local ev = GData.O_ButtonClick.Parent.UnitOptions:FindFirstChild("Remote") or Instance.new("RemoteEvent", GData.O_ButtonClick.Parent.UnitOptions)
- ev.Name = "Remote"
- ev:FireServer()
- GData.DontMBU = true
- end
- GData.DB_Click = false
- end
- function GData.On_Select()
- local buttons = GData.T_LastButtons
- GData.T_LastButtons = buttons
- local pl = game.Players.LocalPlayer
- local pgui = pl:WaitForChild("PlayerGui")
- GData.O_SelectionGUI = GData.O_Selection
- GData.O_Selection = nil
- local opt = GData.O_SelectionGUI:FindFirstChild("UnitOptions")
- 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
- if not GData.O_SelectionGUI then
- GData.DB_Click = false
- return
- end
- game.ReplicatedStorage.Calls.Cross.PickupStructure:InvokeServer(GData.O_SelectionGUI, true)
- if not GData.O_SelectionGUI then
- GData.DB_Click = false
- return
- end
- GData.O_SelectionGUI:Destroy()
- GData.O_SelectionGUI = nil
- if getLocalPlayer().PlayerGui.GameGUI.HUD.Position.Y.Offset < 1 then
- getLocalPlayer():WaitForChild("PlayerGui").GameGUI.HUD:TweenPosition(UDim2.new(1, -474, 0, 0), nil, nil, 0.2, true)
- end
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.ForceClose:Invoke()
- getLocalPlayer().PlayerGui:WaitForChild("Sounds").Click:Play()
- GData.O_SelectionGUI = nil
- GData.DB_Server = false
- GData.DB_Click = false
- return
- end
- local clamp = function(n, bottom, top)
- return math.min(top, math.max(bottom, n))
- end
- local gui = pgui:WaitForChild("GameGUI").AbsoluteSize
- local windowx, windowy = gui.X, gui.Y
- local posx, posy = clamp(GData.O_Mouse.X + 40, 0, windowx - 330), clamp(GData.O_Mouse.Y, 120, windowy - 300 + 120)
- local pmaxx, pminy = windowx - 175 - 474, 320
- if posx > pmaxx and posy < pminy then
- getLocalPlayer():WaitForChild("PlayerGui").GameGUI.HUD:TweenPosition(UDim2.new(1, -474, 0, -260), nil, nil, 0.2, true)
- else
- getLocalPlayer():WaitForChild("PlayerGui").GameGUI.HUD:TweenPosition(UDim2.new(1, -474, 0, 0), nil, nil, 0.2, true)
- end
- pgui:WaitForChild("GameGUI").RightClick.Position = UDim2.new(0, posx, 0, posy)
- getLocalPlayer():WaitForChild("PlayerGui").Sounds.Click:Play()
- if not pgui:WaitForChild("GameGUI").RightClick.Visible then
- buttons = pgui:WaitForChild("GameGUI").RightClick:GetChildren()
- table.sort(buttons, function(n1, n2)
- return n1.Name < n2.Name
- end)
- GData.Do_Passive_Actions(buttons)
- end
- pgui:WaitForChild("GameGUI").RightClick.Visible = true
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.ForceClose:Invoke()
- game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("OtherMenu", true)
- 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)
- if _tab then
- GData.LastMenuCount = #_tab
- end
- end
- function GData.onMouse1_Up(buttons)
- buttons = buttons or GData.T_LastButtons
- GData.T_LastButtons = buttons
- local pl = game.Players.LocalPlayer
- local pgui = pl:WaitForChild("PlayerGui")
- if GData.DB_Click then
- return
- end
- GData.DB_Click = true
- local status = game.ReplicatedStorage.Calls.Parallel.GetStatus:Invoke("ShowingTutorial")
- if status then
- GData.DB_Click = false
- return
- end
- 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
- GData.Placement_Model:Destroy()
- GData.Placement_Model = nil
- removeCorner()
- elseif GData.O_ButtonClick and GData.S_Automate then
- if GData.O_ButtonClick.Parent:FindFirstChild("ConnectionMod") and GData.O_ButtonClick.Parent.ConnectionMod:FindFirstChild("ListPulse") then
- GData.O_ButtonClick.Parent.ConnectionMod.ListPulse:FireServer(GData.S_Automate, GData.Placement_Count)
- end
- GData.S_Automate = nil
- GData.O_ButtonClick = nil
- elseif GData.O_Selection and GData.O_ButtonClick == nil and GData.S_Automate == nil then
- GData.On_Select()
- end
- local fn = require(GData.API.GetMenu():WaitForChild("Interface Rendering", 1000000000):WaitForChild("ClientMods").CrossCode)()
- if fn.UpdateFavorites then
- fn.UpdateFavorites()
- end
- GData.DontMBU = false
- GData.DB_Click = false
- GData.DB_Server = false
- end
- game:GetService("UserInputService").InputBegan:connect(function(K)
- if GData.O_ConfigureGUI and GData.O_ConfigureGUI.Parent then
- return
- end
- local s = pcall(function()
- if game:GetService("UserInputService"):GetFocusedTextBox() and game:GetService("UserInputService"):GetFocusedTextBox():IsFocused() then
- error("TestError", 2)
- end
- end)
- if not s then
- return
- end
- if GData.DB_Server then
- return
- end
- local key = K.KeyCode.Name
- local UType = K.UserInputType.Name
- local pl = game.Players.LocalPlayer
- local pgui = pl:WaitForChild("PlayerGui")
- local buttons
- if pgui:WaitForChild("GameGUI").RightClick.Visible then
- buttons = {}
- local tmp = pgui:WaitForChild("GameGUI").RightClick:GetChildren()
- for _, c in ipairs(tmp) do
- if c:IsA("TextButton") then
- buttons[#buttons + 1] = c
- end
- end
- table.sort(buttons, function(n1, n2)
- return n1.Name < n2.Name
- end)
- end
- if UType == "Keyboard" or UType:find("Mouse") then
- GData.InputType = "Keyboard"
- end
- if UType:find("Gamepad") then
- GData.InputType = "Gamepad"
- if key == "ButtonR2" then
- key = "MouseButton1"
- UType = "MouseButton1"
- end
- if key == "ButtonL2" then
- if not pgui:WaitForChild("GameGUI").RightClick.Visible then
- GData.Gamepad.Locked = true
- end
- key = "LeftShift"
- UType = "Keyboard"
- local pgui = getLocalPlayer():WaitForChild("PlayerGui")
- local menuo = pgui:WaitForChild("MenuOpen")
- if menuo.Value then
- key = "E"
- end
- end
- if pgui:WaitForChild("GameGUI").RightClick.Visible then
- if key == "ButtonA" then
- key = "Z"
- UType = "Keyboard"
- elseif key == "ButtonB" then
- key = "X"
- UType = "Keyboard"
- elseif key == "ButtonX" then
- key = "C"
- UType = "Keyboard"
- elseif key == "ButtonY" then
- key = "V"
- UType = "Keyboard"
- elseif key == "ButtonSelect" then
- key = "CFG"
- UType = "Keyboard"
- end
- else
- local pgui = getLocalPlayer():WaitForChild("PlayerGui")
- local menuo = pgui:WaitForChild("MenuOpen")
- if key == "ButtonY" and menuo.Value == false then
- key = "E"
- UType = "Keyboard"
- elseif key == "ButtonL1" then
- key = "E"
- UType = "Keyboard"
- elseif key == "ButtonR1" then
- key = "F"
- UType = "Keyboard"
- elseif key == "ButtonX" then
- key = "R"
- UType = "Keyboard"
- elseif key == "ButtonB" then
- key = "Q"
- UType = "Keyboard"
- end
- end
- end
- if UType == "Keyboard" then
- if pgui:WaitForChild("GameGUI").RightClick.Visible then
- local menuo = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("MenuOpen")
- if not menuo then
- return
- end
- for n, c in ipairs(buttons) do
- if key == buttons[n].Shortcut.Text then
- if GData.DB_Server then
- return
- end
- functions[n](buttons[n], buttons, menuo)
- GData.DB_Server = false
- end
- end
- if key == "CFG" and GData.LastMenuCount > 4 then
- if GData.DB_Server then
- return
- end
- print("do!")
- GData.DB_Server = true
- GData.CFG.f()
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.ForceClose:Invoke()
- game:GetService("GuiService").GuiNavigationEnabled = true
- GData.DB_Server = false
- end
- end
- if key:find("Shift") then
- local char = getLocalCharacter()
- local hum = char:WaitForChild("Humanoid")
- hum.WalkSpeed = 32
- GData.KeyboardShift_Down = true
- end
- if key == "R" and GData.Placement_Model and GData.AnchorPoint == nil then
- if GData.KeyboardShift_Down then
- GData.Rotation = (GData.Rotation + 90) % 360
- else
- GData.Rotation = (GData.Rotation - 90) % 360
- end
- end
- if GData.Keys[key] and not GData.Placement_Model and not game.ReplicatedStorage.Calls.Parallel.GetStatus:Invoke("ShowingTutorial") then
- GData.API.GetMenu().Position = UDim2.new(0, 0, 0, 0)
- local menuo = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("MenuOpen")
- if not menuo then
- return
- end
- if GData.S_Resource or GData.S_Automate then
- return
- end
- if 1 > #getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("GameGUI").Window:GetChildren() then
- GData.API.ToggleMenu(key)
- end
- end
- if key == "F" and GData.Placement_Model then
- local undmod = GData.Undo_ActionList[#GData.Undo_ActionList]
- local modn = ""
- if undmod and undmod.Parent then
- modn = undmod.Name
- game.ReplicatedStorage.Calls.Cross.PickupStructure:InvokeServer(undmod, true)
- end
- if GData.Placement_Model and modn == GData.Placement_Model.Name then
- local n = _crFunction("ItemCount"):InvokeServer(GData.Placement_Model.Name)
- if n then
- GData.Placement_Count = n
- end
- end
- table.remove(GData.Undo_ActionList, #GData.Undo_ActionList)
- end
- if key == "Q" and (GData.Placement_Model or GData.S_Resource or GData.S_Automate or 0 < #GData.T_SelectionMovingModels) then
- if GData.Placement_Model then
- GData.Placement_Model:Destroy()
- end
- GData.Placement_Model = nil
- for index, model in ipairs(GData.T_SelectionMovingModels) do
- model:Destroy()
- GData.T_SelectionMovingModels[index] = nil
- end
- GData.S_Resource = nil
- GData.S_Automate = nil
- do
- local assignview = getLocalPlayer().PlayerGui:WaitForChild("GameGUI"):FindFirstChild("AssignView")
- if assignview then
- assignview:TweenPosition(UDim2.new(1, 10, 1, 10), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.5)
- delay(0.5, function()
- assignview:Destroy()
- end)
- end
- require(GData.API.GetMenu():WaitForChild("Interface Rendering", 1000000000):WaitForChild("ClientMods").CrossCode)().UpdateFavorites()
- end
- end
- end
- if UType:find("MouseButton2") then
- if getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible then
- GData.O_SelectionGUI = nil
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = false
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.ForceClose:Invoke()
- if 1 > getLocalPlayer().PlayerGui.GameGUI.HUD.Position.Y.Offset then
- getLocalPlayer():WaitForChild("PlayerGui").GameGUI.HUD:TweenPosition(UDim2.new(1, -474, 0, 0), nil, nil, 0.2, true)
- end
- else
- GData.Gamepad.Locked = true
- end
- end
- if UType:find("MouseButton1") and GData.Menu_Open == false then
- GData.onMouse1_Down()
- GData.MouseButton1_Down = true
- end
- end)
- game:GetService("UserInputService").InputEnded:connect(function(K)
- local s = pcall(function()
- if game:GetService("UserInputService"):GetFocusedTextBox() and game:GetService("UserInputService"):GetFocusedTextBox():IsFocused() then
- error("TestError", 2)
- end
- end)
- if not s then
- return
- end
- local key = K.KeyCode.Name
- local UType = K.UserInputType.Name
- if UType:find("Gamepad") then
- GData.InputType = "Gamepad"
- if key == "ButtonL2" then
- GData.Gamepad.Locked = false
- key = "LeftShift"
- UType = "Keyboard"
- end
- end
- if UType == "Keyboard" and key:find("Shift") then
- local char = getLocalCharacter()
- local hum = char:WaitForChild("Humanoid")
- hum.WalkSpeed = 16
- GData.KeyboardShift_Down = false
- end
- if UType:find("MouseButton2") then
- GData.Gamepad.Locked = false
- end
- if UType:find("Gamepad") then
- GData.InputType = "Gamepad"
- if key == "ButtonR2" then
- key = "MouseButton1"
- UType = "MouseButton1"
- end
- end
- if UType:find("MouseButton1") then
- if GData.Skip_MBUFunction == false then
- GData.onMouse1_Up()
- end
- GData.Skip_MBUFunction = false
- GData.MouseButton1_Down = false
- end
- end)
- game.ReplicatedStorage.Calls.Parallel.AssignCursor.Event:connect(GData.Assign_As_Cursor)
- coroutine.wrap(function()
- while wait() and playing() do
- local pgui = getLocalPlayer():WaitForChild("PlayerGui")
- if GData.O_SelectionGUI then
- pgui.ItemName.Value = GData.O_SelectionGUI.Name
- if GData.Upgrades[GData.O_SelectionGUI.Name] then
- pgui.UpgradedName.Value = GData.Upgrades[GData.O_SelectionGUI.Name].n
- else
- pgui.UpgradedName.Value = ""
- end
- else
- pgui.ItemName.Value = ""
- pgui.UpgradedName.Value = ""
- end
- if pgui:FindFirstChild("IntroGUI") and pgui.IntroGUI.FadeGUI.BackgroundTransparency > 0.99 then
- pgui.IntroGUI:Destroy()
- end
- end
- end)()
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.CloseMenu.OnInvoke = function()
- GData.O_SelectionGUI = nil
- end
- function GData.Update_MenuOpen_Status()
- if GData.API.MenuIsOpenBool().Value then
- local shopopen = GData.API.GetMenu().Menu2.Visible
- local invopen = GData.API.GetMenu().Menu1.Visible
- game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("Shop", shopopen)
- game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("Inventory", invopen)
- else
- game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("Shop", false)
- game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("Inventory", false)
- end
- end
- function GData.UndoSSelectionHitbox(sbox)
- GData.O_ButtonClick = nil
- GData.O_Selection = nil
- sbox.Transparency = 0
- sbox.Adornee = nil
- local mousetip = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("MouseTooltip")
- mousetip.Visible = false
- end
- GData.Multi_Invocation_Cache = {}
- function GData.Update_MHighlightTip(Title, Tier, TierTextColor, ShowQuick, Emblem, InfoBoxText, UniformFontInfoBox)
- local mousetip = getLocalPlayer():WaitForChild("PlayerGui", 1000000000):WaitForChild("GameGUI", 1000000000):WaitForChild("MouseTooltip", 1000000000)
- if mousetip then
- if not Title then
- mousetip.Visible = false
- return
- end
- mousetip.Visible = true
- mousetip.Title.Text = Title
- mousetip.Tier.Visible = Tier ~= nil
- mousetip.Tier.Text = Tier or ""
- mousetip.Tier.Thumbnail.Visible = Emblem ~= nil
- mousetip.Tier.Thumbnail.Image = Emblem or ""
- mousetip.Tier.TextColor3 = TierTextColor or Color3.new(1, 1, 1)
- mousetip.Quick.Visible = ShowQuick ~= nil and ShowQuick ~= false
- mousetip.Quick.Text = ShowQuick or ""
- mousetip.Position = UDim2.new(0, GData.O_Mouse.X, 0, GData.O_Mouse.Y)
- mousetip.Extra.Visible = InfoBoxText ~= nil
- mousetip.Help.Visible = not mousetip.Extra.Visible
- mousetip.Extra.Text = InfoBoxText or ""
- mousetip.Extra.Size = UDim2.new(0, mousetip.Extra.TextBounds.X, 0, mousetip.Extra.TextBounds.Y)
- if UniformFontInfoBox then
- mousetip.Extra.Font = Enum.Font.Code
- mousetip.Extra.TextSize = 16
- else
- mousetip.Extra.Font = Enum.Font.Bodoni
- mousetip.Extra.TextSize = 18
- end
- end
- end
- local Click_Blacklist = {
- MusicBox = true,
- Water = true,
- Screen = true
- }
- function GData.Activate_MHighlightTip()
- local sbox = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("SelectionBox")
- local mouseRay = Ray.new(GData.O_Mouse.UnitRay.Origin, GData.O_Mouse.UnitRay.Direction * 500)
- local targ, intersection = workspace:FindPartOnRayWithIgnoreList(mouseRay, {
- workspace.CurrentCamera,
- getLocalCharacter()
- })
- local status = game.ReplicatedStorage.Calls.Parallel.GetStatus:Invoke("ShowingTutorial")
- local diff = intersection - (GData.AnchorPoint or GData.O_Anchor.Position)
- local XValid, ZValid = math.abs(diff.X) <= 512, 512 >= math.abs(diff.Z)
- if not status then
- if targ and targ.Parent then
- if Click_Blacklist[targ.Name] then
- GData.UndoSSelectionHitbox(sbox)
- GData.Update_MHighlightTip()
- return
- end
- if targ:IsDescendantOf(workspace.Players[getLocalPlayer().Name].Tiles) then
- local UnitOptions = targ.Parent:FindFirstChild("UnitOptions") or targ.Parent.Parent:FindFirstChild("UnitOptions") or targ.Parent.Parent.Parent:FindFirstChild("UnitOptions")
- if UnitOptions and GData.API.CheckIsOwner(UnitOptions) then
- if GData.S_Automate then
- if targ.Parent:FindFirstChild("btnAutomate") then
- end
- elseif GData.S_Resource == nil and UnitOptions:FindFirstChild("Quick") and UnitOptions.Quick:FindFirstChild("Activate") then
- local Action, Action2 = UnitOptions.Quick:FindFirstChild("Activate"), UnitOptions.Quick:FindFirstChild("ActiveFire")
- local qa = GData.Multi_Invocation_Cache[Action] or Action:InvokeServer("get-qa")
- GData.Multi_Invocation_Cache[Action] = qa
- GData.O_ButtonClick = UnitOptions
- sbox.Color3 = UnitOptions.Parent.PrimaryPart.BrickColor.Color
- sbox.Transparency = 0.5
- sbox.Adornee = UnitOptions.Parent
- GData.Update_MHighlightTip("Quick Action", "Hold shift and click to activate!", nil, GData.KeyboardShift_Down and "Quick: Button" or "Quick Action Available [Hold RUN]")
- 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
- GData.O_ButtonClick = UnitOptions.Parent[UnitOptions.Manual.Value]
- sbox.Color3 = UnitOptions.Parent[UnitOptions.Manual.Value].BrickColor.Color
- sbox.Transparency = 0.5
- sbox.Adornee = UnitOptions.Parent[UnitOptions.Manual.Value]
- GData.Update_MHighlightTip("Button", "Click to activate!", nil, GData.KeyboardShift_Down and "Quick: Button" or "Quick Action Available [Hold RUN]")
- elseif UnitOptions.Parent:FindFirstChild("Unselectable") == nil then
- GData.O_ButtonClick = nil
- GData.O_Selection = UnitOptions.Parent
- sbox.Transparency = 0.5
- sbox.Adornee = UnitOptions.Parent
- local aliases = require(game.ReplicatedStorage.GUILibrary.Aliases)
- local image, tier, tierimage = GData.ItemDatabase.Stone, GData.T_TierData[1], GData.T_TierImages[1]
- if GData.ItemDatabase[UnitOptions.Parent.Name] then
- image = GData.ItemDatabase[UnitOptions.Parent.Name]
- tier = GData.T_TierData[GData.ItemDatabase[UnitOptions.Parent.Name].l or 1]
- tierimage = GData.T_TierImages[GData.ItemDatabase[UnitOptions.Parent.Name].l or 1]
- end
- sbox.Color3 = GData.KeyboardShift_Down and Color3.new(1, 0.4, 0.4) or Color3.new(0.6, 0.6, 0.6)
- 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)
- end
- elseif targ.Name == "DropperDrop" and targ:FindFirstChild("DropData") then
- local dvalue, _, ext = GData.generateExtension(targ.DropData.DropValue.Value)
- dvalue = math.floor(dvalue * 100 + 0.5) / 100
- if targ:FindFirstChild("rdeb") then
- 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)
- else
- local DisplayTip = "Drop Value: $" .. dvalue .. ext .. string.format("\n")
- local tmp = targ.DropData.DropValue.Value
- if targ:FindFirstChild("Ore") then
- DisplayTip = DisplayTip .. "Ore Entry: " .. targ.Ore.Value .. string.format("\n")
- end
- 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")
- GData.Update_MHighlightTip("Dropper Drop", nil, nil, GData.KeyboardShift_Down and "Quick: Delete" or "Quick Action Available [Hold RUN]", nil, DisplayTip, true)
- end
- else
- GData.UndoSSelectionHitbox(sbox)
- GData.Update_MHighlightTip()
- end
- elseif targ.Parent and targ.Parent.Parent and targ.Parent.Parent.Parent then
- local UnitOptions = targ.Parent:FindFirstChild("UnitOptions") or targ.Parent.Parent:FindFirstChild("UnitOptions") or targ.Parent.Parent.Parent:FindFirstChild("UnitOptions")
- if UnitOptions then
- else
- GData.UndoSSelectionHitbox(sbox)
- GData.Update_MHighlightTip()
- end
- end
- else
- GData.UndoSSelectionHitbox(sbox)
- GData.Update_MHighlightTip()
- end
- else
- GData.UndoSSelectionHitbox(sbox)
- GData.Update_MHighlightTip()
- end
- do return end
- if not status and targ and targ.Parent and targ.Parent ~= workspace and targ.Name ~= "MusicBox" and targ.Name ~= "Water" then
- local opt = targ.Parent:FindFirstChild("UnitOptions") or targ.Parent.Parent:FindFirstChild("UnitOptions") or targ.Parent.Parent.Parent:FindFirstChild("UnitOptions")
- local mousetip = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("MouseTooltip")
- if GData.S_Automate then
- if targ and targ.Parent:FindFirstChild("btnAutomate") then
- if (opt.Parent:FindFirstChild("Screen") or targ:FindFirstChild("OwnerOnly")) and not GData.API.CheckIsOwner(opt) then
- return
- end
- if GData.KeyboardShift_Down then
- mousetip.Quick.Text = "Quick: Pulse Automate Button"
- mousetip.Quick.Visible = true
- else
- mousetip.Quick.Visible = false
- end
- GData.O_ButtonClick = targ.Parent.btnAutomate
- sbox.Color3 = targ.Parent.btnAutomate.BrickColor.Color
- sbox.Transparency = 0.5
- sbox.Adornee = targ.Parent.btnAutomate
- mousetip.Title.Text = "Send Pulse"
- mousetip.Tier.Text = "Click to send!"
- mousetip.Tier.Position = UDim2.new(0, 20, 0, 38)
- mousetip.Tier.TextColor3 = targ.Parent.btnAutomate.Color
- mousetip.Tier.Thumbnail.Visible = false
- mousetip.Extra.Visible = false
- mousetip.Visible = true
- mousetip.Position = UDim2.new(0, GData.O_Mouse.X, 0, GData.O_Mouse.Y)
- else
- GData.O_ButtonClick = nil
- GData.O_Selection = nil
- sbox.Transparency = 0
- sbox.Adornee = nil
- mousetip.Visible = false
- mousetip.Help.Visible = false
- end
- return
- elseif targ.Name == "DropperDrop" and targ:FindFirstChild("DropData") then
- if GData.S_Resource ~= nil then
- return
- end
- if GData.S_Automate then
- return
- end
- if GData.KeyboardShift_Down then
- mousetip.Quick.Text = "Quick: Delete"
- mousetip.Quick.Visible = true
- mousetip.Help.Visible = false
- mousetip.Extra.Visible = true
- else
- mousetip.Quick.Visible = false
- mousetip.Help.Visible = true
- mousetip.Extra.Visible = false
- end
- GData.O_ButtonClick = targ
- sbox.Color3 = targ.Color
- sbox.Transparency = 0.5
- sbox.Adornee = targ
- mousetip.Tier.Text = ""
- mousetip.Tier.Position = UDim2.new(0, 20, 0, 38)
- mousetip.Tier.TextColor3 = Color3.new(1, 1, 1)
- mousetip.Tier.Thumbnail.Visible = false
- mousetip.Visible = true
- mousetip.Position = UDim2.new(0, GData.O_Mouse.X, 0, GData.O_Mouse.Y)
- mousetip.Extra.TextSize = 16
- local dvalue, _, ext = GData.generateExtension(targ.DropData.DropValue.Value)
- dvalue = math.floor(dvalue * 100 + 0.5) / 100
- if targ:FindFirstChild("rdeb") then
- mousetip.Title.Text = "Depot Drop"
- mousetip.Extra.Text = "Resource Value: " .. dvalue .. " " .. ext
- mousetip.Extra.Text = mousetip.Extra.Text .. string.format("\n")
- mousetip.Extra.Text = mousetip.Extra.Text .. "Resource: " .. targ.rdeb.Value
- else
- mousetip.Title.Text = "Dropper Drop"
- mousetip.Extra.Text = "Drop Value: $" .. dvalue .. ext
- mousetip.Extra.Text = mousetip.Extra.Text .. string.format("\n")
- local tmp = targ.DropData.DropValue.Value
- if targ:FindFirstChild("Ore") then
- mousetip.Extra.Text = mousetip.Extra.Text .. "Ore Entry: " .. targ.Ore.Value .. string.format("\n")
- end
- mousetip.Extra.Text = mousetip.Extra.Text .. "Advanced: " .. (tmp >= 1.0E57 and "Yes" or "No") .. string.format("\n")
- mousetip.Extra.Text = mousetip.Extra.Text .. "Entropic: " .. (tmp >= 1.0E127 and "Yes" or "No") .. string.format("\n")
- mousetip.Extra.Text = mousetip.Extra.Text .. "Chaotic: " .. (tmp >= 1.0E303 and "Yes" or "No")
- end
- mousetip.Extra.Size = UDim2.new(0, mousetip.Extra.TextBounds.X, 0, mousetip.Extra.TextBounds.Y)
- elseif GData.KeyboardShift_Down and opt and opt:FindFirstChild("Quick") and opt.Quick:FindFirstChild("Activate") then
- local act, act2 = opt.Quick:FindFirstChild("Activate"), opt.Quick:FindFirstChild("ActiveFire")
- if GData.S_Resource ~= nil and not GData.API.CheckIsOwner(opt) then
- return
- end
- local qa = GData.Multi_Invocation_Cache[act] or act:InvokeServer("get-qa")
- GData.Multi_Invocation_Cache[act] = qa
- if GData.KeyboardShift_Down then
- mousetip.Quick.Text = "Quick: Button"
- mousetip.Quick.Visible = true
- else
- mousetip.Quick.Text = "Quick Action Available [Hold RUN]"
- mousetip.Quick.Visible = true
- end
- GData.O_ButtonClick = opt
- sbox.Color3 = opt.Parent.PrimaryPart.BrickColor.Color
- sbox.Transparency = 0.5
- sbox.Adornee = opt.Parent
- mousetip.Title.Text = "Quick Action"
- mousetip.Tier.Text = "Click to activate!"
- mousetip.Tier.Position = UDim2.new(0, 20, 0, 38)
- mousetip.Tier.TextColor3 = Color3.new(1, 1, 1)
- mousetip.Tier.Thumbnail.Visible = false
- mousetip.Extra.Visible = false
- mousetip.Visible = true
- mousetip.Position = UDim2.new(0, GData.O_Mouse.X, 0, GData.O_Mouse.Y)
- elseif opt and opt:FindFirstChild("Manual") and (targ.Name == opt.Manual.Value or GData.KeyboardShift_Down) and not opt.Parent:FindFirstChild("DoNotScan") then
- if GData.S_Resource ~= nil and not GData.API.CheckIsOwner(opt) then
- return
- end
- if GData.S_Automate then
- return
- end
- if (opt.Parent:FindFirstChild("Screen") or targ:FindFirstChild("OwnerOnly")) and not GData.API.CheckIsOwner(opt) then
- return
- end
- if GData.KeyboardShift_Down then
- mousetip.Quick.Text = "Quick: Button"
- mousetip.Quick.Visible = true
- else
- mousetip.Quick.Visible = false
- end
- GData.O_ButtonClick = opt.Parent[opt.Manual.Value]
- sbox.Color3 = opt.Parent[opt.Manual.Value].BrickColor.Color
- sbox.Transparency = 0.5
- sbox.Adornee = opt.Parent[opt.Manual.Value]
- mousetip.Title.Text = "Button"
- mousetip.Tier.Text = "Click to activate!"
- mousetip.Tier.Position = UDim2.new(0, 20, 0, 38)
- mousetip.Tier.TextColor3 = opt.Parent[opt.Manual.Value].Color
- mousetip.Tier.Thumbnail.Visible = false
- mousetip.Extra.Visible = false
- mousetip.Visible = true
- mousetip.Position = UDim2.new(0, GData.O_Mouse.X, 0, GData.O_Mouse.Y)
- 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
- GData.O_ButtonClick = nil
- GData.O_Selection = opt.Parent
- if GData.KeyboardShift_Down then
- sbox.Color3 = Color3.new(1, 0.4, 0.4)
- mousetip.Quick.Text = "Quick: Delete"
- mousetip.Quick.Visible = true
- else
- sbox.Color3 = Color3.new(0.6, 0.6, 0.6)
- mousetip.Quick.Visible = false
- end
- sbox.Transparency = 0.5
- sbox.Adornee = opt.Parent
- local aliases = require(game.ReplicatedStorage.GUILibrary.Aliases)
- mousetip.Title.Text = aliases[opt.Parent.Name] or opt.Parent.Name
- mousetip.Tier.Text = "Primitive"
- mousetip.Tier.TextColor3 = GData.T_TierData[1].c
- if GData.ItemDatabase[opt.Parent.Name] then
- local _ti = GData.ItemDatabase[opt.Parent.Name].l or 1
- local tier = GData.T_TierData[_ti]
- mousetip.Tier.Text = tier.n
- mousetip.Tier.TextColor3 = tier.c
- mousetip.Tier.Thumbnail.Image = GData.T_TierImages[_ti]
- mousetip.Tier.Thumbnail.Visible = true
- if GData.T_TierImages[_ti] == "" then
- mousetip.Tier.Position = UDim2.new(0, 20, 0, 38)
- else
- mousetip.Tier.Position = UDim2.new(0, 46, 0, 38)
- end
- else
- mousetip.Tier.Thumbnail.Visible = false
- mousetip.Tier.Position = UDim2.new(0, 20, 0, 38)
- end
- if opt:FindFirstChild("IG_Tooltip") and GData.KeyboardShift_Down then
- mousetip.Extra.Visible = true
- mousetip.Extra.TextSize = 16
- mousetip.Extra.Text = opt.IG_Tooltip.Value
- mousetip.Help.Visible = false
- mousetip.Extra.Size = UDim2.new(0, mousetip.Extra.TextBounds.X, 0, mousetip.Extra.TextBounds.Y)
- elseif opt:FindFirstChild("NetworkStatus") and GData.KeyboardShift_Down then
- mousetip.Extra.Visible = true
- mousetip.Extra.TextSize = 18
- mousetip.Extra.Text = opt.NetworkStatus.Value
- mousetip.Help.Visible = false
- mousetip.Extra.Size = UDim2.new(0, mousetip.Extra.TextBounds.X, 0, mousetip.Extra.TextBounds.Y)
- elseif opt:FindFirstChild("IG_Tooltip") or opt:FindFirstChild("NetworkStatus") then
- mousetip.Help.Visible = true
- mousetip.Extra.Visible = false
- else
- mousetip.Extra.Visible = false
- mousetip.Help.Visible = false
- end
- mousetip.Visible = true
- mousetip.Position = UDim2.new(0, GData.O_Mouse.X, 0, GData.O_Mouse.Y)
- else
- GData.O_ButtonClick = nil
- GData.O_Selection = nil
- sbox.Transparency = 0
- sbox.Adornee = nil
- mousetip.Visible = false
- mousetip.Help.Visible = false
- end
- else
- GData.UndoSSelectionHitbox(sbox)
- end
- end
- local selection_lastModel
- function GData.CheckMouseRegion_Multi(position1, position2)
- local pgui = getLocalPlayer():WaitForChild("PlayerGui")
- local models = GData.API.GetSelectedModels(position1, position2)
- for i = #GData.T_SelectionModels, 1, -1 do
- if not models[GData.T_SelectionModels[i]] then
- GData.API.RemoveSelection(GData.T_SelectionModels[i])
- end
- end
- for model in pairs(models) do
- if not GData.API.SelectionExists(model) and model:FindFirstChild("Unselectable") == nil then
- GData.API.AddSelection(model, script.SelectionBox:Clone(), pgui)
- end
- end
- end
- local run = game:GetService("RunService")
- local selecting = false
- local selectnode
- coroutine.wrap(function()
- GData.O_Difficulty = workspace.Players[game.Players.LocalPlayer.Name].PlayerData.Difficulty
- local tmp1, tmp2
- local newgame = true
- if newgame then
- while playing() do
- run.RenderStepped:wait()
- GData.API.FixMenus()
- GData.Update_MenuOpen_Status()
- for _, API in pairs(GData.Loopable_API_Order) do
- API.loop()
- end
- GData.Activate_MHighlightTip()
- end
- return
- end
- while playing() do
- run.RenderStepped:wait()
- GData.API.FixMenus()
- local gmenu = GData.API.GetMenu()
- GData.Update_MenuOpen_Status()
- while GData.O_ConfigureGUI and GData.O_ConfigureGUI.Parent do
- GData.Update_MenuOpen_Status()
- wait()
- end
- local sbox = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("SelectionBox")
- if GData.MouseButton1_Down and GData.DontMBU == false then
- local mouseRay = Ray.new(GData.O_Mouse.UnitRay.Origin, GData.O_Mouse.UnitRay.Direction * 500)
- local part, intersection = workspace:FindPartOnRayWithIgnoreList(mouseRay, {
- workspace.CurrentCamera,
- getLocalCharacter(),
- workspace.Players[game.Players.LocalPlayer.Name].Tiles
- })
- if part and part.Name:find("BasePlate") then
- GData.Selection_BoundingBox.Anchor = intersection
- end
- selecting = false
- end
- while playing() and GData.MouseButton1_Down and GData.Selection_BoundingBox.Anchor and GData.DontMBU == false do
- local mouseRay = Ray.new(GData.O_Mouse.UnitRay.Origin, GData.O_Mouse.UnitRay.Direction * 500)
- local part, intersection = workspace:FindPartOnRayWithIgnoreList(mouseRay, {
- workspace.CurrentCamera,
- getLocalCharacter(),
- workspace.Players[getLocalPlayer().Name]
- })
- if selecting == false and part and part.Name:find("BasePlate") and (intersection - GData.Selection_BoundingBox.Anchor).magnitude > 2 then
- GData.UndoSSelectionHitbox(sbox)
- selecting = true
- GData.API.SpawnNode(GData.Selection_BoundingBox.Anchor)
- end
- if selecting then
- GData.CheckMouseRegion_Multi(GData.Selection_BoundingBox.Anchor, intersection)
- GData.API.IntermediateBox(GData.Selection_BoundingBox.Anchor, intersection)
- if selectnode == nil then
- selectnode = GData.API.SpawnNode(GData.Selection_BoundingBox.Anchor)
- elseif GData.T_Nodes[selectnode] then
- local mouseRay = Ray.new(GData.O_Mouse.UnitRay.Origin, GData.O_Mouse.UnitRay.Direction * 500)
- local part, intersection = workspace:FindPartOnRayWithIgnoreList(mouseRay, {
- workspace.CurrentCamera,
- getLocalCharacter(),
- workspace.Players[game.Players.LocalPlayer.Name]
- })
- GData.T_Nodes[selectnode][5] = intersection
- end
- end
- run.RenderStepped:wait()
- end
- if #GData.T_SelectionModels > 1 then
- local gui = getLocalPlayer().PlayerGui:WaitForChild("GameGUI").AbsoluteSize
- local windowx, windowy = gui.X, gui.Y
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible = true
- getLocalPlayer().PlayerGui:WaitForChild("GameGUI").Menu.ForceClose:Invoke()
- game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("OtherMenu", true)
- 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])
- if _tab then
- GData.LastMenuCount = #_tab
- end
- while playing() and getLocalPlayer().PlayerGui:WaitForChild("GameGUI").RightClick.Visible do
- GData.Update_MenuOpen_Status()
- run.RenderStepped:wait()
- end
- elseif #GData.T_SelectionModels == 1 then
- GData.O_Selection = GData.T_SelectionModels[1]
- GData.On_Select()
- end
- GData.API.IntermediateBox_Clear()
- GData.API.VanishNodes()
- selectnode = nil
- selecting = false
- GData.API.ClearSelection()
- GData.Selection_BoundingBox.Anchor = nil
- while playing() and GData.Menu_Open do
- GData.UndoSSelectionHitbox(sbox)
- GData.Update_MenuOpen_Status()
- GData.O_ButtonClick = nil
- wait()
- GData.API.ChangeInvInfoStatus(GData.InputType == "Keyboard", "inventory")
- end
- while playing() and GData.O_SelectionGUI do
- GData.Update_MenuOpen_Status()
- GData.O_ButtonClick = nil
- GData.API.ChangeInvInfoStatus(GData.InputType == "Keyboard", "rc_menu")
- sbox.Adornee = GData.O_SelectionGUI
- sbox.Transparency = 0
- local mousetip = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("MouseTooltip")
- mousetip.Visible = false
- wait()
- end
- GData.API.VanishNodes()
- selectnode = nil
- selecting = false
- GData.API.ClearSelection()
- local pl = getLocalPlayer()
- GData.API.ChangeInvInfoStatus(GData.InputType == "Keyboard", "idle")
- local mouseRay, int, Hit, startpos
- if GData.InputType == "Gamepad" then
- mouseRay = Ray.new(GData.O_Mouse.UnitRay.Origin, GData.O_Mouse.UnitRay.Direction * 500)
- int, Hit = workspace:FindPartOnRayWithIgnoreList(mouseRay, {
- workspace.CurrentCamera,
- workspace.Players[pl.Name].Tiles,
- getLocalCharacter()
- })
- if int then
- startpos = Hit
- end
- end
- local hlabel = game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("GameGUI").HUD.Harvest
- if GData.O_ButtonClick and GData.O_ButtonClick.Name == "Harvest" then
- hlabel.Visible = true
- local HP, Max = GData.O_ButtonClick.Parent.UnitOptions.HP.Value, 5
- hlabel.Level.Percent:TweenSize(UDim2.new(HP / Max, 0, 1, 0), nil, nil, 0.1)
- hlabel.Label.Text = "Harvest (" .. GData.O_ButtonClick.Parent.UnitOptions.Deposit.Value .. ")"
- else
- hlabel.Visible = false
- end
- if GData.Placement_Model then
- startpos = GData.Placement_Model.PrimaryPart.Position * Vector3.new(1, 0, 1)
- end
- game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("Building", false)
- local offs = Vector3.new(0, 0, 0)
- tmp1, tmp2 = gmenu.Menu1.Visible, gmenu.Menu2.Visible
- local gplaced = false
- local lastundmod
- while playing() and GData.Placement_Model and 0 < GData.Placement_Count and GData.Placement_Model.PrimaryPart do
- local undmod = GData.Undo_ActionList[#GData.Undo_ActionList]
- if undmod and undmod.Parent and lastundmod ~= undmod and not undmod:IsDescendantOf(workspace.CurrentCamera) then
- GData.API.TriangleHide()
- ShowPart.Size = undmod.PrimaryPart.Size
- ShowPart.CFrame = undmod.PrimaryPart.CFrame + Vector3.new(0, 1, 0)
- GData.API.TriangleShow(undmod)
- lastundmod = undmod
- elseif 1 > #GData.Undo_ActionList and lastundmod ~= nil then
- GData.API.TriangleHide()
- undmod, lastundmod = nil, nil
- elseif 0 < #GData.Undo_ActionList then
- lastundmod = undmod
- end
- local mousetip = getLocalPlayer():WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("MouseTooltip")
- mousetip.Visible = false
- gplaced = true
- GData.API.HideMenus()
- local doMbd = false
- game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("Building", true)
- GData.Update_MenuOpen_Status()
- if GData.InputType == "Gamepad" then
- local inputs = game:GetService("UserInputService"):GetGamepadState(Enum.UserInputType.Gamepad1)
- for _, K in pairs(inputs) do
- if K.KeyCode.Name:find("Thumbstick1") then
- GData.Gamepad.Cursor = K.Position
- elseif K.KeyCode.Name:find("Thumbstick2") then
- GData.Gamepad.Cursor_Turn = K.Position
- end
- end
- end
- GData.API.ChangeInvInfoStatus(GData.InputType == "Keyboard", "build_map")
- pl:WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("BuildHUD").Visible = true
- local assignview = getLocalPlayer().PlayerGui:WaitForChild("GameGUI"):FindFirstChild("AssignView")
- if assignview then
- pl:WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("BuildHUD").Visible = false
- if assignview:FindFirstChild("ItemHolder") then
- assignview.ItemHolder.Amnt.Text = GData.Placement_Count
- end
- else
- pl:WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("BuildHUD").Visible = true
- pl:WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("BuildHUD").Amount.Text = "x" .. GData.Placement_Count
- end
- GData.O_ButtonClick = nil
- GData.O_Selection = nil
- sbox.Transparency = 0
- GData.Placement_Model.Parent = workspace.CurrentCamera
- local ppart = GData.Placement_Model.PrimaryPart or GData.Placement_Model:FindFirstChild("Base Platform")
- if not ppart then
- error("Error 1: Could not resolve primary part. Report error to nickcool9999.", 2)
- end
- GData.GhostizeModel(GData.Placement_Model)
- sbox.Adornee = GData.Placement_Model
- local cam = getLocalCamera()
- if GData.InputType ~= "Gamepad" then
- mouseRay = Ray.new(GData.O_Mouse.UnitRay.Origin, GData.O_Mouse.UnitRay.Direction * 500)
- int, Hit = workspace:FindPartOnRayWithIgnoreList(mouseRay, {
- workspace.CurrentCamera,
- workspace.Players[pl.Name].Tiles,
- getLocalCharacter()
- })
- Hit = Hit + GData.Mouse_Offset
- elseif GData.Gamepad.Cursor and GData.Gamepad.Cursor.magnitude > 0.25 then
- local look = OriginFrame.new((cam.CFrame.lookVector * Vector3.new(1, 0, 1)).unit)
- Hit = Hit + (look * CFrame.new(GData.Gamepad.Cursor.X, 0, -GData.Gamepad.Cursor.Y)).p
- print(GData.Gamepad.Cursor.X, GData.Gamepad.Cursor.Y, GData.Gamepad.Cursor.Z)
- end
- if GData.Placement_Model:FindFirstChild("Phantom Brick") then
- Hit = Hit + (GData.Placement_Model.PrimaryPart.Position - GData.Placement_Model["Phantom Brick"].Position)
- end
- local ray = Ray.new(ppart.CFrame.p, Vector3.new(0, -20, 0))
- local testpart = workspace:FindPartOnRayWithIgnoreList(ray, {
- workspace.CurrentCamera,
- workspace.Players[pl.Name].Tiles,
- getLocalCharacter()
- })
- local moffset = Vector3.new(0, 0, 0)
- moffset = GData.API.GetOffset(ppart.Size, GData.Rotation)
- local diff = Hit - (GData.AnchorPoint or GData.O_Anchor.Position)
- local XValid, ZValid = math.abs(diff.X) <= 512, math.abs(diff.Z) <= 512
- local movePos, cf2
- local isSmooth = pl:WaitForChild("PlayerGui"):WaitForChild("SmoothPlacement").Value
- if int and XValid and ZValid then
- GData.O_Podium = nil
- local psx, psz = ppart.Size.X / 2, ppart.Size.Z / 2
- 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)
- 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
- local offsety = GData.Placement_Model:FindFirstChild("OffsetY")
- local phantom = GData.Placement_Model:FindFirstChild("Phantom Brick")
- if offsety then
- cf2 = look + Vector3.new(0, ppart.Size.Y / 2 + offsety.Value, 0) + offs
- elseif phantom then
- cf2 = look + Vector3.new(0, ppart.Size.Y / 2 + (ppart.Position.Y - phantom.Position.Y), 0) + offs
- else
- cf2 = look + Vector3.new(0, ppart.Size.Y / 2, 0) + offs
- end
- local dist = (cf2.p - GData.Placement_Model.PrimaryPart.CFrame.p).magnitude
- GData.CF_Placement = cf2
- if dist < 0.2 or dist > 64 then
- GData.Placement_Model:SetPrimaryPartCFrame(cf2)
- else
- GData.Placement_Model:SetPrimaryPartCFrame(GData.Placement_Model.PrimaryPart.CFrame:lerp(cf2, not isSmooth and 1 or 0.6))
- if GData.MouseButton1_Down and doMbd == false then
- doMbd = true
- end
- end
- end
- GData.checkEmpty(ppart, ppart.Position - Vector3.new(0, 4, 0))
- local canGoDown = GData.Placement_IsEmpty
- local r = GData.checkEmpty(ppart)
- local num = function(t)
- local l = 0
- for n in pairs(t) do
- l = l + 1
- end
- return l
- end
- if r and num(r) > 0 and num(r) < 5 then
- local botpos = GData.Placement_Model.PrimaryPart.CFrame
- local top = 0
- offs = Vector3.new(0, 0, 0)
- repeat
- for model in pairs(r) do
- if model:IsA("Model") then
- local s = model:GetExtentsSize()
- local Y = model.PrimaryPart.CFrame.Y
- local Ys = model.PrimaryPart.Size.Y / 2
- top = math.max(Y + math.ceil(s.Y / 4) * 4 - Ys, top)
- end
- end
- offs = Vector3.new(0, top, 0)
- r = GData.checkEmpty(ppart, botpos.p + offs)
- until not r or num(r) < 1 or num(r) > 4
- if r then
- GData.Placement_IsEmpty = false
- else
- GData.Placement_Model:SetPrimaryPartCFrame(botpos + offs)
- end
- elseif canGoDown then
- local botpos = GData.Placement_Model.PrimaryPart.CFrame
- r = GData.checkEmpty(ppart, botpos.p - Vector3.new(0, 4, 0))
- while offs.Y > 0 and GData.Placement_IsEmpty do
- offs = offs - Vector3.new(0, 4, 0)
- r = GData.checkEmpty(ppart, botpos.p + offs)
- end
- offs = Vector3.new(offs.X, math.max(0, offs.Y), offs.Z)
- GData.Placement_Model:SetPrimaryPartCFrame(botpos + offs)
- end
- local gridPos = Vector3.new(ppart.Position.X / GData.Alignment.X, ppart.Position.Y / 4, ppart.Position.Z / GData.Alignment.Z)
- gridPos = Vector3.new(math.floor(gridPos.X + 0.5) * GData.Alignment.X, 0, math.floor(gridPos.Z + 0.5) * GData.Alignment.Z)
- getLocalPlayer().PlayerGui.Grid.BuildPos:Fire(gridPos, ppart.BrickColor.Color, ppart.Size, GData.Alignment)
- local r = GData.checkEmpty(ppart)
- local targ = GData.O_Mouse.Target
- if targ and targ:FindFirstChild("CustomTile") then
- GData.O_Podium = targ
- end
- if GData.O_Podium then
- 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))
- GData.Placement_Model:SetPrimaryPartCFrame(docf * CFrame.Angles(GData.O_Podium.CFrame:toEulerAnglesXYZ()))
- GData.CF_Placement = docf
- print(GData.Placement_Model.Name)
- GData.Placement_IsEmpty = GData.O_Podium.CustomTile.Value == GData.Placement_Model.Name
- end
- if 1 <= getLocalPlayer().PlayerGui:WaitForChild("DataLimit").Value then
- sbox.Color3 = Color3.new(1, 0.5, 0)
- sbox.SurfaceTransparency = 0.5
- elseif GData.Placement_IsEmpty then
- sbox.Color3 = Color3.new(0, 1, 0)
- sbox.SurfaceTransparency = 1
- else
- sbox.Color3 = Color3.new(1, 0, 0)
- sbox.SurfaceTransparency = 0.6
- end
- GData.API.lockOnModel(ppart.Parent)
- if getLocalCamera().CameraType.Name == "Scriptable" then
- getLocalCharacter():WaitForChild("Humanoid").WalkSpeed = 0
- end
- if doMbd then
- if GData.AnchorPoint == nil then
- end
- if GData.Rotation == 0 or GData.Rotation == 180 then
- else
- end
- GData.DontMBU = true
- GData.onMouse1_Down()
- GData.Skip_MBUFunction = true
- elseif GData.MouseButton1_Down == false then
- GData.AnchorPoint = nil
- GData.Alignment = {
- X = GData.DefaultAlignment.X,
- Z = GData.DefaultAlignment.Z
- }
- end
- game:GetService("RunService").RenderStepped:wait()
- end
- GData.AnchorPoint = nil
- GData.Alignment = {X = 2, Z = 2}
- GData.API.TriangleHide()
- if GData.Placement_Model then
- GData.Placement_Model:Destroy()
- end
- removeCorner()
- GData.Placement_Model = nil
- local center, anchor_points
- if 0 < #GData.T_SelectionMovingModels then
- center = CFrame.new(GData.API.CenterPoint(GData.T_SelectionMovingModels))
- GData.Rotation = 0
- anchor_points = {}
- for _, model in pairs(GData.T_SelectionMovingModels) do
- anchor_points[model] = model.PrimaryPart.Position - center
- GData.GhostizeModel(model)
- end
- end
- while 0 < #GData.T_SelectionMovingModels do
- local cam = getLocalCamera()
- if GData.InputType ~= "Gamepad" then
- mouseRay = Ray.new(GData.O_Mouse.UnitRay.Origin, GData.O_Mouse.UnitRay.Direction * 500)
- int, Hit = workspace:FindPartOnRayWithIgnoreList(mouseRay, {
- workspace.CurrentCamera,
- workspace.Players[pl.Name].Tiles,
- getLocalCharacter()
- })
- Hit = Hit + GData.Mouse_Offset
- elseif GData.Gamepad.Cursor and GData.Gamepad.Cursor.magnitude > 0.25 then
- local look = OriginFrame.new((cam.CFrame.lookVector * Vector3.new(1, 0, 1)).unit)
- Hit = Hit + (look * CFrame.new(GData.Gamepad.Cursor.X, 0, -GData.Gamepad.Cursor.Y)).p
- end
- for _, model in pairs(GData.T_SelectionMovingModels) do
- local end_goal = CFrame.new(Hit + anchor_points[model]) * CFrame.Angles(0, math.rad(GData.Rotation - model.Rotation.Value), 0)
- model:SetPrimaryPartCFrame(end_goal)
- end
- game:GetService("RunService").RenderStepped:wait()
- end
- if gplaced then
- gmenu.Menu1.Visible, gmenu.Menu2.Visible = tmp1, tmp2
- end
- game.ReplicatedStorage.Calls.Parallel.ChangeStatus:Fire("Building", false)
- if getLocalCamera().CameraType.Name == "Scriptable" then
- getLocalCharacter():WaitForChild("Humanoid").WalkSpeed = 16
- end
- GData.API.lockOffModel()
- GData.O_Mouse.TargetFilter = nil
- pl:WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("BuildHUD").Visible = false
- sbox.SurfaceTransparency = 1
- tmp1, tmp2 = gmenu.Menu1.Visible, gmenu.Menu2.Visible
- end
- end)()
- end
- script.Parent.Enabled.Enable.OnInvoke = enable
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement