From a94af6601327f259299db4e4c3de1163dda575df Mon Sep 17 00:00:00 2001 From: Lewin Kelly Date: Mon, 14 Aug 2023 17:26:17 +0100 Subject: [PATCH] Improve corescript formatting, add logging for script loading, and replace URLs with banland.xyz --- 20573078.xml | 12 +- 38037265.xml | 10 +- lua/107893730.lua | 330 +++++-- lua/152908679.lua | 85 +- lua/153556783.lua | 326 ++++--- lua/157877000.lua | 162 +++- lua/36868950.lua | 12 +- lua/37801172.lua | 97 +- lua/38037565.lua | 57 +- lua/39250920.lua | 71 +- lua/45284430.lua | 2213 +++++++++++++++++++++++++++------------------ lua/45374389.lua | 1 + lua/46295863.lua | 673 +++++++++----- lua/48488235.lua | 753 +++++++++++---- lua/48488398.lua | 71 +- lua/48488451.lua | 3 +- lua/53878047.lua | 155 +++- lua/53878057.lua | 213 +++-- lua/59002209.lua | 1 + lua/60595411.lua | 115 ++- lua/60595695.lua | 1 + lua/73157242.lua | 888 +++++++++++++----- lua/89449008.lua | 181 ++-- lua/89449093.lua | 62 +- lua/97188756.lua | 145 ++- lua/host.lua | 257 ++++-- lua/join.lua | 281 +++--- lua/studio.lua | 107 +-- lua/visit.lua | 154 ++-- stylua.toml | 2 +- 30 files changed, 5043 insertions(+), 2395 deletions(-) diff --git a/20573078.xml b/20573078.xml index 5fdfe28..f95d2fd 100644 --- a/20573078.xml +++ b/20573078.xml @@ -1,4 +1,6 @@ - + null nil @@ -94,7 +96,9 @@ 2 2 - http://banland.xyz/asset?id=19999424 + + http://banland.xyz/asset?id=19999424 + 5 Mesh @@ -107,7 +111,9 @@ 1.07000005 1.07000005 - http://banland.xyz/asset?id=20571982 + + http://banland.xyz/asset?id=20571982 + 1 1 diff --git a/38037265.xml b/38037265.xml index d2bca69..1e0ed8f 100644 --- a/38037265.xml +++ b/38037265.xml @@ -199,7 +199,7 @@ humanoid.Died:connect(function() HealthChanged(0) end) 4279970357 1 false - http://www.roblox.com/asset/?id=34854607 + http://banland.xyz/asset/?id=34854607 hurtOverlay 2 @@ -254,7 +254,7 @@ humanoid.Died:connect(function() HealthChanged(0) end) 4279970357 1 false - http://www.roblox.com/asset/?id=35238000 + http://banland.xyz/asset/?id=35238000 bkg 0 @@ -282,7 +282,7 @@ humanoid.Died:connect(function() HealthChanged(0) end) 4279970357 1 false - http://www.roblox.com/asset/?id=35238036 + http://banland.xyz/asset/?id=35238036 barRed 0.0189999994 @@ -338,7 +338,7 @@ humanoid.Died:connect(function() HealthChanged(0) end) 4279970357 1 false - http://www.roblox.com/asset/?id=35238053 + http://banland.xyz/asset/?id=35238053 bar 0.0189999994 @@ -366,7 +366,7 @@ humanoid.Died:connect(function() HealthChanged(0) end) 4279970357 0 false - http://www.roblox.com/asset/?id=34816363 + http://banland.xyz/asset/?id=34816363 label 0.680000007 diff --git a/lua/107893730.lua b/lua/107893730.lua index 94c3211..02d066a 100644 --- a/lua/107893730.lua +++ b/lua/107893730.lua @@ -1,3 +1,4 @@ +print "[Mercury]: Loaded corescript 107893730" -- this script creates the gui and sends the web requests for in game purchase prompts -- wait for important items to appear @@ -16,31 +17,31 @@ end -------------------------------- Global Variables ---------------------------------------- -- utility variables -local RbxUtility = nil +local RbxUtility local baseUrl = game:GetService("ContentProvider").BaseUrl:lower() -- data variables local currentProductInfo, currentAssetId, currentCurrencyType, currentCurrencyAmount, currentEquipOnPurchase, currentProductId, currentServerResponseTable local checkingPlayerFunds = false -local openBCUpSellWindowConnection = nil +local openBCUpSellWindowConnection local purchasingConsumable = false local enableBrowserWindowClosedEvent = true -- gui variables -local openBuyCurrencyWindowConnection = nil +local openBuyCurrencyWindowConnection local currentlyPrompting = false -local purchaseDialog = nil +local purchaseDialog local tweenTime = 0.3 local showPosition = UDim2.new(0.5, -330, 0.5, -200) local hidePosition = UDim2.new(0.5, -330, 1, 25) -local isSmallScreen = nil +local isSmallScreen local spinning = false -local spinnerIcons = nil +local spinnerIcons local smallScreenThreshold = 450 -- user facing images local assetUrls = {} -local assetUrl = "http://www.roblox.com/Asset/?id=" +local assetUrl = "http://banland.xyz/Asset/?id=" local errorImageUrl = assetUrl .. "42557901" table.insert(assetUrls, errorImageUrl) local buyImageUrl = assetUrl .. "104651457" @@ -77,9 +78,12 @@ local errorPurchasesUnknownText = "Roblox is performing maintenance" local purchaseSucceededText = "Your purchase of itemName succeeded!" local purchaseFailedText = "Your purchase of itemName failed because errorReason. Your account has not been charged. Please try again soon." -local productPurchaseText = "Would you like to buy 'itemName' for currencyType currencyAmount?" -local freeItemPurchaseText = "Would you like to take the assetType 'itemName' for FREE?" -local freeItemBalanceText = "Your balance of Robux or Tix will not be affected by this transaction." +local productPurchaseText = + "Would you like to buy 'itemName' for currencyType currencyAmount?" +local freeItemPurchaseText = + "Would you like to take the assetType 'itemName' for FREE?" +local freeItemBalanceText = + "Your balance of Robux or Tix will not be affected by this transaction." -------------------------------- End Global Variables ---------------------------------------- @@ -138,9 +142,13 @@ function userPurchaseActionsEnded(isSuccess) checkingPlayerFunds = false if isSuccess then -- show the user we bought the item successfully, when they close this dialog we will call signalPromptEnded - local newPurchasedSucceededText = - string.gsub(purchaseSucceededText, "itemName", tostring(currentProductInfo["Name"])) - purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = newPurchasedSucceededText + local newPurchasedSucceededText = string.gsub( + purchaseSucceededText, + "itemName", + tostring(currentProductInfo["Name"]) + ) + purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = + newPurchasedSucceededText setButtonsVisible(purchaseDialog.BodyFrame.OkPurchasedButton) hidePurchasing() else -- otherwise we didn't purchase, no need to show anything, just signal and close dialog @@ -152,10 +160,17 @@ function signalPromptEnded(isSuccess) closePurchasePrompt() if purchasingConsumable then game:GetService("MarketplaceService") - :SignalPromptProductPurchaseFinished(game.Players.LocalPlayer.userId, currentProductId, isSuccess) + :SignalPromptProductPurchaseFinished( + game.Players.LocalPlayer.userId, + currentProductId, + isSuccess + ) else - game:GetService("MarketplaceService") - :SignalPromptPurchaseFinished(game.Players.LocalPlayer, currentAssetId, isSuccess) + game:GetService("MarketplaceService"):SignalPromptPurchaseFinished( + game.Players.LocalPlayer, + currentAssetId, + isSuccess + ) end removeCurrentPurchaseInfo() end @@ -170,19 +185,38 @@ function updatePurchasePromptData(_) end if isFreeItem() then - newItemDescription = string.gsub(freeItemPurchaseText, "itemName", tostring(currentProductInfo["Name"])) - newItemDescription = - string.gsub(newItemDescription, "assetType", tostring(assetTypeToString(currentProductInfo["AssetTypeId"]))) + newItemDescription = string.gsub( + freeItemPurchaseText, + "itemName", + tostring(currentProductInfo["Name"]) + ) + newItemDescription = string.gsub( + newItemDescription, + "assetType", + tostring(assetTypeToString(currentProductInfo["AssetTypeId"])) + ) setHeaderText(takeHeaderText) else -- otherwise item costs something, so different prompt - newItemDescription = string.gsub(productPurchaseText, "itemName", tostring(currentProductInfo["Name"])) - newItemDescription = - string.gsub(newItemDescription, "currencyType", tostring(currencyTypeToString(currentCurrencyType))) - newItemDescription = string.gsub(newItemDescription, "currencyAmount", tostring(currentCurrencyAmount)) + newItemDescription = string.gsub( + productPurchaseText, + "itemName", + tostring(currentProductInfo["Name"]) + ) + newItemDescription = string.gsub( + newItemDescription, + "currencyType", + tostring(currencyTypeToString(currentCurrencyType)) + ) + newItemDescription = string.gsub( + newItemDescription, + "currencyAmount", + tostring(currentCurrencyAmount) + ) setHeaderText(buyHeaderText) end - purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = newItemDescription + purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = + newItemDescription if purchasingConsumable then purchaseDialog.BodyFrame.ItemPreview.Image = baseUrl @@ -202,7 +236,12 @@ function doPlayerFundsCheck(checkIndefinitely) local canPurchase, insufficientFunds = canPurchaseItem() -- check again to see if we can buy item if canPurchase and insufficientFunds then -- wait a bit and try a few more times local retries = 1000 - while (retries > 0 or checkIndefinitely) and insufficientFunds and checkingPlayerFunds and canPurchase do + while + (retries > 0 or checkIndefinitely) + and insufficientFunds + and checkingPlayerFunds + and canPurchase + do wait(1 / 10) canPurchase, insufficientFunds = canPurchaseItem() retries = retries - 1 @@ -220,7 +259,8 @@ function doPlayerFundsCheck(checkIndefinitely) end function showPurchasePrompt() - local canPurchase, insufficientFunds, notRightBC, override, descText = canPurchaseItem() + local canPurchase, insufficientFunds, notRightBC, override, descText = + canPurchaseItem() if canPurchase then updatePurchasePromptData() @@ -269,9 +309,15 @@ function showPurchasePrompt() purchaseDialog.BodyFrame.AfterBalanceButton ) elseif override then - setButtonsVisible(purchaseDialog.BodyFrame.BuyDisabledButton, purchaseDialog.BodyFrame.CancelButton) -- , purchaseDialog.BodyFrame.AfterBalanceButton) + setButtonsVisible( + purchaseDialog.BodyFrame.BuyDisabledButton, + purchaseDialog.BodyFrame.CancelButton + ) -- , purchaseDialog.BodyFrame.AfterBalanceButton) else - setButtonsVisible(purchaseDialog.BodyFrame.BuyButton, purchaseDialog.BodyFrame.CancelButton) -- , purchaseDialog.BodyFrame.AfterBalanceButton) + setButtonsVisible( + purchaseDialog.BodyFrame.BuyButton, + purchaseDialog.BodyFrame.CancelButton + ) -- , purchaseDialog.BodyFrame.AfterBalanceButton) end purchaseDialog:TweenPosition( @@ -282,7 +328,11 @@ function showPurchasePrompt() true ) - if canPurchase and insufficientFunds and not enableBrowserWindowClosedEvent then + if + canPurchase + and insufficientFunds + and not enableBrowserWindowClosedEvent + then checkingPlayerFunds = true doPlayerFundsCheck(true) end @@ -325,15 +375,24 @@ function purchaseFailed(inGamePurchasesDisabled) name = currentProductInfo["Name"] end - local newPurchasedFailedText = string.gsub(purchaseFailedText, "itemName", tostring(name)) + local newPurchasedFailedText = + string.gsub(purchaseFailedText, "itemName", tostring(name)) if inGamePurchasesDisabled then - newPurchasedFailedText = - string.gsub(newPurchasedFailedText, "errorReason", tostring(errorPurchasesDisabledText)) + newPurchasedFailedText = string.gsub( + newPurchasedFailedText, + "errorReason", + tostring(errorPurchasesDisabledText) + ) else - newPurchasedFailedText = string.gsub(newPurchasedFailedText, "errorReason", tostring(errorPurchasesUnknownText)) + newPurchasedFailedText = string.gsub( + newPurchasedFailedText, + "errorReason", + tostring(errorPurchasesUnknownText) + ) end - purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = newPurchasedFailedText + purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = + newPurchasedFailedText purchaseDialog.BodyFrame.ItemPreview.Image = errorImageUrl setButtonsVisible(purchaseDialog.BodyFrame.OkButton) @@ -351,7 +410,7 @@ function doAcceptPurchase(_) -- http call to do the purchase local response = "none" - local url = nil + local url -- consumables need to use a different url if purchasingConsumable then @@ -382,7 +441,12 @@ function doAcceptPurchase(_) end) -- debug output for us (found in the logs from local) - print("doAcceptPurchase success from ypcall is ", success, "reason is", reason) + print( + "doAcceptPurchase success from ypcall is ", + success, + "reason is", + reason + ) if (tick() - startTime) < 1 then wait(1) -- allow the purchasing waiting dialog to at least be readable (otherwise it might flash, looks bad)... @@ -390,7 +454,11 @@ function doAcceptPurchase(_) -- check to make sure purchase actually happened on the web end if response == "none" or response == nil or response == "" then - print("did not get a proper response from web on purchase of", currentAssetId, currentProductId) + print( + "did not get a proper response from web on purchase of", + currentAssetId, + currentProductId + ) purchaseFailed() return end @@ -401,19 +469,31 @@ function doAcceptPurchase(_) if response then if response["success"] == false then if response["status"] ~= "AlreadyOwned" then - print("web return response of fail on purchase of", currentAssetId, currentProductId) + print( + "web return response of fail on purchase of", + currentAssetId, + currentProductId + ) purchaseFailed((response["status"] == "EconomyDisabled")) return end end else - print("web return response of non parsable JSON on purchase of", currentAssetId) + print( + "web return response of non parsable JSON on purchase of", + currentAssetId + ) purchaseFailed() return end -- check to see if this item was bought, and if we want to equip it (also need to make sure the asset type was gear) - if currentEquipOnPurchase and success and currentAssetId and tonumber(currentProductInfo["AssetTypeId"]) == 19 then + if + currentEquipOnPurchase + and success + and currentAssetId + and tonumber(currentProductInfo["AssetTypeId"]) == 19 + then local tool = getToolAssetID(tonumber(currentAssetId)) if tool then tool.Parent = game.Players.LocalPlayer.Backpack @@ -422,16 +502,18 @@ function doAcceptPurchase(_) if purchasingConsumable then if not response["receipt"] then - print("tried to buy productId, but no receipt returned. productId was", currentProductId) + print( + "tried to buy productId, but no receipt returned. productId was", + currentProductId + ) purchaseFailed() return end - Game:GetService("MarketplaceService") - :SignalClientPurchaseSuccess( - tostring(response["receipt"]), - game.Players.LocalPlayer.userId, - currentProductId - ) + Game:GetService("MarketplaceService"):SignalClientPurchaseSuccess( + tostring(response["receipt"]), + game.Players.LocalPlayer.userId, + currentProductId + ) else userPurchaseActionsEnded(success) end @@ -446,7 +528,10 @@ end ---------------------------------------------- Currency Functions --------------------------------------------- -- enums have no implicit conversion to numbers in lua, has to have a function to do this function currencyEnumToInt(currencyEnum) - if currencyEnum == Enum.CurrencyType.Robux or currencyEnum == Enum.CurrencyType.Default then + if + currencyEnum == Enum.CurrencyType.Robux + or currencyEnum == Enum.CurrencyType.Default + then return 1 elseif currencyEnum == Enum.CurrencyType.Tix then return 2 @@ -532,7 +617,10 @@ end -- figure out what currency to use based on the currency you can actually sell the item in and what the script specified function setCurrencyAmountAndType(priceInRobux, priceInTix) - if currentCurrencyType == Enum.CurrencyType.Default or currentCurrencyType == Enum.CurrencyType.Robux then -- sell for default (user doesn't care) or robux + if + currentCurrencyType == Enum.CurrencyType.Default + or currentCurrencyType == Enum.CurrencyType.Robux + then -- sell for default (user doesn't care) or robux if priceInRobux ~= nil and priceInRobux ~= 0 then -- we can sell for robux currentCurrencyAmount = priceInRobux currentCurrencyType = Enum.CurrencyType.Robux @@ -561,9 +649,10 @@ end -- will get the player's balance of robux and tix, return in a table function getPlayerBalance() - local playerBalance = nil + local playerBalance local success, errorCode = ypcall(function() - playerBalance = game:HttpGetAsync(getSecureApiBaseUrl() .. "currency/balance") + playerBalance = + game:HttpGetAsync(getSecureApiBaseUrl() .. "currency/balance") end) if not success then print("Get player balance failed because", errorCode) @@ -582,11 +671,13 @@ end -- should open an external default browser window to this url function openBuyCurrencyWindow() checkingPlayerFunds = true - game:GetService("GuiService"):OpenBrowserWindow(baseUrl .. "Upgrades/Robux.aspx") + game:GetService("GuiService") + :OpenBrowserWindow(baseUrl .. "Upgrades/Robux.aspx") end function openBCUpSellWindow() - Game:GetService("GuiService"):OpenBrowserWindow(baseUrl .. "Upgrades/BuildersClubMemberships.aspx") + Game:GetService("GuiService") + :OpenBrowserWindow(baseUrl .. "Upgrades/BuildersClubMemberships.aspx") end -- set up the gui text at the bottom of the prompt (alerts user to how much money they will have left, or if they need to buy more to buy the item) @@ -596,7 +687,7 @@ function updateAfterBalanceText(playerBalance, notRightBc) return true, false end - local keyWord = nil + local keyWord if currentCurrencyType == Enum.CurrencyType.Robux then keyWord = "robux" elseif currentCurrencyType == Enum.CurrencyType.Tix then @@ -619,7 +710,9 @@ function updateAfterBalanceText(playerBalance, notRightBc) if afterBalanceNumber < 0 and keyWord == "robux" then if openBuyCurrencyWindowConnection == nil then openBuyCurrencyWindowConnection = - purchaseDialog.BodyFrame.AfterBalanceButton.MouseButton1Click:connect(openBuyCurrencyWindow) + purchaseDialog.BodyFrame.AfterBalanceButton.MouseButton1Click:connect( + openBuyCurrencyWindow + ) end purchaseDialog.BodyFrame.AfterBalanceButton.Text = "You need " .. currencyTypeToString(currentCurrencyType) @@ -680,27 +773,32 @@ function canPurchaseItem() -- first we see if player already owns the asset/get the productinfo local playerOwnsAsset = false local notRightBc = false - local descText = nil + local descText local success = false if purchasingConsumable then - local currentProductInfoRaw = nil + local currentProductInfoRaw success = ypcall(function() currentProductInfoRaw = Game:HttpGetAsync( - getSecureApiBaseUrl() .. "marketplace/productDetails?productid=" .. tostring(currentProductId) + getSecureApiBaseUrl() + .. "marketplace/productDetails?productid=" + .. tostring(currentProductId) ) end) if success then - currentProductInfo = getRbxUtility().DecodeJSON(currentProductInfoRaw) + currentProductInfo = + getRbxUtility().DecodeJSON(currentProductInfoRaw) end else success = ypcall(function() - currentProductInfo = game:GetService("MarketplaceService"):GetProductInfo(currentAssetId) + currentProductInfo = game:GetService("MarketplaceService") + :GetProductInfo(currentAssetId) end) end if currentProductInfo == nil or not success then - descText = "In-game sales are temporarily disabled. Please try again later." + descText = + "In-game sales are temporarily disabled. Please try again later." return true, nil, nil, true, descText end @@ -748,7 +846,10 @@ function canPurchaseItem() return true, nil, nil, true, descText end - if currentProductInfo["IsForSale"] == false and currentProductInfo["IsPublicDomain"] == false then + if + currentProductInfo["IsForSale"] == false + and currentProductInfo["IsPublicDomain"] == false + then descText = "This item is no longer for sale." return true, nil, nil, true, descText end @@ -760,7 +861,8 @@ function canPurchaseItem() tonumber(currentProductInfo["PriceInTickets"]) ) then - descText = "We could retrieve the price of the item correctly. Please try again later." + descText = + "We could retrieve the price of the item correctly. Please try again later." return true, nil, nil, true, descText end @@ -777,7 +879,8 @@ function canPurchaseItem() notRightBc = true end - local updatedBalance, insufficientFunds = updateAfterBalanceText(playerBalance, notRightBc) + local updatedBalance, insufficientFunds = + updateAfterBalanceText(playerBalance, notRightBc) if notRightBc then purchaseDialog.BodyFrame.AfterBalanceButton.Active = true @@ -786,25 +889,31 @@ function canPurchaseItem() if currentProductInfo["ContentRatingTypeId"] == 1 then if game.Players.LocalPlayer:GetUnder13() then - descText = "Your account is under 13 so purchase of this item is not allowed." + descText = + "Your account is under 13 so purchase of this item is not allowed." return true, nil, nil, true, descText end end if - (currentProductInfo["IsLimited"] == true or currentProductInfo["IsLimitedUnique"] == true) + ( + currentProductInfo["IsLimited"] == true + or currentProductInfo["IsLimitedUnique"] == true + ) and ( currentProductInfo["Remaining"] == "" or currentProductInfo["Remaining"] == 0 or currentProductInfo["Remaining"] == nil ) then - descText = "All copies of this item have been sold out! Try buying from other users on the website." + descText = + "All copies of this item have been sold out! Try buying from other users on the website." return true, nil, nil, true, descText end if not updatedBalance then - descText = "Could not update your balance. Please check back after some time." + descText = + "Could not update your balance. Please check back after some time." return true, nil, nil, true, descText end @@ -844,9 +953,11 @@ function startSpinner() while pos < 8 do if pos == spinPos or pos == ((spinPos + 1) % 8) then - spinnerIcons[pos + 1].Image = "http://www.roblox.com/Asset/?id=45880668" + spinnerIcons[pos + 1].Image = + "http://banland.xyz/Asset/?id=45880668" else - spinnerIcons[pos + 1].Image = "http://www.roblox.com/Asset/?id=45880710" + spinnerIcons[pos + 1].Image = + "http://banland.xyz/Asset/?id=45880710" end pos = pos + 1 @@ -904,7 +1015,7 @@ function createSpinner(size, position, parent) ) spinnerImage.BackgroundTransparency = 1 spinnerImage.ZIndex = 10 - spinnerImage.Image = "http://www.roblox.com/Asset/?id=45880710" + spinnerImage.Image = "http://banland.xyz/Asset/?id=45880710" spinnerImage.Parent = spinnerFrame spinnerIcons[spinnerNum] = spinnerImage @@ -919,7 +1030,8 @@ function createPurchasePromptGui() purchaseDialog.Size = UDim2.new(0, 660, 0, 400) purchaseDialog.Position = hidePosition purchaseDialog.Visible = false - purchaseDialog.BackgroundColor3 = Color3.new(141 / 255, 141 / 255, 141 / 255) + purchaseDialog.BackgroundColor3 = + Color3.new(141 / 255, 141 / 255, 141 / 255) purchaseDialog.BorderColor3 = Color3.new(204 / 255, 204 / 255, 204 / 255) purchaseDialog.Parent = game.CoreGui.RobloxGui @@ -932,7 +1044,12 @@ function createPurchasePromptGui() bodyFrame.ZIndex = 8 bodyFrame.Parent = purchaseDialog - local titleLabel = createTextObject("TitleLabel", "Buy Item", "TextLabel", Enum.FontSize.Size48) + local titleLabel = createTextObject( + "TitleLabel", + "Buy Item", + "TextLabel", + Enum.FontSize.Size48 + ) titleLabel.ZIndex = 8 titleLabel.Size = UDim2.new(1, 0, 0, 60) local titleBackdrop = titleLabel:Clone() @@ -948,7 +1065,8 @@ function createPurchasePromptGui() local distanceBetweenButtons = 90 local cancelButton = createImageButton "CancelButton" - cancelButton.Position = UDim2.new(0.5, (distanceBetweenButtons / 2), 1, -120) + cancelButton.Position = + UDim2.new(0.5, (distanceBetweenButtons / 2), 1, -120) cancelButton.BackgroundTransparency = 1 cancelButton.BorderSizePixel = 0 cancelButton.Parent = bodyFrame @@ -967,7 +1085,8 @@ function createPurchasePromptGui() cancelButton.MouseButton1Click:connect(doDeclinePurchase) local buyButton = createImageButton "BuyButton" - buyButton.Position = UDim2.new(0.5, -153 - (distanceBetweenButtons / 2), 1, -120) + buyButton.Position = + UDim2.new(0.5, -153 - (distanceBetweenButtons / 2), 1, -120) buyButton.BackgroundTransparency = 1 buyButton.BorderSizePixel = 0 buyButton.Image = buyImageUrl @@ -1103,12 +1222,21 @@ function createPurchasePromptGui() purchasingFrame.Active = true purchasingFrame.Parent = purchaseDialog - local purchasingLabel = createTextObject("PurchasingLabel", "Purchasing...", "TextLabel", Enum.FontSize.Size48) + local purchasingLabel = createTextObject( + "PurchasingLabel", + "Purchasing...", + "TextLabel", + Enum.FontSize.Size48 + ) purchasingLabel.Size = UDim2.new(1, 0, 1, 0) purchasingLabel.ZIndex = 10 purchasingLabel.Parent = purchasingFrame - createSpinner(UDim2.new(0, 50, 0, 50), UDim2.new(0.5, -25, 0.5, 30), purchasingLabel) + createSpinner( + UDim2.new(0, 50, 0, 50), + UDim2.new(0.5, -25, 0.5, 30), + purchasingLabel + ) end -- next two functions control the "Purchasing..." overlay @@ -1186,7 +1314,13 @@ function changeGuiToScreenSize(smallScreen) end end -function doPurchasePrompt(player, assetId, equipIfPurchased, currencyType, productId) +function doPurchasePrompt( + player, + assetId, + equipIfPurchased, + currencyType, + productId +) if not purchaseDialog then createPurchasePromptGui() end @@ -1216,23 +1350,31 @@ function userPurchaseProductActionsEnded(userIsClosingDialog) closePurchasePrompt() if currentServerResponseTable then local isPurchased = false - if tostring(currentServerResponseTable["isValid"]):lower() == "true" then + if + tostring(currentServerResponseTable["isValid"]):lower() + == "true" + then isPurchased = true end - Game:GetService("MarketplaceService"):SignalPromptProductPurchaseFinished( - tonumber(currentServerResponseTable["playerId"]), - tonumber(currentServerResponseTable["productId"]), - isPurchased - ) + Game:GetService("MarketplaceService") + :SignalPromptProductPurchaseFinished( + tonumber(currentServerResponseTable["playerId"]), + tonumber(currentServerResponseTable["productId"]), + isPurchased + ) else print "Something went wrong, no currentServerResponseTable" end removeCurrentPurchaseInfo() else - local newPurchasedSucceededText = - string.gsub(purchaseSucceededText, "itemName", tostring(currentProductInfo["Name"])) - purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = newPurchasedSucceededText + local newPurchasedSucceededText = string.gsub( + purchaseSucceededText, + "itemName", + tostring(currentProductInfo["Name"]) + ) + purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = + newPurchasedSucceededText setButtonsVisible(purchaseDialog.BodyFrame.OkPurchasedButton) hidePurchasing() end @@ -1247,7 +1389,8 @@ function doProcessServerPurchaseResponse(serverResponseTable) if serverResponseTable["playerId"] - and tonumber(serverResponseTable["playerId"]) == game.Players.LocalPlayer.userId + and tonumber(serverResponseTable["playerId"]) + == game.Players.LocalPlayer.userId then currentServerResponseTable = serverResponseTable userPurchaseProductActionsEnded(false) @@ -1269,9 +1412,10 @@ Game:GetService("MarketplaceService").PromptPurchaseRequested doPurchasePrompt(player, assetId, equipIfPurchased, currencyType, nil) end) -Game:GetService("MarketplaceService").ServerPurchaseVerification:connect(function(serverResponseTable) - doProcessServerPurchaseResponse(serverResponseTable) -end) +Game:GetService("MarketplaceService").ServerPurchaseVerification + :connect(function(serverResponseTable) + doProcessServerPurchaseResponse(serverResponseTable) + end) if enableBrowserWindowClosedEvent then Game:GetService("GuiService").BrowserWindowClosed:connect(function() @@ -1280,7 +1424,9 @@ if enableBrowserWindowClosedEvent then end Game.CoreGui.RobloxGui.Changed:connect(function() - local nowIsSmallScreen = (game.CoreGui.RobloxGui.AbsoluteSize.Y <= smallScreenThreshold) + local nowIsSmallScreen = ( + game.CoreGui.RobloxGui.AbsoluteSize.Y <= smallScreenThreshold + ) if nowIsSmallScreen and not isSmallScreen then changeGuiToScreenSize(true) elseif not nowIsSmallScreen and isSmallScreen then diff --git a/lua/152908679.lua b/lua/152908679.lua index ee0d5a7..0576cc1 100644 --- a/lua/152908679.lua +++ b/lua/152908679.lua @@ -1,5 +1,6 @@ +print "[Mercury]: Loaded corescript 152908679" + -- ContextActionTouch.lua --- 2014, created by Ben Tkacheff -- this script controls ui and firing of lua functions that are bound in ContextActionService for touch inputs -- Essentially a user can bind a lua function to a key code, input type (mousebutton1 etc.) and this @@ -8,8 +9,8 @@ local contextActionService = Game:GetService "ContextActionService" local isTouchDevice = Game:GetService("UserInputService").TouchEnabled local functionTable = {} local buttonVector = {} -local buttonScreenGui = nil -local buttonFrame = nil +local buttonScreenGui +local buttonFrame local ContextDownImage = "http://www.banland.xyz/asset/?id=97166756" local ContextUpImage = "http://www.banland.xyz/asset/?id=97166444" @@ -72,14 +73,22 @@ end function contextButtonDown(button, inputObject, actionName) if inputObject.UserInputType == Enum.UserInputType.Touch then button.Image = ContextDownImage - contextActionService:CallFunction(actionName, Enum.UserInputState.Begin, inputObject) + contextActionService:CallFunction( + actionName, + Enum.UserInputState.Begin, + inputObject + ) end end function contextButtonMoved(button, inputObject, actionName) if inputObject.UserInputType == Enum.UserInputType.Touch then button.Image = ContextDownImage - contextActionService:CallFunction(actionName, Enum.UserInputState.Change, inputObject) + contextActionService:CallFunction( + actionName, + Enum.UserInputState.Change, + inputObject + ) end end @@ -89,7 +98,11 @@ function contextButtonUp(button, inputObject, actionName) inputObject.UserInputType == Enum.UserInputType.Touch and inputObject.UserInputState == Enum.UserInputState.End then - contextActionService:CallFunction(actionName, Enum.UserInputState.End, inputObject) + contextActionService:CallFunction( + actionName, + Enum.UserInputState.End, + inputObject + ) end end @@ -109,7 +122,7 @@ function createNewButton(actionName, functionInfoTable) contextButton.Image = ContextUpImage contextButton.Parent = buttonFrame - local currentButtonTouch = nil + local currentButtonTouch Game:GetService("UserInputService").InputEnded:connect(function(inputObject) oldTouches[inputObject] = nil @@ -119,7 +132,10 @@ function createNewButton(actionName, functionInfoTable) return end - if inputObject.UserInputState == Enum.UserInputState.Begin and currentButtonTouch == nil then + if + inputObject.UserInputState == Enum.UserInputState.Begin + and currentButtonTouch == nil + then currentButtonTouch = inputObject contextButtonDown(contextButton, inputObject, actionName) end @@ -152,7 +168,10 @@ function createNewButton(actionName, functionInfoTable) actionIcon.Position = UDim2.new(0.175, 0, 0.175, 0) actionIcon.Size = UDim2.new(0.65, 0, 0.65, 0) actionIcon.BackgroundTransparency = 1 - if functionInfoTable["image"] and type(functionInfoTable["image"]) == "string" then + if + functionInfoTable["image"] + and type(functionInfoTable["image"]) == "string" + then actionIcon.Image = functionInfoTable["image"] end actionIcon.Parent = contextButton @@ -167,7 +186,10 @@ function createNewButton(actionName, functionInfoTable) actionTitle.FontSize = Enum.FontSize.Size18 actionTitle.TextWrapped = true actionTitle.Text = "" - if functionInfoTable["title"] and type(functionInfoTable["title"]) == "string" then + if + functionInfoTable["title"] + and type(functionInfoTable["title"]) == "string" + then actionTitle.Text = functionInfoTable["title"] end actionTitle.Parent = contextButton @@ -178,7 +200,7 @@ end function createButton(actionName, functionInfoTable) local button = createNewButton(actionName, functionInfoTable) - local position = nil + local position for i = 1, #buttonVector do if buttonVector[i] == "empty" then position = i @@ -240,26 +262,30 @@ function addAction(actionName, createTouchButton, functionInfoTable) end -- Connections -contextActionService.BoundActionChanged:connect(function(actionName, changeName, changeTable) - if functionTable[actionName] and changeTable then - local button = functionTable[actionName]["button"] - if button then - if changeName == "image" then - button.ActionIcon.Image = changeTable[changeName] - elseif changeName == "title" then - button.ActionTitle.Text = changeTable[changeName] - -- elseif changeName == "description" then - -- -- todo: add description to menu - elseif changeName == "position" then - button.Position = changeTable[changeName] +contextActionService.BoundActionChanged:connect( + function(actionName, changeName, changeTable) + if functionTable[actionName] and changeTable then + local button = functionTable[actionName]["button"] + if button then + if changeName == "image" then + button.ActionIcon.Image = changeTable[changeName] + elseif changeName == "title" then + button.ActionTitle.Text = changeTable[changeName] + -- elseif changeName == "description" then + -- -- todo: add description to menu + elseif changeName == "position" then + button.Position = changeTable[changeName] + end end end end -end) +) -contextActionService.BoundActionAdded:connect(function(actionName, createTouchButton, functionInfoTable) - addAction(actionName, createTouchButton, functionInfoTable) -end) +contextActionService.BoundActionAdded:connect( + function(actionName, createTouchButton, functionInfoTable) + addAction(actionName, createTouchButton, functionInfoTable) + end +) contextActionService.BoundActionRemoved:connect(function(actionName, _) removeAction(actionName) @@ -267,7 +293,10 @@ end) contextActionService.GetActionButtonEvent:connect(function(actionName) if functionTable[actionName] then - contextActionService:FireActionButtonFoundSignal(actionName, functionTable[actionName]["button"]) + contextActionService:FireActionButtonFoundSignal( + actionName, + functionTable[actionName]["button"] + ) end end) diff --git a/lua/153556783.lua b/lua/153556783.lua index 61509bf..9a6ddaf 100644 --- a/lua/153556783.lua +++ b/lua/153556783.lua @@ -1,6 +1,7 @@ +print "[Mercury]: Loaded corescript 153556783" + -- This is responsible for all touch controls we show (as of this writing, only on iOS) -- this includes character move thumbsticks, and buttons for jump, use of items, camera, etc. --- Written by Ben Tkacheff, 2013 -- obligatory stuff to make sure we don't access nil data while not Game do @@ -51,13 +52,13 @@ if isSmallScreenDevice() then jumpButtonSize = 70 end local oldJumpTouches = {} -local currentJumpTouch = nil +local currentJumpTouch local CameraRotateSensitivity = 0.007 local CameraRotateDeadZone = CameraRotateSensitivity * 16 local CameraZoomSensitivity = 0.03 local PinchZoomDelay = 0.2 -local cameraTouch = nil +local cameraTouch -- make sure all of our images are good to go Game:GetService("ContentProvider"):Preload(touchControlsSheet) @@ -88,14 +89,20 @@ function rotatePointAboutLocation(pointToRotate, pointToRotateAbout, radians) local transformedPoint = pointToRotate -- translate point back to origin: - transformedPoint = Vector2.new(transformedPoint.x - pointToRotateAbout.x, transformedPoint.y - pointToRotateAbout.y) + transformedPoint = Vector2.new( + transformedPoint.x - pointToRotateAbout.x, + transformedPoint.y - pointToRotateAbout.y + ) -- rotate point - local xNew = transformedPoint.x * cosAnglePercent - transformedPoint.y * sinAnglePercent - local yNew = transformedPoint.x * sinAnglePercent + transformedPoint.y * cosAnglePercent + local xNew = transformedPoint.x * cosAnglePercent + - transformedPoint.y * sinAnglePercent + local yNew = transformedPoint.x * sinAnglePercent + + transformedPoint.y * cosAnglePercent -- translate point back: - transformedPoint = Vector2.new(xNew + pointToRotateAbout.x, yNew + pointToRotateAbout.y) + transformedPoint = + Vector2.new(xNew + pointToRotateAbout.x, yNew + pointToRotateAbout.y) return transformedPoint end @@ -104,12 +111,17 @@ function dotProduct(v1, v2) return ((v1.x * v2.x) + (v1.y * v2.y)) end -function stationaryThumbstickTouchMove(thumbstickFrame, thumbstickOuter, touchLocation) +function stationaryThumbstickTouchMove( + thumbstickFrame, + thumbstickOuter, + touchLocation +) local thumbstickOuterCenterPosition = Vector2.new( thumbstickOuter.Position.X.Offset + thumbstickOuter.AbsoluteSize.x / 2, thumbstickOuter.Position.Y.Offset + thumbstickOuter.AbsoluteSize.y / 2 ) - local centerDiff = DistanceBetweenTwoPoints(touchLocation, thumbstickOuterCenterPosition) + local centerDiff = + DistanceBetweenTwoPoints(touchLocation, thumbstickOuterCenterPosition) -- thumbstick is moving outside our region, need to cap its distance if centerDiff > (thumbstickSize / 2) then @@ -125,10 +137,15 @@ function stationaryThumbstickTouchMove(thumbstickFrame, thumbstickOuter, touchLo normal = Vector2.new(normal.x, 0) end - local newThumbstickInnerPosition = thumbstickOuterCenterPosition + (normal * (thumbstickSize / 2)) - thumbstickFrame.Position = transformFromCenterToTopLeft(newThumbstickInnerPosition, thumbstickFrame) + local newThumbstickInnerPosition = thumbstickOuterCenterPosition + + (normal * (thumbstickSize / 2)) + thumbstickFrame.Position = transformFromCenterToTopLeft( + newThumbstickInnerPosition, + thumbstickFrame + ) else - thumbstickFrame.Position = transformFromCenterToTopLeft(touchLocation, thumbstickFrame) + thumbstickFrame.Position = + transformFromCenterToTopLeft(touchLocation, thumbstickFrame) end return Vector2.new( @@ -137,44 +154,69 @@ function stationaryThumbstickTouchMove(thumbstickFrame, thumbstickOuter, touchLo ) end -function followThumbstickTouchMove(thumbstickFrame, thumbstickOuter, touchLocation) +function followThumbstickTouchMove( + thumbstickFrame, + thumbstickOuter, + touchLocation +) local thumbstickOuterCenter = Vector2.new( thumbstickOuter.Position.X.Offset + thumbstickOuter.AbsoluteSize.x / 2, thumbstickOuter.Position.Y.Offset + thumbstickOuter.AbsoluteSize.y / 2 ) -- thumbstick is moving outside our region, need to position outer thumbstick texture carefully (to make look and feel like actual joystick controller) - if DistanceBetweenTwoPoints(touchLocation, thumbstickOuterCenter) > thumbstickSize / 2 then + if + DistanceBetweenTwoPoints(touchLocation, thumbstickOuterCenter) + > thumbstickSize / 2 + then local thumbstickInnerCenter = Vector2.new( - thumbstickFrame.Position.X.Offset + thumbstickFrame.AbsoluteSize.x / 2, - thumbstickFrame.Position.Y.Offset + thumbstickFrame.AbsoluteSize.y / 2 + thumbstickFrame.Position.X.Offset + + thumbstickFrame.AbsoluteSize.x / 2, + thumbstickFrame.Position.Y.Offset + + thumbstickFrame.AbsoluteSize.y / 2 ) - local movementVectorUnit = - Vector2.new(touchLocation.x - thumbstickInnerCenter.x, touchLocation.y - thumbstickInnerCenter.y).unit + local movementVectorUnit = Vector2.new( + touchLocation.x - thumbstickInnerCenter.x, + touchLocation.y - thumbstickInnerCenter.y + ).unit local outerToInnerVectorCurrent = Vector2.new( thumbstickInnerCenter.x - thumbstickOuterCenter.x, thumbstickInnerCenter.y - thumbstickOuterCenter.y ) local outerToInnerVectorCurrentUnit = outerToInnerVectorCurrent.unit - local movementVector = - Vector2.new(touchLocation.x - thumbstickInnerCenter.x, touchLocation.y - thumbstickInnerCenter.y) + local movementVector = Vector2.new( + touchLocation.x - thumbstickInnerCenter.x, + touchLocation.y - thumbstickInnerCenter.y + ) -- First, find the angle between the new thumbstick movement vector, -- and the vector between thumbstick inner and thumbstick outer. -- We will use this to pivot thumbstick outer around thumbstick inner, gives a nice joystick feel - local crossOuterToInnerWithMovement = (outerToInnerVectorCurrentUnit.x * movementVectorUnit.y) - - (outerToInnerVectorCurrentUnit.y * movementVectorUnit.x) - local angle = - math.atan2(crossOuterToInnerWithMovement, dotProduct(outerToInnerVectorCurrentUnit, movementVectorUnit)) - local anglePercent = angle * math.min(movementVector.magnitude / outerToInnerVectorCurrent.magnitude, 1.0) + local crossOuterToInnerWithMovement = ( + outerToInnerVectorCurrentUnit.x * movementVectorUnit.y + ) - (outerToInnerVectorCurrentUnit.y * movementVectorUnit.x) + local angle = math.atan2( + crossOuterToInnerWithMovement, + dotProduct(outerToInnerVectorCurrentUnit, movementVectorUnit) + ) + local anglePercent = angle + * math.min( + movementVector.magnitude / outerToInnerVectorCurrent.magnitude, + 1.0 + ) -- If angle is significant, rotate about the inner thumbsticks current center if math.abs(anglePercent) > 0.00001 then - local outerThumbCenter = - rotatePointAboutLocation(thumbstickOuterCenter, thumbstickInnerCenter, anglePercent) - thumbstickOuter.Position = - transformFromCenterToTopLeft(Vector2.new(outerThumbCenter.x, outerThumbCenter.y), thumbstickOuter) + local outerThumbCenter = rotatePointAboutLocation( + thumbstickOuterCenter, + thumbstickInnerCenter, + anglePercent + ) + thumbstickOuter.Position = transformFromCenterToTopLeft( + Vector2.new(outerThumbCenter.x, outerThumbCenter.y), + thumbstickOuter + ) end -- now just translate outer thumbstick to make sure it stays nears inner thumbstick @@ -186,13 +228,27 @@ function followThumbstickTouchMove(thumbstickFrame, thumbstickOuter, touchLocati ) end - thumbstickFrame.Position = transformFromCenterToTopLeft(touchLocation, thumbstickFrame) + thumbstickFrame.Position = + transformFromCenterToTopLeft(touchLocation, thumbstickFrame) -- a bit of error checking to make sure thumbsticks stay close to eachother - local thumbstickFramePosition = Vector2.new(thumbstickFrame.Position.X.Offset, thumbstickFrame.Position.Y.Offset) - local thumbstickOuterPosition = Vector2.new(thumbstickOuter.Position.X.Offset, thumbstickOuter.Position.Y.Offset) - if DistanceBetweenTwoPoints(thumbstickFramePosition, thumbstickOuterPosition) > thumbstickSize / 2 then - local vectorWithLength = (thumbstickOuterPosition - thumbstickFramePosition).unit * thumbstickSize / 2 + local thumbstickFramePosition = Vector2.new( + thumbstickFrame.Position.X.Offset, + thumbstickFrame.Position.Y.Offset + ) + local thumbstickOuterPosition = Vector2.new( + thumbstickOuter.Position.X.Offset, + thumbstickOuter.Position.Y.Offset + ) + if + DistanceBetweenTwoPoints( + thumbstickFramePosition, + thumbstickOuterPosition + ) > thumbstickSize / 2 + then + local vectorWithLength = ( + thumbstickOuterPosition - thumbstickFramePosition + ).unit * thumbstickSize / 2 thumbstickOuter.Position = UDim2.new( 0, thumbstickFramePosition.x + vectorWithLength.x, @@ -208,10 +264,17 @@ function followThumbstickTouchMove(thumbstickFrame, thumbstickOuter, touchLocati end function movementOutsideDeadZone(movementVector) - return ((math.abs(movementVector.x) > ThumbstickDeadZone) or (math.abs(movementVector.y) > ThumbstickDeadZone)) + return ( + (math.abs(movementVector.x) > ThumbstickDeadZone) + or (math.abs(movementVector.y) > ThumbstickDeadZone) + ) end -function constructThumbstick(defaultThumbstickPos, updateFunction, stationaryThumbstick) +function constructThumbstick( + defaultThumbstickPos, + updateFunction, + stationaryThumbstick +) local thumbstickFrame = Instance.new "Frame" thumbstickFrame.Name = "ThumbstickFrame" thumbstickFrame.Active = true @@ -235,7 +298,8 @@ function constructThumbstick(defaultThumbstickPos, updateFunction, stationaryThu innerThumbstick.ImageRectOffset = Vector2.new(220, 0) innerThumbstick.ImageRectSize = Vector2.new(111, 111) innerThumbstick.BackgroundTransparency = 1 - innerThumbstick.Size = UDim2.new(0, thumbstickSize / 2, 0, thumbstickSize / 2) + innerThumbstick.Size = + UDim2.new(0, thumbstickSize / 2, 0, thumbstickSize / 2) innerThumbstick.Position = UDim2.new( 0, thumbstickFrame.Size.X.Offset / 2 - thumbstickSize / 4, @@ -245,9 +309,9 @@ function constructThumbstick(defaultThumbstickPos, updateFunction, stationaryThu innerThumbstick.Parent = thumbstickFrame innerThumbstick.ZIndex = 2 - local thumbstickTouch = nil - local userInputServiceTouchMovedCon = nil - local userInputSeviceTouchEndedCon = nil + local thumbstickTouch + local userInputServiceTouchMovedCon + local userInputSeviceTouchEndedCon local startInputTracking = function(inputObject) if thumbstickTouch then @@ -266,52 +330,68 @@ function constructThumbstick(defaultThumbstickPos, updateFunction, stationaryThu thumbstickTouch = inputObject table.insert(thumbstickTouches, thumbstickTouch) - thumbstickFrame.Position = transformFromCenterToTopLeft(thumbstickTouch.Position, thumbstickFrame) + thumbstickFrame.Position = transformFromCenterToTopLeft( + thumbstickTouch.Position, + thumbstickFrame + ) outerThumbstick.Position = thumbstickFrame.Position - userInputServiceTouchMovedCon = userInputService.TouchMoved:connect(function(movedInput) - if movedInput == thumbstickTouch then - local movementVector = nil - if stationaryThumbstick then - movementVector = stationaryThumbstickTouchMove( - thumbstickFrame, - outerThumbstick, - Vector2.new(movedInput.Position.x, movedInput.Position.y) - ) - else - movementVector = followThumbstickTouchMove( - thumbstickFrame, - outerThumbstick, - Vector2.new(movedInput.Position.x, movedInput.Position.y) - ) - end + userInputServiceTouchMovedCon = userInputService.TouchMoved:connect( + function(movedInput) + if movedInput == thumbstickTouch then + local movementVector + if stationaryThumbstick then + movementVector = stationaryThumbstickTouchMove( + thumbstickFrame, + outerThumbstick, + Vector2.new( + movedInput.Position.x, + movedInput.Position.y + ) + ) + else + movementVector = followThumbstickTouchMove( + thumbstickFrame, + outerThumbstick, + Vector2.new( + movedInput.Position.x, + movedInput.Position.y + ) + ) + end - if updateFunction then - updateFunction(movementVector, outerThumbstick.Size.X.Offset / 2) - end - end - end) - userInputSeviceTouchEndedCon = userInputService.TouchEnded:connect(function(endedInput) - if endedInput == thumbstickTouch then - if updateFunction then - updateFunction(Vector2.new(0, 0), 1) - end - - userInputSeviceTouchEndedCon:disconnect() - userInputServiceTouchMovedCon:disconnect() - - thumbstickFrame.Position = defaultThumbstickPos - outerThumbstick.Position = defaultThumbstickPos - - for i, object in pairs(thumbstickTouches) do - if object == thumbstickTouch then - table.remove(thumbstickTouches, i) - break + if updateFunction then + updateFunction( + movementVector, + outerThumbstick.Size.X.Offset / 2 + ) end end - thumbstickTouch = nil end - end) + ) + userInputSeviceTouchEndedCon = userInputService.TouchEnded:connect( + function(endedInput) + if endedInput == thumbstickTouch then + if updateFunction then + updateFunction(Vector2.new(0, 0), 1) + end + + userInputSeviceTouchEndedCon:disconnect() + userInputServiceTouchMovedCon:disconnect() + + thumbstickFrame.Position = defaultThumbstickPos + outerThumbstick.Position = defaultThumbstickPos + + for i, object in pairs(thumbstickTouches) do + if object == thumbstickTouch then + table.remove(thumbstickTouches, i) + break + end + end + thumbstickTouch = nil + end + end + ) end userInputService.Changed:connect(function(prop) @@ -335,28 +415,43 @@ function setupCharacterMovement(parentFrame) lastMaxMovement = maxMovement -- sometimes rounding error will not allow us to go max speed at some -- thumbstick angles, fix this with a bit of fudging near 100% throttle - if movementVector.magnitude / maxMovement > ThumbstickMaxPercentGive then + if + movementVector.magnitude / maxMovement + > ThumbstickMaxPercentGive + then maxMovement = movementVector.magnitude - 1 end moveCharacterFunc(localPlayer, movementVector, maxMovement) else lastMovementVector = Vector2.new(0, 0) lastMaxMovement = 1 - moveCharacterFunc(localPlayer, lastMovementVector, lastMaxMovement) + moveCharacterFunc( + localPlayer, + lastMovementVector, + lastMaxMovement + ) end end end - local thumbstickPos = UDim2.new(0, thumbstickSize / 2, 1, -thumbstickSize * 1.75) + local thumbstickPos = + UDim2.new(0, thumbstickSize / 2, 1, -thumbstickSize * 1.75) if isSmallScreenDevice() then - thumbstickPos = UDim2.new(0, (thumbstickSize / 2) - 10, 1, -thumbstickSize - 20) + thumbstickPos = + UDim2.new(0, (thumbstickSize / 2) - 10, 1, -thumbstickSize - 20) end - local characterThumbstick = constructThumbstick(thumbstickPos, moveCharacterFunction, false) + local characterThumbstick = + constructThumbstick(thumbstickPos, moveCharacterFunction, false) characterThumbstick.Name = "CharacterThumbstick" characterThumbstick.Parent = parentFrame local refreshCharacterMovement = function() - if localPlayer and moveCharacterFunc and lastMovementVector and lastMaxMovement then + if + localPlayer + and moveCharacterFunc + and lastMovementVector + and lastMaxMovement + then moveCharacterFunc(localPlayer, lastMovementVector, lastMaxMovement) end end @@ -372,9 +467,11 @@ function setupJumpButton(parentFrame) jumpButton.ImageRectSize = Vector2.new(174, 174) jumpButton.Size = UDim2.new(0, jumpButtonSize, 0, jumpButtonSize) if isSmallScreenDevice() then - jumpButton.Position = UDim2.new(1, -(jumpButtonSize * 2.25), 1, -jumpButtonSize - 20) + jumpButton.Position = + UDim2.new(1, -(jumpButtonSize * 2.25), 1, -jumpButtonSize - 20) else - jumpButton.Position = UDim2.new(1, -(jumpButtonSize * 2.75), 1, -jumpButtonSize - 120) + jumpButton.Position = + UDim2.new(1, -(jumpButtonSize * 2.75), 1, -jumpButtonSize - 120) end local playerJumpFunc = localPlayer.JumpCharacter @@ -464,16 +561,16 @@ function isTouchUsedByThumbstick(touch) end function setupCameraControl(parentFrame, refreshCharacterMoveFunc) - local lastPos = nil + local lastPos local hasRotatedCamera = false local rotateCameraFunc = userInputService.RotateCamera local pinchTime = -1 local shouldPinch = false - local lastPinchScale = nil + local lastPinchScale local zoomCameraFunc = userInputService.ZoomCamera local pinchTouches = {} - local pinchFrame = nil + local pinchFrame local resetCameraRotateState = function() cameraTouch = nil @@ -509,35 +606,48 @@ function setupCameraControl(parentFrame, refreshCharacterMoveFunc) if lastPinchScale == nil then -- first pinch move, just set up scale if inputObject == firstTouch then - lastPinchScale = (inputObject.Position - secondTouch.Position).magnitude + lastPinchScale = ( + inputObject.Position - secondTouch.Position + ).magnitude firstTouch = inputObject elseif inputObject == secondTouch then - lastPinchScale = (inputObject.Position - firstTouch.Position).magnitude + lastPinchScale = ( + inputObject.Position - firstTouch.Position + ).magnitude secondTouch = inputObject end else -- we are now actually pinching, do comparison to last pinch size local newPinchDistance = 0 if inputObject == firstTouch then - newPinchDistance = (inputObject.Position - secondTouch.Position).magnitude + newPinchDistance = ( + inputObject.Position - secondTouch.Position + ).magnitude firstTouch = inputObject elseif inputObject == secondTouch then - newPinchDistance = (inputObject.Position - firstTouch.Position).magnitude + newPinchDistance = ( + inputObject.Position - firstTouch.Position + ).magnitude secondTouch = inputObject end if newPinchDistance ~= 0 then local pinchDiff = newPinchDistance - lastPinchScale if pinchDiff ~= 0 then - zoomCameraFunc(userInputService, (pinchDiff * CameraZoomSensitivity)) + zoomCameraFunc( + userInputService, + (pinchDiff * CameraZoomSensitivity) + ) end lastPinchScale = newPinchDistance end end end) - pinchFrame.InputEnded:connect(function(inputObject) -- pinch is over, destroy all - if inputObject == firstTouch or inputObject == secondTouch then - resetPinchState() + pinchFrame.InputEnded:connect( + function(inputObject) -- pinch is over, destroy all + if inputObject == firstTouch or inputObject == secondTouch then + resetPinchState() + end end - end) + ) end local pinchGestureReceivedTouch = function(inputObject) @@ -572,7 +682,8 @@ function setupCameraControl(parentFrame, refreshCharacterMoveFunc) if cameraTouch == nil and not usedByThumbstick then cameraTouch = inputObject - lastPos = Vector2.new(cameraTouch.Position.x, cameraTouch.Position.y) + lastPos = + Vector2.new(cameraTouch.Position.x, cameraTouch.Position.y) -- lastTick = tick() end end) @@ -584,11 +695,15 @@ function setupCameraControl(parentFrame, refreshCharacterMoveFunc) return end - local newPos = Vector2.new(cameraTouch.Position.x, cameraTouch.Position.y) + local newPos = + Vector2.new(cameraTouch.Position.x, cameraTouch.Position.y) local touchDiff = (lastPos - newPos) * CameraRotateSensitivity -- first time rotating outside deadzone, just setup for next changed event - if not hasRotatedCamera and (touchDiff.magnitude > CameraRotateDeadZone) then + if + not hasRotatedCamera + and (touchDiff.magnitude > CameraRotateDeadZone) + then hasRotatedCamera = true lastPos = newPos end @@ -630,7 +745,10 @@ function setupTouchControls() end -- kill camera pan if the touch is used by some user controls - if inputObject == cameraTouch and inputObject.UserInputState == Enum.UserInputState.Begin then + if + inputObject == cameraTouch + and inputObject.UserInputState == Enum.UserInputState.Begin + then cameraTouch = nil end end) diff --git a/lua/157877000.lua b/lua/157877000.lua index 0bc6726..92a8c82 100644 --- a/lua/157877000.lua +++ b/lua/157877000.lua @@ -1,3 +1,4 @@ +print "[Mercury]: Loaded corescript 157877000" --Include local Create = assert(LoadLibrary "RbxUtility").Create @@ -257,7 +258,7 @@ function initializeDeveloperConsole() Position = UDim2.new(0, 0, 0.5, -8), Rotation = 180, Size = UDim2.new(1, 0, 0, 16), - Image = "http://www.roblox.com/Asset?id=151205881", + Image = "http://banland.xyz/Asset?id=151205881", } local Dev_DownButton = Create "ImageButton" { @@ -276,7 +277,7 @@ function initializeDeveloperConsole() Position = UDim2.new(0, 3, 0, 3), Size = UDim2.new(0, 14, 0, 14), Rotation = 180, - Image = "http://www.roblox.com/Asset?id=151205813", + Image = "http://banland.xyz/Asset?id=151205813", } local Dev_UpButton = Create "ImageButton" { @@ -294,7 +295,7 @@ function initializeDeveloperConsole() BackgroundTransparency = 1, Position = UDim2.new(0, 3, 0, 3), Size = UDim2.new(0, 14, 0, 14), - Image = "http://www.roblox.com/Asset?id=151205813", + Image = "http://banland.xyz/Asset?id=151205813", } local Dev_TextBox = Create "Frame" { @@ -331,7 +332,7 @@ function initializeDeveloperConsole() Position = UDim2.new(0, 0, 0, 0), Size = UDim2.new(1, 0, 1, 0), Rotation = 0, - Image = "http://www.roblox.com/Asset?id=152093917", + Image = "http://banland.xyz/Asset?id=152093917", } local Dev_ResizeButton = Create "ImageButton" { @@ -350,7 +351,7 @@ function initializeDeveloperConsole() Position = UDim2.new(0, 6, 0, 6), Size = UDim2.new(0.8, 0, 0.8, 0), Rotation = 135, - Image = "http://www.roblox.com/Asset?id=151205813", + Image = "http://banland.xyz/Asset?id=151205813", } Create "TextButton" { @@ -405,7 +406,7 @@ function initializeDeveloperConsole() BackgroundTransparency = 1, Position = UDim2.new(0, 3, 0, 3), Size = UDim2.new(0, 14, 0, 14), - Image = "http://www.roblox.com/Asset?id=151205852", + Image = "http://banland.xyz/Asset?id=151205852", } Create "TextButton" { @@ -433,17 +434,17 @@ function initializeDeveloperConsole() } ---Saved Mouse Information - local previousMousePos = nil - local pPos = nil + local previousMousePos + local pPos - local previousMousePosResize = nil - local pSize = nil + local previousMousePosResize + local pSize - local previousMousePosScroll = nil + local previousMousePosScroll - local pScrollHandle = nil + local pScrollHandle - local pOffset = nil + local pOffset local scrollUpIsDown = false local scrollDownIsDown = false @@ -467,7 +468,8 @@ function initializeDeveloperConsole() end local delta = Vector2.new(x, y) - previousMousePos - Dev_Container.Position = UDim2.new(0, pPos.X + delta.X, 0, pPos.Y + delta.Y) + Dev_Container.Position = + UDim2.new(0, pPos.X + delta.X, 0, pPos.Y + delta.Y) end Dev_TitleBar.TextButton.MouseButton1Down:connect(function(x, y) @@ -486,8 +488,12 @@ function initializeDeveloperConsole() end local delta = Vector2.new(x, y) - previousMousePosResize - Dev_Container.Size = - UDim2.new(0, math.max(pSize.X + delta.X, minimumSize.X), 0, math.max(pSize.Y + delta.Y, minimumSize.Y)) + Dev_Container.Size = UDim2.new( + 0, + math.max(pSize.X + delta.X, minimumSize.X), + 0, + math.max(pSize.Y + delta.Y, minimumSize.Y) + ) end Dev_Container.Body.ResizeButton.MouseButton1Down:connect(function(x, y) previousMousePosResize = Vector2.new(x, y) @@ -526,10 +532,14 @@ function initializeDeveloperConsole() local x = frameNumber / 5 local smoothStep = x * x * (3 - (2 * x)) Dev_OptionsButton.ImageLabel.Rotation = smoothStep * 5 * 9 - Dev_OptionsBar.Position = UDim2.new(0, (smoothStep * 5 * 50) - 250, 0, 4) + Dev_OptionsBar.Position = + UDim2.new(0, (smoothStep * 5 * 50) - 250, 0, 4) wait() - if (frameNumber <= 0 and optionsHidden) or (frameNumber >= 5 and not optionsHidden) then + if + (frameNumber <= 0 and optionsHidden) + or (frameNumber >= 5 and not optionsHidden) + then animating = false end until not animating @@ -591,15 +601,23 @@ function initializeDeveloperConsole() end if - (outputToggleOn or messageList[i].Type ~= Enum.MessageType.MessageOutput) + ( + outputToggleOn + or messageList[i].Type ~= Enum.MessageType.MessageOutput + ) and (infoToggleOn or messageList[i].Type ~= Enum.MessageType.MessageInfo) and (warningToggleOn or messageList[i].Type ~= Enum.MessageType.MessageWarning) - and (errorToggleOn or messageList[i].Type ~= Enum.MessageType.MessageError) + and ( + errorToggleOn + or messageList[i].Type ~= Enum.MessageType.MessageError + ) then message.TextWrapped = wordWrapToggleOn message.Size = UDim2.new(0.98, 0, 0, 2000) message.Parent = Dev_Container - message.Text = messageList[i].Time .. " -- " .. messageList[i].Message + message.Text = messageList[i].Time + .. " -- " + .. messageList[i].Message message.Size = UDim2.new(0.98, 0, 0, message.TextBounds.Y) message.Position = UDim2.new(0, 5, 0, posOffset) @@ -609,7 +627,10 @@ function initializeDeveloperConsole() if movePosition then if (currentConsole == LOCAL_CONSOLE and localOffset > 0) - or (currentConsole == SERVER_CONSOLE and serverOffset > 0) + or ( + currentConsole == SERVER_CONSOLE + and serverOffset > 0 + ) then changeOffset(message.TextBounds.Y) end @@ -621,7 +642,9 @@ function initializeDeveloperConsole() message.TextColor3 = Color3.new(1, 0, 0) elseif messageList[i].Type == Enum.MessageType.MessageInfo then message.TextColor3 = Color3.new(0.4, 0.5, 1) - elseif messageList[i].Type == Enum.MessageType.MessageWarning then + elseif + messageList[i].Type == Enum.MessageType.MessageWarning + then message.TextColor3 = Color3.new(1, 0.6, 0.4) else message.TextColor3 = Color3.new(1, 1, 1) @@ -708,10 +731,16 @@ function initializeDeveloperConsole() local delta = (Vector2.new(x, y) - previousMousePosScroll).Y - local backRatio = 1 - (Dev_Container.Body.TextBox.AbsoluteSize.Y / Dev_TextHolder.AbsoluteSize.Y) + local backRatio = 1 + - ( + Dev_Container.Body.TextBox.AbsoluteSize.Y + / Dev_TextHolder.AbsoluteSize.Y + ) - local movementSize = Dev_ScrollArea.AbsoluteSize.Y - Dev_ScrollArea.Handle.AbsoluteSize.Y - local normalDelta = math.max(math.min(delta, movementSize), 0 - movementSize) + local movementSize = Dev_ScrollArea.AbsoluteSize.Y + - Dev_ScrollArea.Handle.AbsoluteSize.Y + local normalDelta = + math.max(math.min(delta, movementSize), 0 - movementSize) local normalRatio = normalDelta / movementSize local textMovementSize = (backRatio * Dev_TextHolder.AbsoluteSize.Y) @@ -741,7 +770,12 @@ function initializeDeveloperConsole() local function existsInsideContainer(container, x, y) local pos = container.AbsolutePosition local size = container.AbsoluteSize - if x < pos.X or x > pos.X + size.X or y < pos.y or y > pos.y + size.y then + if + x < pos.X + or x > pos.X + size.X + or y < pos.y + or y > pos.y + size.y + then return false end return true @@ -750,21 +784,30 @@ function initializeDeveloperConsole() --Refresh Dev-Console Message Positions function repositionList() if currentConsole == LOCAL_CONSOLE then - localOffset = math.min(math.max(localOffset, 0), textHolderSize - Dev_Container.Body.TextBox.AbsoluteSize.Y) + localOffset = math.min( + math.max(localOffset, 0), + textHolderSize - Dev_Container.Body.TextBox.AbsoluteSize.Y + ) Dev_TextHolder.Size = UDim2.new(1, 0, 0, textHolderSize) elseif currentConsole == SERVER_CONSOLE then - serverOffset = - math.min(math.max(serverOffset, 0), textHolderSize - Dev_Container.Body.TextBox.AbsoluteSize.Y) + serverOffset = math.min( + math.max(serverOffset, 0), + textHolderSize - Dev_Container.Body.TextBox.AbsoluteSize.Y + ) Dev_TextHolder.Size = UDim2.new(1, 0, 0, textHolderSize) end - local ratio = Dev_Container.Body.TextBox.AbsoluteSize.Y / Dev_TextHolder.AbsoluteSize.Y + local ratio = Dev_Container.Body.TextBox.AbsoluteSize.Y + / Dev_TextHolder.AbsoluteSize.Y if ratio >= 1 then Dev_Container.Body.ScrollBar.Visible = false Dev_Container.Body.TextBox.Size = UDim2.new(1, -4, 1, -28) - if currentConsole == LOCAL_CONSOLE or currentConsole == SERVER_CONSOLE then + if + currentConsole == LOCAL_CONSOLE + or currentConsole == SERVER_CONSOLE + then Dev_TextHolder.Position = UDim2.new(0, 0, 1, 0 - textHolderSize) end else @@ -782,7 +825,8 @@ function initializeDeveloperConsole() local topRatio = math.max(0, backRatio - offsetRatio) - local scrollHandleSize = math.max(Dev_ScrollArea.AbsoluteSize.Y * ratio, 21) + local scrollHandleSize = + math.max(Dev_ScrollArea.AbsoluteSize.Y * ratio, 21) local scrollRatio = scrollHandleSize / Dev_ScrollArea.AbsoluteSize.Y local ratioConversion = (1 - scrollRatio) / (1 - ratio) @@ -798,9 +842,11 @@ function initializeDeveloperConsole() Dev_ScrollArea.Handle.Position = UDim2.new(0, 0, 0, sPos) if currentConsole == LOCAL_CONSOLE then - Dev_TextHolder.Position = UDim2.new(0, 0, 1, 0 - textHolderSize + localOffset) + Dev_TextHolder.Position = + UDim2.new(0, 0, 1, 0 - textHolderSize + localOffset) elseif currentConsole == SERVER_CONSOLE then - Dev_TextHolder.Position = UDim2.new(0, 0, 1, 0 - textHolderSize + serverOffset) + Dev_TextHolder.Position = + UDim2.new(0, 0, 1, 0 - textHolderSize + serverOffset) end end end @@ -862,15 +908,19 @@ function initializeDeveloperConsole() Dev_OptionsBar.WordWrapToggleButton.MouseButton1Down:connect(function(_, _) wordWrapToggleOn = not wordWrapToggleOn - Dev_OptionsBar.WordWrapToggleButton.CheckFrame.Visible = wordWrapToggleOn + Dev_OptionsBar.WordWrapToggleButton.CheckFrame.Visible = + wordWrapToggleOn refreshTextHolder() repositionList() end) ---Dev-Console Message Functionality function AddLocalMessage(str, messageType, timeStamp) - localMessageList[#localMessageList + 1] = - { Message = str, Time = ConvertTimeStamp(timeStamp), Type = messageType } + localMessageList[#localMessageList + 1] = { + Message = str, + Time = ConvertTimeStamp(timeStamp), + Type = messageType, + } while #localMessageList > MAX_LIST_SIZE do table.remove(localMessageList, 1) end @@ -881,8 +931,11 @@ function initializeDeveloperConsole() end function AddServerMessage(str, messageType, timeStamp) - serverMessageList[#serverMessageList + 1] = - { Message = str, Time = ConvertTimeStamp(timeStamp), Type = messageType } + serverMessageList[#serverMessageList + 1] = { + Message = str, + Time = ConvertTimeStamp(timeStamp), + Type = messageType, + } while #serverMessageList > MAX_LIST_SIZE do table.remove(serverMessageList, 1) end @@ -904,7 +957,9 @@ function initializeDeveloperConsole() localConsole.BackgroundTransparency = 0.6 serverConsole.BackgroundTransparency = 0.8 - if game:FindFirstChild "Players" and game.Players["LocalPlayer"] then + if + game:FindFirstChild "Players" and game.Players["LocalPlayer"] + then local mouse = game.Players.LocalPlayer:GetMouse() refreshConsolePosition(mouse.X, mouse.Y) refreshConsoleSize(mouse.X, mouse.Y) @@ -938,7 +993,9 @@ function initializeDeveloperConsole() serverConsole.BackgroundTransparency = 0.6 localConsole.BackgroundTransparency = 0.8 - if game:FindFirstChild "Players" and game.Players["LocalPlayer"] then + if + game:FindFirstChild "Players" and game.Players["LocalPlayer"] + then local mouse = game.Players.LocalPlayer:GetMouse() refreshConsolePosition(mouse.X, mouse.Y) refreshConsoleSize(mouse.X, mouse.Y) @@ -978,7 +1035,9 @@ function initializeDeveloperConsole() if not Dev_Container.Visible then return end - if existsInsideContainer(Dev_Container, LocalMouse.X, LocalMouse.Y) then + if + existsInsideContainer(Dev_Container, LocalMouse.X, LocalMouse.Y) + then changeOffset(10) end end) @@ -987,7 +1046,9 @@ function initializeDeveloperConsole() if not Dev_Container.Visible then return end - if existsInsideContainer(Dev_Container, LocalMouse.X, LocalMouse.Y) then + if + existsInsideContainer(Dev_Container, LocalMouse.X, LocalMouse.Y) + then changeOffset(-10) end end) @@ -1002,12 +1063,17 @@ function initializeDeveloperConsole() local history = game:GetService("LogService"):GetLogHistory() for i = 1, #history do - AddLocalMessage(history[i].message, history[i].messageType, history[i].timestamp) + AddLocalMessage( + history[i].message, + history[i].messageType, + history[i].timestamp + ) end - game:GetService("LogService").MessageOut:connect(function(message, messageType) - AddLocalMessage(message, messageType, os.time()) - end) + game:GetService("LogService").MessageOut + :connect(function(message, messageType) + AddLocalMessage(message, messageType, os.time()) + end) game:GetService("LogService").ServerMessageOut:connect(AddServerMessage) end diff --git a/lua/36868950.lua b/lua/36868950.lua index 455d653..1bcd706 100644 --- a/lua/36868950.lua +++ b/lua/36868950.lua @@ -1,3 +1,4 @@ +print "[Mercury]: Loaded corescript 36868950" local controlFrame = script.Parent:FindFirstChild "ControlFrame" if not controlFrame then @@ -34,9 +35,14 @@ function setUpListeners(frameToListen) frameToListen.inside.Value = true wait(1.2) if frameToListen.inside.Value then - while frameToListen.inside.Value and frameToListen.BackgroundTransparency > 0 do - frameToListen.BackgroundTransparency = frameToListen.BackgroundTransparency - fadeSpeed - frameToListen.TextTransparency = frameToListen.TextTransparency - fadeSpeed + while + frameToListen.inside.Value + and frameToListen.BackgroundTransparency > 0 + do + frameToListen.BackgroundTransparency = frameToListen.BackgroundTransparency + - fadeSpeed + frameToListen.TextTransparency = frameToListen.TextTransparency + - fadeSpeed wait() end end diff --git a/lua/37801172.lua b/lua/37801172.lua index 79efa68..8f4dcd6 100644 --- a/lua/37801172.lua +++ b/lua/37801172.lua @@ -1,14 +1,20 @@ --- Creates all neccessary scripts for the gui on initial load, everything except build tools --- Created by Ben T. 10/29/10 --- Please note that these are loaded in a specific order to diminish errors/perceived load time by user +print "[Mercury]: Loaded corescript 37801172" local scriptContext = game:GetService "ScriptContext" + +-- Creates all neccessary scripts for the gui on initial load, everything except build tools +-- Please note that these are loaded in a specific order to diminish errors/perceived load time by user + local touchEnabled = false pcall(function() touchEnabled = game:GetService("UserInputService").TouchEnabled end) -- library registration -scriptContext:AddCoreScript(60595695, scriptContext, "/Libraries/LibraryRegistration/LibraryRegistration") +scriptContext:AddCoreScript( + 60595695, + scriptContext, + "/Libraries/LibraryRegistration/LibraryRegistration" +) local function waitForChild(instance, name) while not instance:FindFirstChild(name) do @@ -22,7 +28,6 @@ end -- end -- Responsible for tracking logging items -local scriptContext = game:GetService "ScriptContext" scriptContext:AddCoreScript(59002209, scriptContext, "CoreScripts/Sections") waitForChild(game:GetService "CoreGui", "RobloxGui") @@ -34,36 +39,64 @@ if not touchEnabled then -- SettingsScript scriptContext:AddCoreScript(46295863, screenGui, "CoreScripts/Settings") else - scriptContext:AddCoreScript(153556783, screenGui, "CoreScripts/TouchControls") + scriptContext:AddCoreScript( + 153556783, + screenGui, + "CoreScripts/TouchControls" + ) end -- MainBotChatScript -scriptContext:AddCoreScript(39250920, screenGui, "CoreScripts/MainBotChatScript") +scriptContext:AddCoreScript( + 39250920, + screenGui, + "CoreScripts/MainBotChatScript" +) -- Popup Script scriptContext:AddCoreScript(48488451, screenGui, "CoreScripts/PopupScript") -- Friend Notification Script (probably can use this script to expand out to other notifications) -scriptContext:AddCoreScript(48488398, screenGui, "CoreScripts/NotificationScript") +scriptContext:AddCoreScript( + 48488398, + screenGui, + "CoreScripts/NotificationScript" +) -- Chat script scriptContext:AddCoreScript(97188756, screenGui, "CoreScripts/ChatScript") -- Purchase Prompt Script -scriptContext:AddCoreScript(107893730, screenGui, "CoreScripts/PurchasePromptScript") +scriptContext:AddCoreScript( + 107893730, + screenGui, + "CoreScripts/PurchasePromptScript" +) if not touchEnabled or screenGui.AbsoluteSize.Y > 600 then -- New Player List - scriptContext:AddCoreScript(48488235, screenGui, "CoreScripts/PlayerListScript") + scriptContext:AddCoreScript( + 48488235, + screenGui, + "CoreScripts/PlayerListScript" + ) else delay(5, function() if screenGui.AbsoluteSize.Y >= 600 then -- New Player List - scriptContext:AddCoreScript(48488235, screenGui, "CoreScripts/PlayerListScript") + scriptContext:AddCoreScript( + 48488235, + screenGui, + "CoreScripts/PlayerListScript" + ) end end) end if game.CoreGui.Version >= 3 and game.PlaceId ~= 130815926 then --todo: remove placeid hack for halloween -- Backpack Builder, creates most of the backpack gui - scriptContext:AddCoreScript(53878047, screenGui, "CoreScripts/BackpackScripts/BackpackBuilder") + scriptContext:AddCoreScript( + 53878047, + screenGui, + "CoreScripts/BackpackScripts/BackpackBuilder" + ) waitForChild(screenGui, "CurrentLoadout") waitForChild(screenGui, "Backpack") @@ -71,33 +104,59 @@ if game.CoreGui.Version >= 3 and game.PlaceId ~= 130815926 then --todo: remove p -- Manager handles all big backpack state changes, other scripts subscribe to this and do things accordingly if game.CoreGui.Version >= 7 then - scriptContext:AddCoreScript(89449093, Backpack, "CoreScripts/BackpackScripts/BackpackManager") + scriptContext:AddCoreScript( + 89449093, + Backpack, + "CoreScripts/BackpackScripts/BackpackManager" + ) end -- Backpack Gear (handles all backpack gear tab stuff) - game:GetService("ScriptContext"):AddCoreScript(89449008, Backpack, "CoreScripts/BackpackScripts/BackpackGear") + game:GetService("ScriptContext"):AddCoreScript( + 89449008, + Backpack, + "CoreScripts/BackpackScripts/BackpackGear" + ) -- Loadout Script, used for gear hotkeys - scriptContext:AddCoreScript(53878057, screenGui.CurrentLoadout, "CoreScripts/BackpackScripts/LoadoutScript") + scriptContext:AddCoreScript( + 53878057, + screenGui.CurrentLoadout, + "CoreScripts/BackpackScripts/LoadoutScript" + ) if game.CoreGui.Version >= 8 then -- Wardrobe script handles all character dressing operations - scriptContext:AddCoreScript(-1, Backpack, "CoreScripts/BackpackScripts/BackpackWardrobe") + scriptContext:AddCoreScript( + -1, + Backpack, + "CoreScripts/BackpackScripts/BackpackWardrobe" + ) end end local IsPersonalServer = not not game.Workspace:FindFirstChild "PSVariable" if IsPersonalServer then - game:GetService("ScriptContext"):AddCoreScript(64164692, game.Players.LocalPlayer, "BuildToolManager") + game:GetService("ScriptContext") + :AddCoreScript(64164692, game.Players.LocalPlayer, "BuildToolManager") end game.Workspace.ChildAdded:connect(function(nchild) if nchild.Name == "PSVariable" and nchild:IsA "BoolValue" then IsPersonalServer = true - game:GetService("ScriptContext"):AddCoreScript(64164692, game.Players.LocalPlayer, "BuildToolManager") + game:GetService("ScriptContext") + :AddCoreScript( + 64164692, + game.Players.LocalPlayer, + "BuildToolManager" + ) end end) if touchEnabled then -- touch devices don't use same control frame -- only used for touch device button generation - scriptContext:AddCoreScript(152908679, screenGui, "CoreScripts/ContextActionTouch") + scriptContext:AddCoreScript( + 152908679, + screenGui, + "CoreScripts/ContextActionTouch" + ) waitForChild(screenGui, "ControlFrame") waitForChild(screenGui.ControlFrame, "BottomLeftControl") diff --git a/lua/38037565.lua b/lua/38037565.lua index ea37dbe..26bddcd 100644 --- a/lua/38037565.lua +++ b/lua/38037565.lua @@ -1,3 +1,4 @@ +print "[Mercury]: Loaded corescript 38037565" local damageGuiWidth = 5.0 local damageGuiHeight = 5.0 @@ -133,9 +134,17 @@ while true do if regen then delta = delta + regen.Value.X if regen.Value.Y >= 0 then - regen.Value = Vector3.new(regen.Value.X + regen.Value.Z, regen.Value.Y - s, regen.Value.Z) -- maybe have 3rd parameter be an increaser/decreaser? + regen.Value = Vector3.new( + regen.Value.X + regen.Value.Z, + regen.Value.Y - s, + regen.Value.Z + ) -- maybe have 3rd parameter be an increaser/decreaser? elseif regen.Value.Y == -1 then - regen.Value = Vector3.new(regen.Value.X + regen.Value.Z, -1, regen.Value.Z) + regen.Value = Vector3.new( + regen.Value.X + regen.Value.Z, + -1, + regen.Value.Z + ) else regen:remove() end -- infinity is -1 @@ -143,9 +152,17 @@ while true do if poison then delta = delta - poison.Value.X if poison.Value.Y >= 0 then - poison.Value = Vector3.new(poison.Value.X + poison.Value.Z, poison.Value.Y - s, poison.Value.Z) + poison.Value = Vector3.new( + poison.Value.X + poison.Value.Z, + poison.Value.Y - s, + poison.Value.Z + ) elseif poison.Value.Y == -1 then - poison.Value = Vector3.new(poison.Value.X + poison.Value.Z, -1, poison.Value.Z) + poison.Value = Vector3.new( + poison.Value.X + poison.Value.Z, + -1, + poison.Value.Z + ) else poison:remove() end -- infinity is -1 @@ -155,7 +172,8 @@ while true do --print("IN ICE") delta = delta - ice.Value.X if ice.Value.Y >= 0 then - ice.Value = Vector3.new(ice.Value.X, ice.Value.Y - s, ice.Value.Z) + ice.Value = + Vector3.new(ice.Value.X, ice.Value.Y - s, ice.Value.Z) else ice:remove() end @@ -166,7 +184,11 @@ while true do fireEffect.Parent = Figure.Torso delta = delta - fire.Value.X if fire.Value.Y >= 0 then - fire.Value = Vector3.new(fire.Value.X, fire.Value.Y - s, fire.Value.Z) + fire.Value = Vector3.new( + fire.Value.X, + fire.Value.Y - s, + fire.Value.Z + ) else fire:remove() fireEffect.Enabled = false @@ -178,7 +200,9 @@ while true do if stun.Value > 0 then Torso.Anchored = true currentChildren = script.Parent:GetChildren() - backpackTools = game.Players:GetPlayerFromCharacter(script.Parent).Backpack:GetChildren() + backpackTools = game.Players + :GetPlayerFromCharacter(script.Parent).Backpack + :GetChildren() for i = 1, #currentChildren do if currentChildren[i].className == "Tool" then inCharTag:Clone().Parent = currentChildren[i] @@ -187,20 +211,25 @@ while true do end end for i = 1, #backpackTools do - if backpackTools[i]:FindFirstChild "RobloxBuildTool" == nil then + if + backpackTools[i]:FindFirstChild "RobloxBuildTool" + == nil + then hider:Clone().Parent = backpackTools[i] backpackTools[i].Parent = game.Lighting end end wait(0.2) for i = 1, #backpackTools do - backpackTools[i].Parent = game.Players:GetPlayerFromCharacter(script.Parent).Backpack + backpackTools[i].Parent = + game.Players:GetPlayerFromCharacter(script.Parent).Backpack end stun.Value = stun.Value - s else Torso.Anchored = false for i = 1, #backpackTools do - local rbTool = backpackTools[i]:FindFirstChild "RobloxBuildTool" + local rbTool = + backpackTools[i]:FindFirstChild "RobloxBuildTool" if rbTool then rbTool:Remove() end @@ -208,12 +237,16 @@ while true do end wait(0.2) for i = 1, #backpackTools do - local wasInChar = backpackTools[i]:FindFirstChild "InCharTag" + local wasInChar = + backpackTools[i]:FindFirstChild "InCharTag" if wasInChar then wasInChar:Remove() backpackTools[i].Parent = script.Parent else - backpackTools[i].Parent = game.Players:GetPlayerFromCharacter(script.Parent).Backpack + backpackTools[i].Parent = + game.Players:GetPlayerFromCharacter( + script.Parent + ).Backpack end end stun:Remove() diff --git a/lua/39250920.lua b/lua/39250920.lua index 0f1f30a..787afa9 100644 --- a/lua/39250920.lua +++ b/lua/39250920.lua @@ -1,3 +1,4 @@ +print "[Mercury]: Loaded corescript 39250920" function waitForProperty(instance, name) while not instance[name] do instance.Changed:wait() @@ -33,7 +34,7 @@ local reenableDialogScript local dialogMap = {} local dialogConnections = {} -local gui = nil +local gui waitForChild(game, "CoreGui") waitForChild(game.CoreGui, "RobloxGui") if game.CoreGui.RobloxGui:FindFirstChild "ControlFrame" then @@ -102,31 +103,39 @@ end function styleMainFrame(tone) if tone == Enum.DialogTone.Neutral then mainFrame.Style = Enum.FrameStyle.ChatBlue - mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botBlue_tailRight.png" + mainFrame.Tail.Image = + "rbxasset://textures/chatBubble_botBlue_tailRight.png" elseif tone == Enum.DialogTone.Friendly then mainFrame.Style = Enum.FrameStyle.ChatGreen - mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botGreen_tailRight.png" + mainFrame.Tail.Image = + "rbxasset://textures/chatBubble_botGreen_tailRight.png" elseif tone == Enum.DialogTone.Enemy then mainFrame.Style = Enum.FrameStyle.ChatRed - mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botRed_tailRight.png" + mainFrame.Tail.Image = + "rbxasset://textures/chatBubble_botRed_tailRight.png" end styleChoices(tone) end function setChatNotificationTone(gui, purpose, tone) if tone == Enum.DialogTone.Neutral then - gui.Image.Image = "rbxasset://textures/chatBubble_botBlue_notify_bkg.png" + gui.Image.Image = + "rbxasset://textures/chatBubble_botBlue_notify_bkg.png" elseif tone == Enum.DialogTone.Friendly then - gui.Image.Image = "rbxasset://textures/chatBubble_botGreen_notify_bkg.png" + gui.Image.Image = + "rbxasset://textures/chatBubble_botGreen_notify_bkg.png" elseif tone == Enum.DialogTone.Enemy then gui.Image.Image = "rbxasset://textures/chatBubble_botRed_notify_bkg.png" end if purpose == Enum.DialogPurpose.Quest then - gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_bang.png" + gui.Image.Button.Image = + "rbxasset://textures/chatBubble_bot_notify_bang.png" elseif purpose == Enum.DialogPurpose.Help then - gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_question.png" + gui.Image.Button.Image = + "rbxasset://textures/chatBubble_bot_notify_question.png" elseif purpose == Enum.DialogPurpose.Shop then - gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_money.png" + gui.Image.Button.Image = + "rbxasset://textures/chatBubble_bot_notify_money.png" end end @@ -243,7 +252,11 @@ function selectChoice(choice) --First hide the Gui mainFrame.Visible = false if choice == lastChoice then - game.Chat:Chat(game.Players.LocalPlayer.Character, "Goodbye!", getChatColor(currentTone())) + game.Chat:Chat( + game.Players.LocalPlayer.Character, + "Goodbye!", + getChatColor(currentTone()) + ) normalEndDialog() else @@ -255,7 +268,10 @@ function selectChoice(choice) getChatColor(currentTone()) ) wait(1) - currentConversationDialog:SignalDialogChoiceSelected(player, dialogChoice) + currentConversationDialog:SignalDialogChoiceSelected( + player, + dialogChoice + ) game.Chat:Chat( currentConversationPartner, sanitizeMessage(dialogChoice.ResponseDialog), @@ -263,7 +279,10 @@ function selectChoice(choice) ) variableDelay(dialogChoice.ResponseDialog) - presentDialogChoices(currentConversationPartner, dialogChoice:GetChildren()) + presentDialogChoices( + currentConversationPartner, + dialogChoice:GetChildren() + ) end end @@ -381,7 +400,8 @@ function presentDialogChoices(talkingPart, dialogChoices) --3 lines is the maximum, set it to that temporarily choices[pos].Size = UDim2.new(1, 0, 0, 24 * 3) choices[pos].UserPrompt.Text = obj.UserDialog - local height = math.ceil(choices[pos].UserPrompt.TextBounds.Y / 24) * 24 + local height = math.ceil(choices[pos].UserPrompt.TextBounds.Y / 24) + * 24 choices[pos].Position = UDim2.new(0, 0, 0, yPosition) choices[pos].Size = UDim2.new(1, 0, 0, height) @@ -417,7 +437,11 @@ function doDialog(dialog) end currentConversationDialog = dialog - game.Chat:Chat(dialog.Parent, dialog.InitialPrompt, getChatColor(dialog.Tone)) + game.Chat:Chat( + dialog.Parent, + dialog.InitialPrompt, + getChatColor(dialog.Tone) + ) variableDelay(dialog.InitialPrompt) presentDialogChoices(dialog.Parent, dialog:GetChildren()) @@ -440,8 +464,9 @@ function checkForLeaveArea() if currentConversationDialog.Parent and ( - player:DistanceFromCharacter(currentConversationDialog.Parent.Position) - >= currentConversationDialog.ConversationDistance + player:DistanceFromCharacter( + currentConversationDialog.Parent.Position + ) >= currentConversationDialog.ConversationDistance ) then wanderDialog() @@ -452,7 +477,10 @@ end function startDialog(dialog) if dialog.Parent and dialog.Parent:IsA "BasePart" then - if player:DistanceFromCharacter(dialog.Parent.Position) >= dialog.ConversationDistance then + if + player:DistanceFromCharacter(dialog.Parent.Position) + >= dialog.ConversationDistance + then showMessage(tooFarAwayMessage, tooFarAwaySize) return end @@ -502,12 +530,17 @@ function addDialog(dialog) removeDialog(dialog) addDialog(dialog) elseif prop == "InUse" then - chatGui.Enabled = not currentConversationDialog and not dialog.InUse + chatGui.Enabled = not currentConversationDialog + and not dialog.InUse if dialog == currentConversationDialog then timeoutDialog() end elseif prop == "Tone" or prop == "Purpose" then - setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone) + setChatNotificationTone( + chatGui, + dialog.Purpose, + dialog.Tone + ) end end) else -- still need to listen to parent changes even if current parent is not a BasePart diff --git a/lua/45284430.lua b/lua/45284430.lua index 5bf7042..2b2514e 100644 --- a/lua/45284430.lua +++ b/lua/45284430.lua @@ -1,7 +1,15 @@ +print "[Mercury]: Loaded corescript 45284430" local t = {} -local function ScopedConnect(parentInstance, instance, event, signalFunc, syncFunc, removeFunc) - local eventConnection = nil +local function ScopedConnect( + parentInstance, + instance, + event, + signalFunc, + syncFunc, + removeFunc +) + local eventConnection --Connection on parentInstance is scoped by parentInstance (when destroyed, it goes away) local tryConnect = function() @@ -81,9 +89,14 @@ local function CreateButtons(frame, buttons, yPos, ySize) buttonNum = 1 while buttonNum <= numButtons do - buttonObjs[buttonNum].Position = - UDim2.new(spacing * buttonNum + (buttonNum - 1) * buttonSize, 0, yPos.Scale, yPos.Offset) - buttonObjs[buttonNum].Size = UDim2.new(buttonSize, 0, ySize.Scale, ySize.Offset) + buttonObjs[buttonNum].Position = UDim2.new( + spacing * buttonNum + (buttonNum - 1) * buttonSize, + 0, + yPos.Scale, + yPos.Offset + ) + buttonObjs[buttonNum].Size = + UDim2.new(buttonSize, 0, ySize.Scale, ySize.Offset) buttonNum = buttonNum + 1 end end @@ -91,7 +104,10 @@ end local function setSliderPos(newAbsPosX, slider, sliderPosition, bar, steps) local newStep = steps - 1 --otherwise we really get one more step than we want - local relativePosX = math.min(1, math.max(0, (newAbsPosX - bar.AbsolutePosition.X) / bar.AbsoluteSize.X)) + local relativePosX = math.min( + 1, + math.max(0, (newAbsPosX - bar.AbsolutePosition.X) / bar.AbsoluteSize.X) + ) local wholeNum, remainder = math.modf(relativePosX * newStep) if remainder > 0.5 then wholeNum = wholeNum + 1 @@ -101,8 +117,12 @@ local function setSliderPos(newAbsPosX, slider, sliderPosition, bar, steps) local result = math.ceil(relativePosX * newStep) if sliderPosition.Value ~= (result + 1) then --only update if we moved a step sliderPosition.Value = result + 1 - slider.Position = - UDim2.new(relativePosX, -slider.AbsoluteSize.X / 2, slider.Position.Y.Scale, slider.Position.Y.Offset) + slider.Position = UDim2.new( + relativePosX, + -slider.AbsoluteSize.X / 2, + slider.Position.Y.Scale, + slider.Position.Y.Offset + ) end end @@ -127,13 +147,13 @@ t.CreateStyledMessageDialog = function(title, message, style, buttons) styleImage.Position = UDim2.new(0, 5, 0, 15) if style == "error" or style == "Error" then styleImage.Size = UDim2.new(0, 71, 0, 71) - styleImage.Image = "http://www.roblox.com/asset?id=42565285" + styleImage.Image = "http://banland.xyz/asset?id=42565285" elseif style == "notify" or style == "Notify" then styleImage.Size = UDim2.new(0, 71, 0, 71) - styleImage.Image = "http://www.roblox.com/asset?id=42604978" + styleImage.Image = "http://banland.xyz/asset?id=42604978" elseif style == "confirm" or style == "Confirm" then styleImage.Size = UDim2.new(0, 74, 0, 76) - styleImage.Image = "http://www.roblox.com/asset?id=42557901" + styleImage.Image = "http://banland.xyz/asset?id=42557901" else return t.CreateMessageDialog(title, message, buttons) end @@ -241,7 +261,7 @@ t.CreateDropDownMenu = function(items, onSelect, forRoblox) local dropDownIcon = Instance.new "ImageLabel" dropDownIcon.Name = "Icon" dropDownIcon.Active = false - dropDownIcon.Image = "http://www.roblox.com/asset/?id=45732894" + dropDownIcon.Image = "http://banland.xyz/asset/?id=45732894" dropDownIcon.BackgroundTransparency = 1 dropDownIcon.Size = UDim2.new(0, 11, 0, 6) dropDownIcon.Position = UDim2.new(1, -11, 0.5, -2) @@ -281,9 +301,11 @@ t.CreateDropDownMenu = function(items, onSelect, forRoblox) choiceButton.Font = Enum.Font.Arial choiceButton.FontSize = Enum.FontSize.Size18 if useScrollButtons then - choiceButton.Size = UDim2.new(1, -13, 0.8 / ((dropDownItemCount + 1) * 0.8), 0) + choiceButton.Size = + UDim2.new(1, -13, 0.8 / ((dropDownItemCount + 1) * 0.8), 0) else - choiceButton.Size = UDim2.new(1, 0, 0.8 / ((dropDownItemCount + 1) * 0.8), 0) + choiceButton.Size = + UDim2.new(1, 0, 0.8 / ((dropDownItemCount + 1) * 0.8), 0) end choiceButton.TextWrap = true choiceButton.ZIndex = 2 @@ -330,7 +352,8 @@ t.CreateDropDownMenu = function(items, onSelect, forRoblox) scrollUpButton.Active = scrollBarPosition > 1 end if scrollDownButton then - scrollDownButton.Active = scrollBarPosition + dropDownItemCount <= itemCount + scrollDownButton.Active = scrollBarPosition + dropDownItemCount + <= itemCount end local children = droppedDownMenu:GetChildren() @@ -341,11 +364,19 @@ t.CreateDropDownMenu = function(items, onSelect, forRoblox) local childNum = 1 for _, obj in ipairs(children) do if obj.Name == "ChoiceButton" then - if childNum < scrollBarPosition or childNum >= scrollBarPosition + dropDownItemCount then + if + childNum < scrollBarPosition + or childNum >= scrollBarPosition + dropDownItemCount + then obj.Visible = false else - obj.Position = - UDim2.new(0, 0, ((childNum - scrollBarPosition + 1) * 0.8) / ((dropDownItemCount + 1) * 0.8), 0) + obj.Position = UDim2.new( + 0, + 0, + ((childNum - scrollBarPosition + 1) * 0.8) + / ((dropDownItemCount + 1) * 0.8), + 0 + ) obj.Visible = true end obj.TextColor3 = Color3.new(1, 1, 1) @@ -430,7 +461,8 @@ t.CreateDropDownMenu = function(items, onSelect, forRoblox) scrollUpButton.BackgroundTransparency = 1 scrollUpButton.Image = "rbxasset://textures/ui/scrollbuttonUp.png" scrollUpButton.Size = UDim2.new(0, 17, 0, 17) - scrollUpButton.Position = UDim2.new(1, -11, (1 * 0.8) / ((dropDownItemCount + 1) * 0.8), 0) + scrollUpButton.Position = + UDim2.new(1, -11, (1 * 0.8) / ((dropDownItemCount + 1) * 0.8), 0) scrollUpButton.MouseButton1Click:connect(function() scrollMouseCount = scrollMouseCount + 1 end) @@ -484,8 +516,18 @@ t.CreateDropDownMenu = function(items, onSelect, forRoblox) scrollbar.Name = "ScrollBar" scrollbar.Image = "rbxasset://textures/ui/scrollbar.png" scrollbar.BackgroundTransparency = 1 - scrollbar.Size = UDim2.new(0, 18, (dropDownItemCount * 0.8) / ((dropDownItemCount + 1) * 0.8), -17 - 11 - 4) - scrollbar.Position = UDim2.new(1, -11, (1 * 0.8) / ((dropDownItemCount + 1) * 0.8), 17 + 2) + scrollbar.Size = UDim2.new( + 0, + 18, + (dropDownItemCount * 0.8) / ((dropDownItemCount + 1) * 0.8), + -17 - 11 - 4 + ) + scrollbar.Position = UDim2.new( + 1, + -11, + (1 * 0.8) / ((dropDownItemCount + 1) * 0.8), + 17 + 2 + ) scrollbar.Parent = droppedDownMenu end @@ -627,13 +669,24 @@ local function layoutGuiObjectsHelper(frame, guiObjects, settingsTable) if child:IsA "TextLabel" or child:IsA "TextButton" then local isLabel = child:IsA "TextLabel" if isLabel then - pixelsRemaining = pixelsRemaining - settingsTable["TextLabelPositionPadY"] + pixelsRemaining = pixelsRemaining + - settingsTable["TextLabelPositionPadY"] else - pixelsRemaining = pixelsRemaining - settingsTable["TextButtonPositionPadY"] + pixelsRemaining = pixelsRemaining + - settingsTable["TextButtonPositionPadY"] end - child.Position = - UDim2.new(child.Position.X.Scale, child.Position.X.Offset, 0, totalPixels - pixelsRemaining) - child.Size = UDim2.new(child.Size.X.Scale, child.Size.X.Offset, 0, pixelsRemaining) + child.Position = UDim2.new( + child.Position.X.Scale, + child.Position.X.Offset, + 0, + totalPixels - pixelsRemaining + ) + child.Size = UDim2.new( + child.Size.X.Scale, + child.Size.X.Offset, + 0, + pixelsRemaining + ) if child.TextFits and child.TextBounds.Y < pixelsRemaining then child.Visible = true @@ -654,14 +707,21 @@ local function layoutGuiObjectsHelper(frame, guiObjects, settingsTable) end while not child.TextFits do - child.Size = UDim2.new(child.Size.X.Scale, child.Size.X.Offset, 0, child.AbsoluteSize.Y + 1) + child.Size = UDim2.new( + child.Size.X.Scale, + child.Size.X.Offset, + 0, + child.AbsoluteSize.Y + 1 + ) end pixelsRemaining = pixelsRemaining - child.AbsoluteSize.Y if isLabel then - pixelsRemaining = pixelsRemaining - settingsTable["TextLabelPositionPadY"] + pixelsRemaining = pixelsRemaining + - settingsTable["TextLabelPositionPadY"] else - pixelsRemaining = pixelsRemaining - settingsTable["TextButtonPositionPadY"] + pixelsRemaining = pixelsRemaining + - settingsTable["TextButtonPositionPadY"] end else child.Visible = false @@ -669,8 +729,12 @@ local function layoutGuiObjectsHelper(frame, guiObjects, settingsTable) end else --GuiObject - child.Position = - UDim2.new(child.Position.X.Scale, child.Position.X.Offset, 0, totalPixels - pixelsRemaining) + child.Position = UDim2.new( + child.Position.X.Scale, + child.Position.X.Offset, + 0, + totalPixels - pixelsRemaining + ) pixelsRemaining = pixelsRemaining - child.AbsoluteSize.Y child.Visible = (pixelsRemaining >= 0) end @@ -798,7 +862,7 @@ t.CreateSlider = function(steps, width, position) slider.ZIndex = 3 slider.Parent = bar - local areaSoakMouseMoveCon = nil + local areaSoakMouseMoveCon areaSoak.MouseLeave:connect(function() if areaSoak.Visible then @@ -826,10 +890,15 @@ t.CreateSlider = function(steps, width, position) end) sliderPosition.Changed:connect(function(_) - sliderPosition.Value = math.min(steps, math.max(1, sliderPosition.Value)) + sliderPosition.Value = + math.min(steps, math.max(1, sliderPosition.Value)) local relativePosX = (sliderPosition.Value - 1) / (steps - 1) - slider.Position = - UDim2.new(relativePosX, -slider.AbsoluteSize.X / 2, slider.Position.Y.Scale, slider.Position.Y.Offset) + slider.Position = UDim2.new( + relativePosX, + -slider.AbsoluteSize.X / 2, + slider.Position.Y.Scale, + slider.Position.Y.Offset + ) end) bar.MouseButton1Down:connect(function(x, _) @@ -840,11 +909,11 @@ t.CreateSlider = function(steps, width, position) end t.CreateTrueScrollingFrame = function() - local lowY = nil - local highY = nil + local lowY + local highY - local dragCon = nil - local upCon = nil + local dragCon + local upCon local internalChange = false @@ -995,17 +1064,31 @@ t.CreateTrueScrollingFrame = function() local oldPos = scrollbar.Position if y < scrollTrack.AbsolutePosition.y then - scrollbar.Position = UDim2.new(scrollbar.Position.X.Scale, scrollbar.Position.X.Offset, 0, 0) + scrollbar.Position = UDim2.new( + scrollbar.Position.X.Scale, + scrollbar.Position.X.Offset, + 0, + 0 + ) return (oldPos ~= scrollbar.Position) end - local relativeSize = scrollbar.AbsoluteSize.Y / scrollTrack.AbsoluteSize.Y + local relativeSize = scrollbar.AbsoluteSize.Y + / scrollTrack.AbsoluteSize.Y - if y > (scrollTrack.AbsolutePosition.y + scrollTrack.AbsoluteSize.y) then - scrollbar.Position = UDim2.new(scrollbar.Position.X.Scale, scrollbar.Position.X.Offset, 1 - relativeSize, 0) + if + y > (scrollTrack.AbsolutePosition.y + scrollTrack.AbsoluteSize.y) + then + scrollbar.Position = UDim2.new( + scrollbar.Position.X.Scale, + scrollbar.Position.X.Offset, + 1 - relativeSize, + 0 + ) return (oldPos ~= scrollbar.Position) end - local newScaleYPos = (y - scrollTrack.AbsolutePosition.y - offset) / scrollTrack.AbsoluteSize.y + local newScaleYPos = (y - scrollTrack.AbsolutePosition.y - offset) + / scrollTrack.AbsoluteSize.y if newScaleYPos + relativeSize > 1 then newScaleYPos = 1 - relativeSize scrollBottom.Value = true @@ -1018,7 +1101,12 @@ t.CreateTrueScrollingFrame = function() scrollUp.Value = false scrollBottom.Value = false end - scrollbar.Position = UDim2.new(scrollbar.Position.X.Scale, scrollbar.Position.X.Offset, newScaleYPos, 0) + scrollbar.Position = UDim2.new( + scrollbar.Position.X.Scale, + scrollbar.Position.X.Offset, + newScaleYPos, + 0 + ) return (oldPos ~= scrollbar.Position) end @@ -1040,7 +1128,13 @@ t.CreateTrueScrollingFrame = function() if (lowY and lowY > instance.AbsolutePosition.Y) or not lowY then lowY = instance.AbsolutePosition.Y end - if (highY and highY < (instance.AbsolutePosition.Y + instance.AbsoluteSize.Y)) or not highY then + if + ( + highY + and highY + < (instance.AbsolutePosition.Y + instance.AbsoluteSize.Y) + ) or not highY + then highY = instance.AbsolutePosition.Y + instance.AbsoluteSize.Y end local children = instance:GetChildren() @@ -1064,7 +1158,10 @@ t.CreateTrueScrollingFrame = function() if scrollbar.Position.Y.Scale > 0 then if scrollbar.Visible then percentFrame = scrollbar.Position.Y.Scale - / ((scrollTrack.AbsoluteSize.Y - scrollbar.AbsoluteSize.Y) / scrollTrack.AbsoluteSize.Y) + / ( + (scrollTrack.AbsoluteSize.Y - scrollbar.AbsoluteSize.Y) + / scrollTrack.AbsoluteSize.Y + ) else percentFrame = 0 end @@ -1073,7 +1170,8 @@ t.CreateTrueScrollingFrame = function() percentFrame = 1 end - local hiddenYAmount = (scrollingFrame.AbsoluteSize.Y - (highY - lowY)) * percentFrame + local hiddenYAmount = (scrollingFrame.AbsoluteSize.Y - (highY - lowY)) + * percentFrame local guiChildren = scrollingFrame:GetChildren() for i = 1, #guiChildren do @@ -1082,7 +1180,9 @@ t.CreateTrueScrollingFrame = function() guiChildren[i].Position.X.Scale, guiChildren[i].Position.X.Offset, 0, - math.ceil(guiChildren[i].AbsolutePosition.Y) - math.ceil(lowY) + hiddenYAmount + math.ceil(guiChildren[i].AbsolutePosition.Y) + - math.ceil(lowY) + + hiddenYAmount ) end end @@ -1126,10 +1226,16 @@ t.CreateTrueScrollingFrame = function() scrollDownButton.Visible = true scrollUpButton.Visible = true - scrollbar.Size = UDim2.new(scrollbar.Size.X.Scale, scrollbar.Size.X.Offset, percentShown, 0) + scrollbar.Size = UDim2.new( + scrollbar.Size.X.Scale, + scrollbar.Size.X.Offset, + percentShown, + 0 + ) end - local percentPosition = (scrollingFrame.AbsolutePosition.Y - lowY) / totalYSpan + local percentPosition = (scrollingFrame.AbsolutePosition.Y - lowY) + / totalYSpan scrollbar.Position = UDim2.new( scrollbar.Position.X.Scale, scrollbar.Position.X.Offset, @@ -1138,15 +1244,26 @@ t.CreateTrueScrollingFrame = function() ) if scrollbar.AbsolutePosition.y < scrollTrack.AbsolutePosition.y then - scrollbar.Position = UDim2.new(scrollbar.Position.X.Scale, scrollbar.Position.X.Offset, 0, 0) + scrollbar.Position = UDim2.new( + scrollbar.Position.X.Scale, + scrollbar.Position.X.Offset, + 0, + 0 + ) end if (scrollbar.AbsolutePosition.y + scrollbar.AbsoluteSize.Y) > (scrollTrack.AbsolutePosition.y + scrollTrack.AbsoluteSize.y) then - local relativeSize = scrollbar.AbsoluteSize.Y / scrollTrack.AbsoluteSize.Y - scrollbar.Position = UDim2.new(scrollbar.Position.X.Scale, scrollbar.Position.X.Offset, 1 - relativeSize, 0) + local relativeSize = scrollbar.AbsoluteSize.Y + / scrollTrack.AbsoluteSize.Y + scrollbar.Position = UDim2.new( + scrollbar.Position.X.Scale, + scrollbar.Position.X.Offset, + 1 - relativeSize, + 0 + ) end end @@ -1158,7 +1275,13 @@ t.CreateTrueScrollingFrame = function() end reentrancyGuardScrollUp = true - if positionScrollBar(0, scrollbar.AbsolutePosition.Y - buttonScrollAmountPixels, 0) then + if + positionScrollBar( + 0, + scrollbar.AbsolutePosition.Y - buttonScrollAmountPixels, + 0 + ) + then recalculate() end reentrancyGuardScrollUp = false @@ -1171,7 +1294,13 @@ t.CreateTrueScrollingFrame = function() end reentrancyGuardScrollDown = true - if positionScrollBar(0, scrollbar.AbsolutePosition.Y + buttonScrollAmountPixels, 0) then + if + positionScrollBar( + 0, + scrollbar.AbsolutePosition.Y + buttonScrollAmountPixels, + 0 + ) + then recalculate() end reentrancyGuardScrollDown = false @@ -1227,7 +1356,11 @@ t.CreateTrueScrollingFrame = function() local w = 0.1 while scrollStamp == current do doScrollDown() - if mouseYPos and mouseYPos < (scrollbar.AbsolutePosition.y + scrollbar.AbsoluteSize.x) then + if + mouseYPos + and mouseYPos + < (scrollbar.AbsolutePosition.y + scrollbar.AbsoluteSize.x) + then break end if not scrollDownButton.Active then @@ -1339,9 +1472,11 @@ t.CreateTrueScrollingFrame = function() highLowRecheck() end - descendantsChangeConMap[instance] = instance.Changed:connect(function(prop) - descendantChanged(instance, prop) - end) + descendantsChangeConMap[instance] = instance.Changed:connect( + function(prop) + descendantChanged(instance, prop) + end + ) end) scrollingFrame.DescendantRemoving:connect(function(instance) @@ -1397,7 +1532,7 @@ t.CreateScrollingFrame = function(orderList, scrollStyle) local scrollStamp = 0 local scrollDrag = Instance.new "ImageButton" - scrollDrag.Image = "http://www.roblox.com/asset/?id=61367186" + scrollDrag.Image = "http://banland.xyz/asset/?id=61367186" scrollDrag.Size = UDim2.new(1, 0, 0, 16) scrollDrag.BackgroundTransparency = 1 scrollDrag.Name = "ScrollDrag" @@ -1527,7 +1662,9 @@ t.CreateScrollingFrame = function(orderList, scrollStyle) end --Do check last time if pos = 0 - if (pos == 0) and (pixelsBelowScrollbar + currentRowY <= totalPixelsY) then + if + (pos == 0) and (pixelsBelowScrollbar + currentRowY <= totalPixelsY) + then scrollPosition = 1 end @@ -1539,8 +1676,16 @@ t.CreateScrollingFrame = function(orderList, scrollStyle) local xOffset, yOffset = 0 if guiObjects[1] then - yOffset = math.ceil(math.floor(math.fmod(totalPixelsY, guiObjects[1].AbsoluteSize.X)) / 2) - xOffset = math.ceil(math.floor(math.fmod(totalPixelsX, guiObjects[1].AbsoluteSize.Y)) / 2) + yOffset = math.ceil( + math.floor( + math.fmod(totalPixelsY, guiObjects[1].AbsoluteSize.X) + ) / 2 + ) + xOffset = math.ceil( + math.floor( + math.fmod(totalPixelsX, guiObjects[1].AbsoluteSize.Y) + ) / 2 + ) end for i, child in ipairs(guiObjects) do @@ -1563,7 +1708,8 @@ t.CreateScrollingFrame = function(orderList, scrollStyle) setRowSize = false end xCounter = 0 - pixelsRemainingY = pixelsRemainingY - child.AbsoluteSize.Y + pixelsRemainingY = pixelsRemainingY + - child.AbsoluteSize.Y end child.Position = UDim2.new( child.Position.X.Scale, @@ -1572,7 +1718,9 @@ t.CreateScrollingFrame = function(orderList, scrollStyle) totalPixelsY - pixelsRemainingY + yOffset ) xCounter = xCounter + child.AbsoluteSize.X - child.Visible = ((pixelsRemainingY - child.AbsoluteSize.Y) >= 0) + child.Visible = ( + (pixelsRemainingY - child.AbsoluteSize.Y) >= 0 + ) if child.Visible then howManyDisplayed = howManyDisplayed + 1 end @@ -1630,11 +1778,16 @@ t.CreateScrollingFrame = function(orderList, scrollStyle) local pos = #guiObjects while pixelsBelowScrollbar < totalPixels and pos >= 1 do if pos >= scrollPosition then - pixelsBelowScrollbar = pixelsBelowScrollbar + guiObjects[pos].AbsoluteSize.Y + pixelsBelowScrollbar = pixelsBelowScrollbar + + guiObjects[pos].AbsoluteSize.Y else - if pixelsBelowScrollbar + guiObjects[pos].AbsoluteSize.Y <= totalPixels then + if + pixelsBelowScrollbar + guiObjects[pos].AbsoluteSize.Y + <= totalPixels + then --It fits, so back up our scroll position - pixelsBelowScrollbar = pixelsBelowScrollbar + guiObjects[pos].AbsoluteSize.Y + pixelsBelowScrollbar = pixelsBelowScrollbar + + guiObjects[pos].AbsoluteSize.Y if scrollPosition <= 1 then scrollPosition = 1 break @@ -1661,8 +1814,12 @@ t.CreateScrollingFrame = function(orderList, scrollStyle) else --print("Laying out " .. child.Name) --GuiObject - child.Position = - UDim2.new(child.Position.X.Scale, child.Position.X.Offset, 0, totalPixels - pixelsRemaining) + child.Position = UDim2.new( + child.Position.X.Scale, + child.Position.X.Offset, + 0, + totalPixels - pixelsRemaining + ) pixelsRemaining = pixelsRemaining - child.AbsoluteSize.Y if pixelsRemaining >= 0 then child.Visible = true @@ -1694,14 +1851,20 @@ t.CreateScrollingFrame = function(orderList, scrollStyle) return end - local dragSizeY = scrollDrag.Parent.AbsoluteSize.y * (1 / (guiObjects - howManyDisplayed + 1)) + local dragSizeY = scrollDrag.Parent.AbsoluteSize.y + * (1 / (guiObjects - howManyDisplayed + 1)) if dragSizeY < 16 then dragSizeY = 16 end - scrollDrag.Size = - UDim2.new(scrollDrag.Size.X.Scale, scrollDrag.Size.X.Offset, scrollDrag.Size.Y.Scale, dragSizeY) + scrollDrag.Size = UDim2.new( + scrollDrag.Size.X.Scale, + scrollDrag.Size.X.Offset, + scrollDrag.Size.Y.Scale, + dragSizeY + ) - local relativeYPos = (scrollPosition - 1) / (guiObjects - howManyDisplayed) + local relativeYPos = (scrollPosition - 1) + / (guiObjects - howManyDisplayed) if relativeYPos > 1 then relativeYPos = 1 elseif relativeYPos < 0 then @@ -1710,11 +1873,16 @@ t.CreateScrollingFrame = function(orderList, scrollStyle) local absYPos = 0 if relativeYPos ~= 0 then - absYPos = (relativeYPos * scrollbar.AbsoluteSize.y) - (relativeYPos * scrollDrag.AbsoluteSize.y) + absYPos = (relativeYPos * scrollbar.AbsoluteSize.y) + - (relativeYPos * scrollDrag.AbsoluteSize.y) end - scrollDrag.Position = - UDim2.new(scrollDrag.Position.X.Scale, scrollDrag.Position.X.Offset, scrollDrag.Position.Y.Scale, absYPos) + scrollDrag.Position = UDim2.new( + scrollDrag.Position.X.Scale, + scrollDrag.Position.X.Offset, + scrollDrag.Position.Y.Scale, + absYPos + ) end local reentrancyGuard = false @@ -1804,7 +1972,11 @@ t.CreateScrollingFrame = function(orderList, scrollStyle) local w = 0.1 while scrollStamp == current do doScrollDown() - if mouseYPos and mouseYPos < (scrollDrag.AbsolutePosition.y + scrollDrag.AbsoluteSize.x) then + if + mouseYPos + and mouseYPos + < (scrollDrag.AbsolutePosition.y + scrollDrag.AbsoluteSize.x) + then break end if not scrollDownButton.Active then @@ -1834,7 +2006,9 @@ t.CreateScrollingFrame = function(orderList, scrollStyle) local dragAbsSize = scrollDrag.AbsoluteSize.y local barAbsOne = barAbsPos + barAbsSize - dragAbsSize y = y - mouseOffset - y = y < barAbsPos and barAbsPos or y > barAbsOne and barAbsOne or y + y = y < barAbsPos and barAbsPos + or y > barAbsOne and barAbsOne + or y y = y - barAbsPos local guiObjects = 0 @@ -1850,7 +2024,9 @@ t.CreateScrollingFrame = function(orderList, scrollStyle) local doublePercent = y / (barAbsSize - dragAbsSize) local rowDiff = rowSize local totalScrollCount = guiObjects - (howManyDisplayed - 1) - local newScrollPosition = math.floor((doublePercent * totalScrollCount) + 0.5) + rowDiff + local newScrollPosition = math.floor( + (doublePercent * totalScrollCount) + 0.5 + ) + rowDiff if newScrollPosition < scrollPosition then rowDiff = -rowDiff end @@ -1987,9 +2163,9 @@ t.AutoTruncateTextObject = function(textLabel) fullLabel.Visible = false fullLabel.Parent = textLabel - local shortText = nil - local mouseEnterConnection = nil - local mouseLeaveConnection = nil + local shortText + local mouseEnterConnection + local mouseLeaveConnection local checkForResize = function() if getGuiOwner(textLabel) == nil then @@ -2029,10 +2205,14 @@ t.AutoTruncateTextObject = function(textLabel) end --Okay, now try to binary shrink it back down - local fullLabelSize = binaryShrink(textLabel.AbsoluteSize.X, fullLabel.AbsoluteSize.X, function(size) - fullLabel.Size = UDim2.new(0, size, 1, 0) - return fullLabel.TextFits - end) + local fullLabelSize = binaryShrink( + textLabel.AbsoluteSize.X, + fullLabel.AbsoluteSize.X, + function(size) + fullLabel.Size = UDim2.new(0, size, 1, 0) + return fullLabel.TextFits + end + ) fullLabel.Size = UDim2.new(0, fullLabelSize + 6, 1, 0) --Now setup the rollover effects, if they are currently off @@ -2069,7 +2249,12 @@ t.AutoTruncateTextObject = function(textLabel) return textLabel, changeText end -local function TransitionTutorialPages(fromPage, toPage, transitionFrame, currentPageValue) +local function TransitionTutorialPages( + fromPage, + toPage, + transitionFrame, + currentPageValue +) if fromPage then fromPage.Visible = false if transitionFrame.Visible == false then @@ -2149,7 +2334,7 @@ t.CreateTutorial = function(name, tutorialKey, createButtons) pages.Parent = frame local function getVisiblePageAndHideOthers() - local visiblePage = nil + local visiblePage local children = pages:GetChildren() if children then for _, child in ipairs(children) do @@ -2166,13 +2351,22 @@ t.CreateTutorial = function(name, tutorialKey, createButtons) end local showTutorial = function(alwaysShow) - if alwaysShow or UserSettings().GameSettings:GetTutorialState(tutorialKey) == false then + if + alwaysShow + or UserSettings().GameSettings:GetTutorialState(tutorialKey) + == false + then print("Showing tutorial-", tutorialKey) local currentTutorialPage = getVisiblePageAndHideOthers() local firstPage = pages:FindFirstChild "TutorialPage1" if firstPage then - TransitionTutorialPages(currentTutorialPage, firstPage, transitionFrame, currentPageValue) + TransitionTutorialPages( + currentTutorialPage, + firstPage, + transitionFrame, + currentPageValue + ) else error "Could not find TutorialPage1" end @@ -2183,7 +2377,12 @@ t.CreateTutorial = function(name, tutorialKey, createButtons) local currentTutorialPage = getVisiblePageAndHideOthers() if currentTutorialPage then - TransitionTutorialPages(currentTutorialPage, nil, transitionFrame, currentPageValue) + TransitionTutorialPages( + currentTutorialPage, + nil, + transitionFrame, + currentPageValue + ) end UserSettings().GameSettings:SetTutorialState(tutorialKey, true) @@ -2192,13 +2391,23 @@ t.CreateTutorial = function(name, tutorialKey, createButtons) local gotoPage = function(pageNum) local page = pages:FindFirstChild("TutorialPage" .. pageNum) local currentTutorialPage = getVisiblePageAndHideOthers() - TransitionTutorialPages(currentTutorialPage, page, transitionFrame, currentPageValue) + TransitionTutorialPages( + currentTutorialPage, + page, + transitionFrame, + currentPageValue + ) end return frame, showTutorial, dismissTutorial, gotoPage end -local function CreateBasicTutorialPage(name, handleResize, skipTutorial, giveDoneButton) +local function CreateBasicTutorialPage( + name, + handleResize, + skipTutorial, + giveDoneButton +) local frame = Instance.new "Frame" frame.Name = "TutorialPage" frame.Style = Enum.FrameStyle.RobloxRound @@ -2295,11 +2504,14 @@ local function CreateBasicTutorialPage(name, handleResize, skipTutorial, giveDon innerFrame.Size = UDim2.new(1, 0, 1, -22) end - local parentConnection = nil + local parentConnection local function basicHandleResize() if frame.Visible and frame.Parent then - local maxSize = math.min(frame.Parent.AbsoluteSize.X, frame.Parent.AbsoluteSize.Y) + local maxSize = math.min( + frame.Parent.AbsoluteSize.X, + frame.Parent.AbsoluteSize.Y + ) handleResize(200, maxSize) end end @@ -2311,12 +2523,14 @@ local function CreateBasicTutorialPage(name, handleResize, skipTutorial, giveDon parentConnection = nil end if frame.Parent and frame.Parent:IsA "GuiObject" then - parentConnection = frame.Parent.Changed:connect(function(parentProp) - if parentProp == "AbsoluteSize" then - wait() - basicHandleResize() + parentConnection = frame.Parent.Changed:connect( + function(parentProp) + if parentProp == "AbsoluteSize" then + wait() + basicHandleResize() + end end - end) + ) basicHandleResize() end end @@ -2330,8 +2544,8 @@ local function CreateBasicTutorialPage(name, handleResize, skipTutorial, giveDon end t.CreateTextTutorialPage = function(name, text, skipTutorialFunc) - local frame = nil - local contentFrame = nil + local frame + local contentFrame local textLabel = Instance.new "TextLabel" textLabel.BackgroundTransparency = 1 @@ -2353,15 +2567,23 @@ t.CreateTextTutorialPage = function(name, text, skipTutorialFunc) frame.Position = UDim2.new(0.5, -size / 2, 0.5, -size / 2) end - frame, contentFrame = CreateBasicTutorialPage(name, handleResize, skipTutorialFunc) + frame, contentFrame = + CreateBasicTutorialPage(name, handleResize, skipTutorialFunc) textLabel.Parent = contentFrame return frame end -t.CreateImageTutorialPage = function(name, imageAsset, x, y, skipTutorialFunc, giveDoneButton) - local frame = nil - local contentFrame = nil +t.CreateImageTutorialPage = function( + name, + imageAsset, + x, + y, + skipTutorialFunc, + giveDoneButton +) + local frame + local contentFrame local imageLabel = Instance.new "ImageLabel" imageLabel.BackgroundTransparency = 1 @@ -2392,7 +2614,12 @@ t.CreateImageTutorialPage = function(name, imageAsset, x, y, skipTutorialFunc, g frame.Position = UDim2.new(0.5, -size / 2, 0.5, -size / 2) end - frame, contentFrame = CreateBasicTutorialPage(name, handleResize, skipTutorialFunc, giveDoneButton) + frame, contentFrame = CreateBasicTutorialPage( + name, + handleResize, + skipTutorialFunc, + giveDoneButton + ) imageLabel.Parent = contentFrame return frame @@ -2420,7 +2647,12 @@ t.AddTutorialPage = function(tutorial, tutorialPage) error "NextButton already Active on previousPage, please only add pages with RbxGui.AddTutorialPage function" end previousPage.NextButton.MouseButton1Click:connect(function() - TransitionTutorialPages(previousPage, tutorialPage, transitionFrame, currentPageValue) + TransitionTutorialPages( + previousPage, + tutorialPage, + transitionFrame, + currentPageValue + ) end) previousPage.NextButton.Active = true previousPage.NextButton.Visible = true @@ -2429,7 +2661,12 @@ t.AddTutorialPage = function(tutorial, tutorialPage) error "PrevButton already Active on tutorialPage, please only add pages with RbxGui.AddTutorialPage function" end tutorialPage.PrevButton.MouseButton1Click:connect(function() - TransitionTutorialPages(tutorialPage, previousPage, transitionFrame, currentPageValue) + TransitionTutorialPages( + tutorialPage, + previousPage, + transitionFrame, + currentPageValue + ) end) tutorialPage.PrevButton.Active = true tutorialPage.PrevButton.Visible = true @@ -2443,845 +2680,943 @@ t.AddTutorialPage = function(tutorial, tutorialPage) end end -t.CreateSetPanel = - function(userIdsForSets, objectSelected, dialogClosed, size, position, showAdminCategories, useAssetVersionId) - if not userIdsForSets then - error "CreateSetPanel: userIdsForSets (first arg) is nil, should be a table of number ids" +t.CreateSetPanel = function( + userIdsForSets, + objectSelected, + dialogClosed, + size, + position, + showAdminCategories, + useAssetVersionId +) + if not userIdsForSets then + error "CreateSetPanel: userIdsForSets (first arg) is nil, should be a table of number ids" + end + if + type(userIdsForSets) ~= "table" + and type(userIdsForSets) ~= "userdata" + then + error( + "CreateSetPanel: userIdsForSets (first arg) is of type " + .. type(userIdsForSets) + .. ", should be of type table or userdata" + ) + end + if not objectSelected then + error "CreateSetPanel: objectSelected (second arg) is nil, should be a callback function!" + end + if type(objectSelected) ~= "function" then + error( + "CreateSetPanel: objectSelected (second arg) is of type " + .. type(objectSelected) + .. ", should be of type function!" + ) + end + if dialogClosed and type(dialogClosed) ~= "function" then + error( + "CreateSetPanel: dialogClosed (third arg) is of type " + .. type(dialogClosed) + .. ", should be of type function!" + ) + end + + if showAdminCategories == nil then -- by default, don't show beta sets + showAdminCategories = false + end + + local arrayPosition = 1 + local insertButtons = {} + local insertButtonCons = {} + local contents + local setGui + + -- used for water selections + local waterForceDirection = "NegX" + local waterForce = "None" + local waterGui, waterTypeChangedEvent = nil + + local Data = {} + Data.CurrentCategory = nil + Data.Category = {} + local SetCache = {} + + local userCategoryButtons + + local buttonWidth = 64 + local buttonHeight = buttonWidth + + local SmallThumbnailUrl + local LargeThumbnailUrl + local BaseUrl = game:GetService("ContentProvider").BaseUrl:lower() + + if useAssetVersionId then + LargeThumbnailUrl = BaseUrl + .. "Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=420&ht=420&assetversionid=" + SmallThumbnailUrl = BaseUrl + .. "Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=75&ht=75&assetversionid=" + else + LargeThumbnailUrl = BaseUrl + .. "Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=420&ht=420&aid=" + SmallThumbnailUrl = BaseUrl + .. "Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=75&ht=75&aid=" + end + + local function drillDownSetZIndex(parent, index) + local children = parent:GetChildren() + for i = 1, #children do + if children[i]:IsA "GuiObject" then + children[i].ZIndex = index + end + drillDownSetZIndex(children[i], index) end - if type(userIdsForSets) ~= "table" and type(userIdsForSets) ~= "userdata" then - error( - "CreateSetPanel: userIdsForSets (first arg) is of type " - .. type(userIdsForSets) - .. ", should be of type table or userdata" + end + + -- for terrain stamping + local currTerrainDropDownFrame + local terrainShapes = { + "Block", + "Vertical Ramp", + "Corner Wedge", + "Inverse Corner Wedge", + "Horizontal Ramp", + "Auto-Wedge", + } + local terrainShapeMap = {} + for i = 1, #terrainShapes do + terrainShapeMap[terrainShapes[i]] = i - 1 + end + terrainShapeMap[terrainShapes[#terrainShapes]] = 6 + + local function createWaterGui() + local waterForceDirections = { "NegX", "X", "NegY", "Y", "NegZ", "Z" } + local waterForces = { "None", "Small", "Medium", "Strong", "Max" } + + local waterFrame = Instance.new "Frame" + waterFrame.Name = "WaterFrame" + waterFrame.Style = Enum.FrameStyle.RobloxSquare + waterFrame.Size = UDim2.new(0, 150, 0, 110) + waterFrame.Visible = false + + local waterForceLabel = Instance.new "TextLabel" + waterForceLabel.Name = "WaterForceLabel" + waterForceLabel.BackgroundTransparency = 1 + waterForceLabel.Size = UDim2.new(1, 0, 0, 12) + waterForceLabel.Font = Enum.Font.ArialBold + waterForceLabel.FontSize = Enum.FontSize.Size12 + waterForceLabel.TextColor3 = Color3.new(1, 1, 1) + waterForceLabel.TextXAlignment = Enum.TextXAlignment.Left + waterForceLabel.Text = "Water Force" + waterForceLabel.Parent = waterFrame + + local waterForceDirLabel = waterForceLabel:Clone() + waterForceDirLabel.Name = "WaterForceDirectionLabel" + waterForceDirLabel.Text = "Water Force Direction" + waterForceDirLabel.Position = UDim2.new(0, 0, 0, 50) + waterForceDirLabel.Parent = waterFrame + + local waterTypeChangedEvent = Instance.new "BindableEvent" + waterTypeChangedEvent.Name = "WaterTypeChangedEvent" + waterTypeChangedEvent.Parent = waterFrame + + local waterForceDirectionSelectedFunc = function(newForceDirection) + waterForceDirection = newForceDirection + waterTypeChangedEvent:Fire { waterForce, waterForceDirection } + end + local waterForceSelectedFunc = function(newForce) + waterForce = newForce + waterTypeChangedEvent:Fire { waterForce, waterForceDirection } + end + + local waterForceDirectionDropDown, forceWaterDirectionSelection = + t.CreateDropDownMenu( + waterForceDirections, + waterForceDirectionSelectedFunc ) - end - if not objectSelected then - error "CreateSetPanel: objectSelected (second arg) is nil, should be a callback function!" - end - if type(objectSelected) ~= "function" then - error( - "CreateSetPanel: objectSelected (second arg) is of type " - .. type(objectSelected) - .. ", should be of type function!" - ) - end - if dialogClosed and type(dialogClosed) ~= "function" then - error( - "CreateSetPanel: dialogClosed (third arg) is of type " - .. type(dialogClosed) - .. ", should be of type function!" - ) - end + waterForceDirectionDropDown.Size = UDim2.new(1, 0, 0, 25) + waterForceDirectionDropDown.Position = UDim2.new(0, 0, 1, 3) + forceWaterDirectionSelection "NegX" + waterForceDirectionDropDown.Parent = waterForceDirLabel - if showAdminCategories == nil then -- by default, don't show beta sets - showAdminCategories = false - end + local waterForceDropDown, forceWaterForceSelection = + t.CreateDropDownMenu(waterForces, waterForceSelectedFunc) + forceWaterForceSelection "None" + waterForceDropDown.Size = UDim2.new(1, 0, 0, 25) + waterForceDropDown.Position = UDim2.new(0, 0, 1, 3) + waterForceDropDown.Parent = waterForceLabel - local arrayPosition = 1 - local insertButtons = {} - local insertButtonCons = {} - local contents = nil - local setGui = nil + return waterFrame, waterTypeChangedEvent + end - -- used for water selections - local waterForceDirection = "NegX" - local waterForce = "None" - local waterGui, waterTypeChangedEvent = nil + -- Helper Function that contructs gui elements + local function createSetGui() + local setGui = Instance.new "ScreenGui" + setGui.Name = "SetGui" - local Data = {} - Data.CurrentCategory = nil - Data.Category = {} - local SetCache = {} - - local userCategoryButtons = nil - - local buttonWidth = 64 - local buttonHeight = buttonWidth - - local SmallThumbnailUrl = nil - local LargeThumbnailUrl = nil - local BaseUrl = game:GetService("ContentProvider").BaseUrl:lower() - - if useAssetVersionId then - LargeThumbnailUrl = BaseUrl .. "Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=420&ht=420&assetversionid=" - SmallThumbnailUrl = BaseUrl .. "Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=75&ht=75&assetversionid=" + local setPanel = Instance.new "Frame" + setPanel.Name = "SetPanel" + setPanel.Active = true + setPanel.BackgroundTransparency = 1 + if position then + setPanel.Position = position else - LargeThumbnailUrl = BaseUrl .. "Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=420&ht=420&aid=" - SmallThumbnailUrl = BaseUrl .. "Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=75&ht=75&aid=" + setPanel.Position = UDim2.new(0.2, 29, 0.1, 24) + end + if size then + setPanel.Size = size + else + setPanel.Size = UDim2.new(0.6, -58, 0.64, 0) + end + setPanel.Style = Enum.FrameStyle.RobloxRound + setPanel.ZIndex = 6 + setPanel.Parent = setGui + + -- Children of SetPanel + local itemPreview = Instance.new "Frame" + itemPreview.Name = "ItemPreview" + itemPreview.BackgroundTransparency = 1 + itemPreview.Position = UDim2.new(0.8, 5, 0.085, 0) + itemPreview.Size = UDim2.new(0.21, 0, 0.9, 0) + itemPreview.ZIndex = 6 + itemPreview.Parent = setPanel + + -- Children of ItemPreview + local textPanel = Instance.new "Frame" + textPanel.Name = "TextPanel" + textPanel.BackgroundTransparency = 1 + textPanel.Position = UDim2.new(0, 0, 0.45, 0) + textPanel.Size = UDim2.new(1, 0, 0.55, 0) + textPanel.ZIndex = 6 + textPanel.Parent = itemPreview + + -- Children of TextPanel + local rolloverText = Instance.new "TextLabel" + rolloverText.Name = "RolloverText" + rolloverText.BackgroundTransparency = 1 + rolloverText.Size = UDim2.new(1, 0, 0, 48) + rolloverText.ZIndex = 6 + rolloverText.Font = Enum.Font.ArialBold + rolloverText.FontSize = Enum.FontSize.Size24 + rolloverText.Text = "" + rolloverText.TextColor3 = Color3.new(1, 1, 1) + rolloverText.TextWrap = true + rolloverText.TextXAlignment = Enum.TextXAlignment.Left + rolloverText.TextYAlignment = Enum.TextYAlignment.Top + rolloverText.Parent = textPanel + + local largePreview = Instance.new "ImageLabel" + largePreview.Name = "LargePreview" + largePreview.BackgroundTransparency = 1 + largePreview.Image = "" + largePreview.Size = UDim2.new(1, 0, 0, 170) + largePreview.ZIndex = 6 + largePreview.Parent = itemPreview + + local sets = Instance.new "Frame" + sets.Name = "Sets" + sets.BackgroundTransparency = 1 + sets.Position = UDim2.new(0, 0, 0, 5) + sets.Size = UDim2.new(0.23, 0, 1, -5) + sets.ZIndex = 6 + sets.Parent = setPanel + + -- Children of Sets + local line = Instance.new "Frame" + line.Name = "Line" + line.BackgroundColor3 = Color3.new(1, 1, 1) + line.BackgroundTransparency = 0.7 + line.BorderSizePixel = 0 + line.Position = UDim2.new(1, -3, 0.06, 0) + line.Size = UDim2.new(0, 3, 0.9, 0) + line.ZIndex = 6 + line.Parent = sets + + local setsLists, controlFrame = t.CreateTrueScrollingFrame() + setsLists.Size = UDim2.new(1, -6, 0.94, 0) + setsLists.Position = UDim2.new(0, 0, 0.06, 0) + setsLists.BackgroundTransparency = 1 + setsLists.Name = "SetsLists" + setsLists.ZIndex = 6 + setsLists.Parent = sets + drillDownSetZIndex(controlFrame, 7) + + local setsHeader = Instance.new "TextLabel" + setsHeader.Name = "SetsHeader" + setsHeader.BackgroundTransparency = 1 + setsHeader.Size = UDim2.new(0, 47, 0, 24) + setsHeader.ZIndex = 6 + setsHeader.Font = Enum.Font.ArialBold + setsHeader.FontSize = Enum.FontSize.Size24 + setsHeader.Text = "Sets" + setsHeader.TextColor3 = Color3.new(1, 1, 1) + setsHeader.TextXAlignment = Enum.TextXAlignment.Left + setsHeader.TextYAlignment = Enum.TextYAlignment.Top + setsHeader.Parent = sets + + local cancelButton = Instance.new "TextButton" + cancelButton.Name = "CancelButton" + cancelButton.Position = UDim2.new(1, -32, 0, -2) + cancelButton.Size = UDim2.new(0, 34, 0, 34) + cancelButton.Style = Enum.ButtonStyle.RobloxButtonDefault + cancelButton.ZIndex = 6 + cancelButton.Text = "" + cancelButton.Modal = true + cancelButton.Parent = setPanel + + -- Children of Cancel Button + local cancelImage = Instance.new "ImageLabel" + cancelImage.Name = "CancelImage" + cancelImage.BackgroundTransparency = 1 + cancelImage.Image = "http://banland.xyz/asset?id=54135717" + cancelImage.Position = UDim2.new(0, -2, 0, -2) + cancelImage.Size = UDim2.new(0, 16, 0, 16) + cancelImage.ZIndex = 6 + cancelImage.Parent = cancelButton + + return setGui + end + + local function createSetButton(text) + local setButton = Instance.new "TextButton" + + if text then + setButton.Text = text + else + setButton.Text = "" end - local function drillDownSetZIndex(parent, index) - local children = parent:GetChildren() - for i = 1, #children do - if children[i]:IsA "GuiObject" then - children[i].ZIndex = index - end - drillDownSetZIndex(children[i], index) - end - end + setButton.AutoButtonColor = false + setButton.BackgroundTransparency = 1 + setButton.BackgroundColor3 = Color3.new(1, 1, 1) + setButton.BorderSizePixel = 0 + setButton.Size = UDim2.new(1, -5, 0, 18) + setButton.ZIndex = 6 + setButton.Visible = false + setButton.Font = Enum.Font.Arial + setButton.FontSize = Enum.FontSize.Size18 + setButton.TextColor3 = Color3.new(1, 1, 1) + setButton.TextXAlignment = Enum.TextXAlignment.Left - -- for terrain stamping - local currTerrainDropDownFrame = nil - local terrainShapes = - { "Block", "Vertical Ramp", "Corner Wedge", "Inverse Corner Wedge", "Horizontal Ramp", "Auto-Wedge" } - local terrainShapeMap = {} - for i = 1, #terrainShapes do - terrainShapeMap[terrainShapes[i]] = i - 1 - end - terrainShapeMap[terrainShapes[#terrainShapes]] = 6 + return setButton + end - local function createWaterGui() - local waterForceDirections = { "NegX", "X", "NegY", "Y", "NegZ", "Z" } - local waterForces = { "None", "Small", "Medium", "Strong", "Max" } + local function buildSetButton(name, setId, _, _, _) + local button = createSetButton(name) + button.Text = name + button.Name = "SetButton" + button.Visible = true - local waterFrame = Instance.new "Frame" - waterFrame.Name = "WaterFrame" - waterFrame.Style = Enum.FrameStyle.RobloxSquare - waterFrame.Size = UDim2.new(0, 150, 0, 110) - waterFrame.Visible = false + local setValue = Instance.new "IntValue" + setValue.Name = "SetId" + setValue.Value = setId + setValue.Parent = button - local waterForceLabel = Instance.new "TextLabel" - waterForceLabel.Name = "WaterForceLabel" - waterForceLabel.BackgroundTransparency = 1 - waterForceLabel.Size = UDim2.new(1, 0, 0, 12) - waterForceLabel.Font = Enum.Font.ArialBold - waterForceLabel.FontSize = Enum.FontSize.Size12 - waterForceLabel.TextColor3 = Color3.new(1, 1, 1) - waterForceLabel.TextXAlignment = Enum.TextXAlignment.Left - waterForceLabel.Text = "Water Force" - waterForceLabel.Parent = waterFrame + local setName = Instance.new "StringValue" + setName.Name = "SetName" + setName.Value = name + setName.Parent = button - local waterForceDirLabel = waterForceLabel:Clone() - waterForceDirLabel.Name = "WaterForceDirectionLabel" - waterForceDirLabel.Text = "Water Force Direction" - waterForceDirLabel.Position = UDim2.new(0, 0, 0, 50) - waterForceDirLabel.Parent = waterFrame + return button + end - local waterTypeChangedEvent = Instance.new "BindableEvent" - waterTypeChangedEvent.Name = "WaterTypeChangedEvent" - waterTypeChangedEvent.Parent = waterFrame - - local waterForceDirectionSelectedFunc = function(newForceDirection) - waterForceDirection = newForceDirection - waterTypeChangedEvent:Fire { waterForce, waterForceDirection } - end - local waterForceSelectedFunc = function(newForce) - waterForce = newForce - waterTypeChangedEvent:Fire { waterForce, waterForceDirection } - end - - local waterForceDirectionDropDown, forceWaterDirectionSelection = - t.CreateDropDownMenu(waterForceDirections, waterForceDirectionSelectedFunc) - waterForceDirectionDropDown.Size = UDim2.new(1, 0, 0, 25) - waterForceDirectionDropDown.Position = UDim2.new(0, 0, 1, 3) - forceWaterDirectionSelection "NegX" - waterForceDirectionDropDown.Parent = waterForceDirLabel - - local waterForceDropDown, forceWaterForceSelection = - t.CreateDropDownMenu(waterForces, waterForceSelectedFunc) - forceWaterForceSelection "None" - waterForceDropDown.Size = UDim2.new(1, 0, 0, 25) - waterForceDropDown.Position = UDim2.new(0, 0, 1, 3) - waterForceDropDown.Parent = waterForceLabel - - return waterFrame, waterTypeChangedEvent - end - - -- Helper Function that contructs gui elements - local function createSetGui() - local setGui = Instance.new "ScreenGui" - setGui.Name = "SetGui" - - local setPanel = Instance.new "Frame" - setPanel.Name = "SetPanel" - setPanel.Active = true - setPanel.BackgroundTransparency = 1 - if position then - setPanel.Position = position + local function processCategory(sets) + local setButtons = {} + local numSkipped = 0 + for i = 1, #sets do + if not showAdminCategories and sets[i].Name == "Beta" then + numSkipped = numSkipped + 1 else - setPanel.Position = UDim2.new(0.2, 29, 0.1, 24) - end - if size then - setPanel.Size = size - else - setPanel.Size = UDim2.new(0.6, -58, 0.64, 0) - end - setPanel.Style = Enum.FrameStyle.RobloxRound - setPanel.ZIndex = 6 - setPanel.Parent = setGui - - -- Children of SetPanel - local itemPreview = Instance.new "Frame" - itemPreview.Name = "ItemPreview" - itemPreview.BackgroundTransparency = 1 - itemPreview.Position = UDim2.new(0.8, 5, 0.085, 0) - itemPreview.Size = UDim2.new(0.21, 0, 0.9, 0) - itemPreview.ZIndex = 6 - itemPreview.Parent = setPanel - - -- Children of ItemPreview - local textPanel = Instance.new "Frame" - textPanel.Name = "TextPanel" - textPanel.BackgroundTransparency = 1 - textPanel.Position = UDim2.new(0, 0, 0.45, 0) - textPanel.Size = UDim2.new(1, 0, 0.55, 0) - textPanel.ZIndex = 6 - textPanel.Parent = itemPreview - - -- Children of TextPanel - local rolloverText = Instance.new "TextLabel" - rolloverText.Name = "RolloverText" - rolloverText.BackgroundTransparency = 1 - rolloverText.Size = UDim2.new(1, 0, 0, 48) - rolloverText.ZIndex = 6 - rolloverText.Font = Enum.Font.ArialBold - rolloverText.FontSize = Enum.FontSize.Size24 - rolloverText.Text = "" - rolloverText.TextColor3 = Color3.new(1, 1, 1) - rolloverText.TextWrap = true - rolloverText.TextXAlignment = Enum.TextXAlignment.Left - rolloverText.TextYAlignment = Enum.TextYAlignment.Top - rolloverText.Parent = textPanel - - local largePreview = Instance.new "ImageLabel" - largePreview.Name = "LargePreview" - largePreview.BackgroundTransparency = 1 - largePreview.Image = "" - largePreview.Size = UDim2.new(1, 0, 0, 170) - largePreview.ZIndex = 6 - largePreview.Parent = itemPreview - - local sets = Instance.new "Frame" - sets.Name = "Sets" - sets.BackgroundTransparency = 1 - sets.Position = UDim2.new(0, 0, 0, 5) - sets.Size = UDim2.new(0.23, 0, 1, -5) - sets.ZIndex = 6 - sets.Parent = setPanel - - -- Children of Sets - local line = Instance.new "Frame" - line.Name = "Line" - line.BackgroundColor3 = Color3.new(1, 1, 1) - line.BackgroundTransparency = 0.7 - line.BorderSizePixel = 0 - line.Position = UDim2.new(1, -3, 0.06, 0) - line.Size = UDim2.new(0, 3, 0.9, 0) - line.ZIndex = 6 - line.Parent = sets - - local setsLists, controlFrame = t.CreateTrueScrollingFrame() - setsLists.Size = UDim2.new(1, -6, 0.94, 0) - setsLists.Position = UDim2.new(0, 0, 0.06, 0) - setsLists.BackgroundTransparency = 1 - setsLists.Name = "SetsLists" - setsLists.ZIndex = 6 - setsLists.Parent = sets - drillDownSetZIndex(controlFrame, 7) - - local setsHeader = Instance.new "TextLabel" - setsHeader.Name = "SetsHeader" - setsHeader.BackgroundTransparency = 1 - setsHeader.Size = UDim2.new(0, 47, 0, 24) - setsHeader.ZIndex = 6 - setsHeader.Font = Enum.Font.ArialBold - setsHeader.FontSize = Enum.FontSize.Size24 - setsHeader.Text = "Sets" - setsHeader.TextColor3 = Color3.new(1, 1, 1) - setsHeader.TextXAlignment = Enum.TextXAlignment.Left - setsHeader.TextYAlignment = Enum.TextYAlignment.Top - setsHeader.Parent = sets - - local cancelButton = Instance.new "TextButton" - cancelButton.Name = "CancelButton" - cancelButton.Position = UDim2.new(1, -32, 0, -2) - cancelButton.Size = UDim2.new(0, 34, 0, 34) - cancelButton.Style = Enum.ButtonStyle.RobloxButtonDefault - cancelButton.ZIndex = 6 - cancelButton.Text = "" - cancelButton.Modal = true - cancelButton.Parent = setPanel - - -- Children of Cancel Button - local cancelImage = Instance.new "ImageLabel" - cancelImage.Name = "CancelImage" - cancelImage.BackgroundTransparency = 1 - cancelImage.Image = "http://www.roblox.com/asset?id=54135717" - cancelImage.Position = UDim2.new(0, -2, 0, -2) - cancelImage.Size = UDim2.new(0, 16, 0, 16) - cancelImage.ZIndex = 6 - cancelImage.Parent = cancelButton - - return setGui - end - - local function createSetButton(text) - local setButton = Instance.new "TextButton" - - if text then - setButton.Text = text - else - setButton.Text = "" - end - - setButton.AutoButtonColor = false - setButton.BackgroundTransparency = 1 - setButton.BackgroundColor3 = Color3.new(1, 1, 1) - setButton.BorderSizePixel = 0 - setButton.Size = UDim2.new(1, -5, 0, 18) - setButton.ZIndex = 6 - setButton.Visible = false - setButton.Font = Enum.Font.Arial - setButton.FontSize = Enum.FontSize.Size18 - setButton.TextColor3 = Color3.new(1, 1, 1) - setButton.TextXAlignment = Enum.TextXAlignment.Left - - return setButton - end - - local function buildSetButton(name, setId, _, _, _) - local button = createSetButton(name) - button.Text = name - button.Name = "SetButton" - button.Visible = true - - local setValue = Instance.new "IntValue" - setValue.Name = "SetId" - setValue.Value = setId - setValue.Parent = button - - local setName = Instance.new "StringValue" - setName.Name = "SetName" - setName.Value = name - setName.Parent = button - - return button - end - - local function processCategory(sets) - local setButtons = {} - local numSkipped = 0 - for i = 1, #sets do - if not showAdminCategories and sets[i].Name == "Beta" then - numSkipped = numSkipped + 1 - else - setButtons[i - numSkipped] = - buildSetButton(sets[i].Name, sets[i].CategoryId, sets[i].ImageAssetId, i - numSkipped, #sets) - end - end - return setButtons - end - - local function handleResize() - wait() -- neccessary to insure heartbeat happened - - local itemPreview = setGui.SetPanel.ItemPreview - - itemPreview.LargePreview.Size = UDim2.new(1, 0, 0, itemPreview.AbsoluteSize.X) - itemPreview.LargePreview.Position = UDim2.new(0.5, -itemPreview.LargePreview.AbsoluteSize.X / 2, 0, 0) - itemPreview.TextPanel.Position = UDim2.new(0, 0, 0, itemPreview.LargePreview.AbsoluteSize.Y) - itemPreview.TextPanel.Size = - UDim2.new(1, 0, 0, itemPreview.AbsoluteSize.Y - itemPreview.LargePreview.AbsoluteSize.Y) - end - - local function makeInsertAssetButton() - local insertAssetButtonExample = Instance.new "Frame" - insertAssetButtonExample.Name = "InsertAssetButtonExample" - insertAssetButtonExample.Position = UDim2.new(0, 128, 0, 64) - insertAssetButtonExample.Size = UDim2.new(0, 64, 0, 64) - insertAssetButtonExample.BackgroundTransparency = 1 - insertAssetButtonExample.ZIndex = 6 - insertAssetButtonExample.Visible = false - - local assetId = Instance.new "IntValue" - assetId.Name = "AssetId" - assetId.Value = 0 - assetId.Parent = insertAssetButtonExample - - local assetName = Instance.new "StringValue" - assetName.Name = "AssetName" - assetName.Value = "" - assetName.Parent = insertAssetButtonExample - - local button = Instance.new "TextButton" - button.Name = "Button" - button.Text = "" - button.Style = Enum.ButtonStyle.RobloxButton - button.Position = UDim2.new(0.025, 0, 0.025, 0) - button.Size = UDim2.new(0.95, 0, 0.95, 0) - button.ZIndex = 6 - button.Parent = insertAssetButtonExample - - local buttonImage = Instance.new "ImageLabel" - buttonImage.Name = "ButtonImage" - buttonImage.Image = "" - buttonImage.Position = UDim2.new(0, -7, 0, -7) - buttonImage.Size = UDim2.new(1, 14, 1, 14) - buttonImage.BackgroundTransparency = 1 - buttonImage.ZIndex = 7 - buttonImage.Parent = button - - local configIcon = buttonImage:clone() - configIcon.Name = "ConfigIcon" - configIcon.Visible = false - configIcon.Position = UDim2.new(1, -23, 1, -24) - configIcon.Size = UDim2.new(0, 16, 0, 16) - configIcon.Image = "" - configIcon.ZIndex = 6 - configIcon.Parent = insertAssetButtonExample - - return insertAssetButtonExample - end - - local function showLargePreview(insertButton) - if insertButton:FindFirstChild "AssetId" then - delay(0, function() - game:GetService("ContentProvider"):Preload( - LargeThumbnailUrl .. tostring(insertButton.AssetId.Value) - ) - setGui.SetPanel.ItemPreview.LargePreview.Image = LargeThumbnailUrl - .. tostring(insertButton.AssetId.Value) - end) - end - if insertButton:FindFirstChild "AssetName" then - setGui.SetPanel.ItemPreview.TextPanel.RolloverText.Text = insertButton.AssetName.Value - end - end - - local function selectTerrainShape(shape) - if currTerrainDropDownFrame then - objectSelected( - tostring(currTerrainDropDownFrame.AssetName.Value), - tonumber(currTerrainDropDownFrame.AssetId.Value), - shape + setButtons[i - numSkipped] = buildSetButton( + sets[i].Name, + sets[i].CategoryId, + sets[i].ImageAssetId, + i - numSkipped, + #sets ) end end + return setButtons + end - local function createTerrainTypeButton(name, parent) - local dropDownTextButton = Instance.new "TextButton" - dropDownTextButton.Name = name .. "Button" - dropDownTextButton.Font = Enum.Font.ArialBold - dropDownTextButton.FontSize = Enum.FontSize.Size14 - dropDownTextButton.BorderSizePixel = 0 - dropDownTextButton.TextColor3 = Color3.new(1, 1, 1) - dropDownTextButton.Text = name - dropDownTextButton.TextXAlignment = Enum.TextXAlignment.Left + local function handleResize() + wait() -- neccessary to insure heartbeat happened + + local itemPreview = setGui.SetPanel.ItemPreview + + itemPreview.LargePreview.Size = + UDim2.new(1, 0, 0, itemPreview.AbsoluteSize.X) + itemPreview.LargePreview.Position = + UDim2.new(0.5, -itemPreview.LargePreview.AbsoluteSize.X / 2, 0, 0) + itemPreview.TextPanel.Position = + UDim2.new(0, 0, 0, itemPreview.LargePreview.AbsoluteSize.Y) + itemPreview.TextPanel.Size = UDim2.new( + 1, + 0, + 0, + itemPreview.AbsoluteSize.Y - itemPreview.LargePreview.AbsoluteSize.Y + ) + end + + local function makeInsertAssetButton() + local insertAssetButtonExample = Instance.new "Frame" + insertAssetButtonExample.Name = "InsertAssetButtonExample" + insertAssetButtonExample.Position = UDim2.new(0, 128, 0, 64) + insertAssetButtonExample.Size = UDim2.new(0, 64, 0, 64) + insertAssetButtonExample.BackgroundTransparency = 1 + insertAssetButtonExample.ZIndex = 6 + insertAssetButtonExample.Visible = false + + local assetId = Instance.new "IntValue" + assetId.Name = "AssetId" + assetId.Value = 0 + assetId.Parent = insertAssetButtonExample + + local assetName = Instance.new "StringValue" + assetName.Name = "AssetName" + assetName.Value = "" + assetName.Parent = insertAssetButtonExample + + local button = Instance.new "TextButton" + button.Name = "Button" + button.Text = "" + button.Style = Enum.ButtonStyle.RobloxButton + button.Position = UDim2.new(0.025, 0, 0.025, 0) + button.Size = UDim2.new(0.95, 0, 0.95, 0) + button.ZIndex = 6 + button.Parent = insertAssetButtonExample + + local buttonImage = Instance.new "ImageLabel" + buttonImage.Name = "ButtonImage" + buttonImage.Image = "" + buttonImage.Position = UDim2.new(0, -7, 0, -7) + buttonImage.Size = UDim2.new(1, 14, 1, 14) + buttonImage.BackgroundTransparency = 1 + buttonImage.ZIndex = 7 + buttonImage.Parent = button + + local configIcon = buttonImage:clone() + configIcon.Name = "ConfigIcon" + configIcon.Visible = false + configIcon.Position = UDim2.new(1, -23, 1, -24) + configIcon.Size = UDim2.new(0, 16, 0, 16) + configIcon.Image = "" + configIcon.ZIndex = 6 + configIcon.Parent = insertAssetButtonExample + + return insertAssetButtonExample + end + + local function showLargePreview(insertButton) + if insertButton:FindFirstChild "AssetId" then + delay(0, function() + game:GetService("ContentProvider"):Preload( + LargeThumbnailUrl .. tostring(insertButton.AssetId.Value) + ) + setGui.SetPanel.ItemPreview.LargePreview.Image = LargeThumbnailUrl + .. tostring(insertButton.AssetId.Value) + end) + end + if insertButton:FindFirstChild "AssetName" then + setGui.SetPanel.ItemPreview.TextPanel.RolloverText.Text = + insertButton.AssetName.Value + end + end + + local function selectTerrainShape(shape) + if currTerrainDropDownFrame then + objectSelected( + tostring(currTerrainDropDownFrame.AssetName.Value), + tonumber(currTerrainDropDownFrame.AssetId.Value), + shape + ) + end + end + + local function createTerrainTypeButton(name, parent) + local dropDownTextButton = Instance.new "TextButton" + dropDownTextButton.Name = name .. "Button" + dropDownTextButton.Font = Enum.Font.ArialBold + dropDownTextButton.FontSize = Enum.FontSize.Size14 + dropDownTextButton.BorderSizePixel = 0 + dropDownTextButton.TextColor3 = Color3.new(1, 1, 1) + dropDownTextButton.Text = name + dropDownTextButton.TextXAlignment = Enum.TextXAlignment.Left + dropDownTextButton.BackgroundTransparency = 1 + dropDownTextButton.ZIndex = parent.ZIndex + 1 + dropDownTextButton.Size = UDim2.new(0, parent.Size.X.Offset - 2, 0, 16) + dropDownTextButton.Position = UDim2.new(0, 1, 0, 0) + + dropDownTextButton.MouseEnter:connect(function() + dropDownTextButton.BackgroundTransparency = 0 + dropDownTextButton.TextColor3 = Color3.new(0, 0, 0) + end) + + dropDownTextButton.MouseLeave:connect(function() dropDownTextButton.BackgroundTransparency = 1 - dropDownTextButton.ZIndex = parent.ZIndex + 1 - dropDownTextButton.Size = UDim2.new(0, parent.Size.X.Offset - 2, 0, 16) - dropDownTextButton.Position = UDim2.new(0, 1, 0, 0) + dropDownTextButton.TextColor3 = Color3.new(1, 1, 1) + end) - dropDownTextButton.MouseEnter:connect(function() - dropDownTextButton.BackgroundTransparency = 0 - dropDownTextButton.TextColor3 = Color3.new(0, 0, 0) - end) + dropDownTextButton.MouseButton1Click:connect(function() + dropDownTextButton.BackgroundTransparency = 1 + dropDownTextButton.TextColor3 = Color3.new(1, 1, 1) + if + dropDownTextButton.Parent + and dropDownTextButton.Parent:IsA "GuiObject" + then + dropDownTextButton.Parent.Visible = false + end + selectTerrainShape(terrainShapeMap[dropDownTextButton.Text]) + end) - dropDownTextButton.MouseLeave:connect(function() - dropDownTextButton.BackgroundTransparency = 1 - dropDownTextButton.TextColor3 = Color3.new(1, 1, 1) - end) + return dropDownTextButton + end - dropDownTextButton.MouseButton1Click:connect(function() - dropDownTextButton.BackgroundTransparency = 1 - dropDownTextButton.TextColor3 = Color3.new(1, 1, 1) - if dropDownTextButton.Parent and dropDownTextButton.Parent:IsA "GuiObject" then - dropDownTextButton.Parent.Visible = false - end - selectTerrainShape(terrainShapeMap[dropDownTextButton.Text]) - end) + local function createTerrainDropDownMenu(zIndex) + local dropDown = Instance.new "Frame" + dropDown.Name = "TerrainDropDown" + dropDown.BackgroundColor3 = Color3.new(0, 0, 0) + dropDown.BorderColor3 = Color3.new(1, 0, 0) + dropDown.Size = UDim2.new(0, 200, 0, 0) + dropDown.Visible = false + dropDown.ZIndex = zIndex + dropDown.Parent = setGui - return dropDownTextButton + for i = 1, #terrainShapes do + local shapeButton = + createTerrainTypeButton(terrainShapes[i], dropDown) + shapeButton.Position = + UDim2.new(0, 1, 0, (i - 1) * shapeButton.Size.Y.Offset) + shapeButton.Parent = dropDown + dropDown.Size = UDim2.new( + 0, + 200, + 0, + dropDown.Size.Y.Offset + shapeButton.Size.Y.Offset + ) end - local function createTerrainDropDownMenu(zIndex) - local dropDown = Instance.new "Frame" - dropDown.Name = "TerrainDropDown" - dropDown.BackgroundColor3 = Color3.new(0, 0, 0) - dropDown.BorderColor3 = Color3.new(1, 0, 0) - dropDown.Size = UDim2.new(0, 200, 0, 0) + dropDown.MouseLeave:connect(function() dropDown.Visible = false - dropDown.ZIndex = zIndex - dropDown.Parent = setGui + end) + end - for i = 1, #terrainShapes do - local shapeButton = createTerrainTypeButton(terrainShapes[i], dropDown) - shapeButton.Position = UDim2.new(0, 1, 0, (i - 1) * shapeButton.Size.Y.Offset) - shapeButton.Parent = dropDown - dropDown.Size = UDim2.new(0, 200, 0, dropDown.Size.Y.Offset + shapeButton.Size.Y.Offset) - end + local function createDropDownMenuButton(parent) + local dropDownButton = Instance.new "ImageButton" + dropDownButton.Name = "DropDownButton" + dropDownButton.Image = "http://banland.xyz/asset/?id=67581509" + dropDownButton.BackgroundTransparency = 1 + dropDownButton.Size = UDim2.new(0, 16, 0, 16) + dropDownButton.Position = UDim2.new(1, -24, 0, 6) + dropDownButton.ZIndex = parent.ZIndex + 2 + dropDownButton.Parent = parent - dropDown.MouseLeave:connect(function() - dropDown.Visible = false - end) + if not setGui:FindFirstChild "TerrainDropDown" then + createTerrainDropDownMenu(8) end - local function createDropDownMenuButton(parent) - local dropDownButton = Instance.new "ImageButton" - dropDownButton.Name = "DropDownButton" - dropDownButton.Image = "http://www.roblox.com/asset/?id=67581509" - dropDownButton.BackgroundTransparency = 1 - dropDownButton.Size = UDim2.new(0, 16, 0, 16) - dropDownButton.Position = UDim2.new(1, -24, 0, 6) - dropDownButton.ZIndex = parent.ZIndex + 2 - dropDownButton.Parent = parent + dropDownButton.MouseButton1Click:connect(function() + setGui.TerrainDropDown.Visible = true + setGui.TerrainDropDown.Position = UDim2.new( + 0, + parent.AbsolutePosition.X, + 0, + parent.AbsolutePosition.Y + ) + currTerrainDropDownFrame = parent + end) + end - if not setGui:FindFirstChild "TerrainDropDown" then - createTerrainDropDownMenu(8) - end + local function buildInsertButton() + local insertButton = makeInsertAssetButton() + insertButton.Name = "InsertAssetButton" + insertButton.Visible = true - dropDownButton.MouseButton1Click:connect(function() - setGui.TerrainDropDown.Visible = true - setGui.TerrainDropDown.Position = UDim2.new(0, parent.AbsolutePosition.X, 0, parent.AbsolutePosition.Y) - currTerrainDropDownFrame = parent - end) + if + Data.Category[Data.CurrentCategory].SetName == "High Scalability" + then + createDropDownMenuButton(insertButton) end - local function buildInsertButton() - local insertButton = makeInsertAssetButton() - insertButton.Name = "InsertAssetButton" - insertButton.Visible = true + local lastEnter + local mouseEnterCon = insertButton.MouseEnter:connect(function() + lastEnter = insertButton + delay(0.1, function() + if lastEnter == insertButton then + showLargePreview(insertButton) + end + end) + end) + return insertButton, mouseEnterCon + end - if Data.Category[Data.CurrentCategory].SetName == "High Scalability" then - createDropDownMenuButton(insertButton) + local function realignButtonGrid(columns) + local x = 0 + local y = 0 + for i = 1, #insertButtons do + insertButtons[i].Position = + UDim2.new(0, buttonWidth * x, 0, buttonHeight * y) + x = x + 1 + if x >= columns then + x = 0 + y = y + 1 end + end + end - local lastEnter = nil - local mouseEnterCon = insertButton.MouseEnter:connect(function() - lastEnter = insertButton - delay(0.1, function() - if lastEnter == insertButton then - showLargePreview(insertButton) + local function setInsertButtonImageBehavior( + insertFrame, + visible, + name, + assetId + ) + if visible then + insertFrame.AssetName.Value = name + insertFrame.AssetId.Value = assetId + local newImageUrl = SmallThumbnailUrl .. assetId + if newImageUrl ~= insertFrame.Button.ButtonImage.Image then + delay(0, function() + game:GetService("ContentProvider") + :Preload(SmallThumbnailUrl .. assetId) + insertFrame.Button.ButtonImage.Image = SmallThumbnailUrl + .. assetId + end) + end + table.insert( + insertButtonCons, + insertFrame.Button.MouseButton1Click:connect(function() + -- special case for water, show water selection gui + local isWaterSelected = (name == "Water") + and ( + Data.Category[Data.CurrentCategory].SetName + == "High Scalability" + ) + waterGui.Visible = isWaterSelected + if isWaterSelected then + objectSelected(name, tonumber(assetId), nil) + else + objectSelected(name, tonumber(assetId)) end end) - end) - return insertButton, mouseEnterCon + ) + insertFrame.Visible = true + else + insertFrame.Visible = false + end + end + + local function loadSectionOfItems(setGui, rows, columns) + local pageSize = rows * columns + + if arrayPosition > #contents then + return end - local function realignButtonGrid(columns) - local x = 0 - local y = 0 - for i = 1, #insertButtons do - insertButtons[i].Position = UDim2.new(0, buttonWidth * x, 0, buttonHeight * y) - x = x + 1 - if x >= columns then - x = 0 - y = y + 1 - end + local origArrayPos = arrayPosition + + for _ = 1, pageSize + 1 do + if arrayPosition >= #contents + 1 then + break end + + local buttonCon + insertButtons[arrayPosition], buttonCon = buildInsertButton() + table.insert(insertButtonCons, buttonCon) + insertButtons[arrayPosition].Parent = setGui.SetPanel.ItemsFrame + arrayPosition = arrayPosition + 1 end + realignButtonGrid(columns) - local function setInsertButtonImageBehavior(insertFrame, visible, name, assetId) - if visible then - insertFrame.AssetName.Value = name - insertFrame.AssetId.Value = assetId - local newImageUrl = SmallThumbnailUrl .. assetId - if newImageUrl ~= insertFrame.Button.ButtonImage.Image then - delay(0, function() - game:GetService("ContentProvider"):Preload(SmallThumbnailUrl .. assetId) - insertFrame.Button.ButtonImage.Image = SmallThumbnailUrl .. assetId - end) - end - table.insert( - insertButtonCons, - insertFrame.Button.MouseButton1Click:connect(function() - -- special case for water, show water selection gui - local isWaterSelected = (name == "Water") - and (Data.Category[Data.CurrentCategory].SetName == "High Scalability") - waterGui.Visible = isWaterSelected - if isWaterSelected then - objectSelected(name, tonumber(assetId), nil) - else - objectSelected(name, tonumber(assetId)) + -- local indexCopy = origArrayPos + for index = origArrayPos, arrayPosition do + if insertButtons[index] then + if contents[index] then + -- we don't want water to have a drop down button + if contents[index].Name == "Water" then + if + Data.Category[Data.CurrentCategory].SetName + == "High Scalability" + then + insertButtons[index] + :FindFirstChild("DropDownButton", true) + :Destroy() end - end) - ) - insertFrame.Visible = true - else - insertFrame.Visible = false - end - end + end - local function loadSectionOfItems(setGui, rows, columns) - local pageSize = rows * columns - - if arrayPosition > #contents then - return - end - - local origArrayPos = arrayPosition - - for _ = 1, pageSize + 1 do - if arrayPosition >= #contents + 1 then - break - end - - local buttonCon - insertButtons[arrayPosition], buttonCon = buildInsertButton() - table.insert(insertButtonCons, buttonCon) - insertButtons[arrayPosition].Parent = setGui.SetPanel.ItemsFrame - arrayPosition = arrayPosition + 1 - end - realignButtonGrid(columns) - - -- local indexCopy = origArrayPos - for index = origArrayPos, arrayPosition do - if insertButtons[index] then - if contents[index] then - -- we don't want water to have a drop down button - if contents[index].Name == "Water" then - if Data.Category[Data.CurrentCategory].SetName == "High Scalability" then - insertButtons[index]:FindFirstChild("DropDownButton", true):Destroy() - end - end - - local assetId - if useAssetVersionId then - assetId = contents[index].AssetVersionId - else - assetId = contents[index].AssetId - end - setInsertButtonImageBehavior(insertButtons[index], true, contents[index].Name, assetId) + local assetId + if useAssetVersionId then + assetId = contents[index].AssetVersionId else - break + assetId = contents[index].AssetId end + setInsertButtonImageBehavior( + insertButtons[index], + true, + contents[index].Name, + assetId + ) else break end - -- indexCopy = index + else + break end + -- indexCopy = index end + end - local function setSetIndex() - Data.Category[Data.CurrentCategory].Index = 0 + local function setSetIndex() + Data.Category[Data.CurrentCategory].Index = 0 - local rows = 7 - local columns = math.floor(setGui.SetPanel.ItemsFrame.AbsoluteSize.X / buttonWidth) + local rows = 7 + local columns = + math.floor(setGui.SetPanel.ItemsFrame.AbsoluteSize.X / buttonWidth) - contents = Data.Category[Data.CurrentCategory].Contents - if contents then - -- remove our buttons and their connections - for i = 1, #insertButtons do - insertButtons[i]:remove() - end - for i = 1, #insertButtonCons do - if insertButtonCons[i] then - insertButtonCons[i]:disconnect() - end - end - insertButtonCons = {} - insertButtons = {} - - arrayPosition = 1 - loadSectionOfItems(setGui, rows, columns) + contents = Data.Category[Data.CurrentCategory].Contents + if contents then + -- remove our buttons and their connections + for i = 1, #insertButtons do + insertButtons[i]:remove() end - end - - local function selectSet(button, setName, setId, _) - if button and Data.Category[Data.CurrentCategory] ~= nil then - if button ~= Data.Category[Data.CurrentCategory].Button then - Data.Category[Data.CurrentCategory].Button = button - - if SetCache[setId] == nil then - SetCache[setId] = game:GetService("InsertService"):GetCollection(setId) - end - Data.Category[Data.CurrentCategory].Contents = SetCache[setId] - - Data.Category[Data.CurrentCategory].SetName = setName - Data.Category[Data.CurrentCategory].SetId = setId + for i = 1, #insertButtonCons do + if insertButtonCons[i] then + insertButtonCons[i]:disconnect() end - setSetIndex() end + insertButtonCons = {} + insertButtons = {} + + arrayPosition = 1 + loadSectionOfItems(setGui, rows, columns) end + end - local function selectCategoryPage(buttons, _) - if buttons ~= Data.CurrentCategory then - if Data.CurrentCategory then - for _, button in pairs(Data.CurrentCategory) do - button.Visible = false - end + local function selectSet(button, setName, setId, _) + if button and Data.Category[Data.CurrentCategory] ~= nil then + if button ~= Data.Category[Data.CurrentCategory].Button then + Data.Category[Data.CurrentCategory].Button = button + + if SetCache[setId] == nil then + SetCache[setId] = game:GetService("InsertService") + :GetCollection(setId) end + Data.Category[Data.CurrentCategory].Contents = SetCache[setId] - Data.CurrentCategory = buttons - if Data.Category[Data.CurrentCategory] == nil then - Data.Category[Data.CurrentCategory] = {} - if #buttons > 0 then - selectSet(buttons[1], buttons[1].SetName.Value, buttons[1].SetId.Value, 0) - end - else - Data.Category[Data.CurrentCategory].Button = nil + Data.Category[Data.CurrentCategory].SetName = setName + Data.Category[Data.CurrentCategory].SetId = setId + end + setSetIndex() + end + end + + local function selectCategoryPage(buttons, _) + if buttons ~= Data.CurrentCategory then + if Data.CurrentCategory then + for _, button in pairs(Data.CurrentCategory) do + button.Visible = false + end + end + + Data.CurrentCategory = buttons + if Data.Category[Data.CurrentCategory] == nil then + Data.Category[Data.CurrentCategory] = {} + if #buttons > 0 then selectSet( - Data.Category[Data.CurrentCategory].ButtonFrame, - Data.Category[Data.CurrentCategory].SetName, - Data.Category[Data.CurrentCategory].SetId, - Data.Category[Data.CurrentCategory].Index + buttons[1], + buttons[1].SetName.Value, + buttons[1].SetId.Value, + 0 ) end + else + Data.Category[Data.CurrentCategory].Button = nil + selectSet( + Data.Category[Data.CurrentCategory].ButtonFrame, + Data.Category[Data.CurrentCategory].SetName, + Data.Category[Data.CurrentCategory].SetId, + Data.Category[Data.CurrentCategory].Index + ) end end + end - local function selectCategory(category) - selectCategoryPage(category, 0) - end + local function selectCategory(category) + selectCategoryPage(category, 0) + end - local function resetAllSetButtonSelection() - local setButtons = setGui.SetPanel.Sets.SetsLists:GetChildren() - for i = 1, #setButtons do - if setButtons[i]:IsA "TextButton" then - setButtons[i].Selected = false - setButtons[i].BackgroundTransparency = 1 - setButtons[i].TextColor3 = Color3.new(1, 1, 1) - setButtons[i].BackgroundColor3 = Color3.new(1, 1, 1) - end + local function resetAllSetButtonSelection() + local setButtons = setGui.SetPanel.Sets.SetsLists:GetChildren() + for i = 1, #setButtons do + if setButtons[i]:IsA "TextButton" then + setButtons[i].Selected = false + setButtons[i].BackgroundTransparency = 1 + setButtons[i].TextColor3 = Color3.new(1, 1, 1) + setButtons[i].BackgroundColor3 = Color3.new(1, 1, 1) end end + end - local function populateSetsFrame() - local currRow = 0 - for i = 1, #userCategoryButtons do - local button = userCategoryButtons[i] - button.Visible = true - button.Position = UDim2.new(0, 5, 0, currRow * button.Size.Y.Offset) - button.Parent = setGui.SetPanel.Sets.SetsLists + local function populateSetsFrame() + local currRow = 0 + for i = 1, #userCategoryButtons do + local button = userCategoryButtons[i] + button.Visible = true + button.Position = UDim2.new(0, 5, 0, currRow * button.Size.Y.Offset) + button.Parent = setGui.SetPanel.Sets.SetsLists - if i == 1 then -- we will have this selected by default, so show it - button.Selected = true - button.BackgroundColor3 = Color3.new(0, 204 / 255, 0) - button.TextColor3 = Color3.new(0, 0, 0) + if i == 1 then -- we will have this selected by default, so show it + button.Selected = true + button.BackgroundColor3 = Color3.new(0, 204 / 255, 0) + button.TextColor3 = Color3.new(0, 0, 0) + button.BackgroundTransparency = 0 + end + + button.MouseEnter:connect(function() + if not button.Selected then button.BackgroundTransparency = 0 - end - - button.MouseEnter:connect(function() - if not button.Selected then - button.BackgroundTransparency = 0 - button.TextColor3 = Color3.new(0, 0, 0) - end - end) - button.MouseLeave:connect(function() - if not button.Selected then - button.BackgroundTransparency = 1 - button.TextColor3 = Color3.new(1, 1, 1) - end - end) - button.MouseButton1Click:connect(function() - resetAllSetButtonSelection() - button.Selected = not button.Selected - button.BackgroundColor3 = Color3.new(0, 204 / 255, 0) button.TextColor3 = Color3.new(0, 0, 0) - button.BackgroundTransparency = 0 - selectSet(button, button.Text, userCategoryButtons[i].SetId.Value, 0) - end) + end + end) + button.MouseLeave:connect(function() + if not button.Selected then + button.BackgroundTransparency = 1 + button.TextColor3 = Color3.new(1, 1, 1) + end + end) + button.MouseButton1Click:connect(function() + resetAllSetButtonSelection() + button.Selected = not button.Selected + button.BackgroundColor3 = Color3.new(0, 204 / 255, 0) + button.TextColor3 = Color3.new(0, 0, 0) + button.BackgroundTransparency = 0 + selectSet( + button, + button.Text, + userCategoryButtons[i].SetId.Value, + 0 + ) + end) - currRow = currRow + 1 - end + currRow = currRow + 1 + end - local buttons = setGui.SetPanel.Sets.SetsLists:GetChildren() + local buttons = setGui.SetPanel.Sets.SetsLists:GetChildren() - -- set first category as loaded for default - if buttons then - for i = 1, #buttons do - if buttons[i]:IsA "TextButton" then - selectSet(buttons[i], buttons[i].Text, userCategoryButtons[i].SetId.Value, 0) - selectCategory(userCategoryButtons) - break - end + -- set first category as loaded for default + if buttons then + for i = 1, #buttons do + if buttons[i]:IsA "TextButton" then + selectSet( + buttons[i], + buttons[i].Text, + userCategoryButtons[i].SetId.Value, + 0 + ) + selectCategory(userCategoryButtons) + break end end end + end - setGui = createSetGui() - waterGui, waterTypeChangedEvent = createWaterGui() - waterGui.Position = UDim2.new(0, 55, 0, 0) - waterGui.Parent = setGui - setGui.Changed:connect(function(prop) -- this resizes the preview image to always be the right size + setGui = createSetGui() + waterGui, waterTypeChangedEvent = createWaterGui() + waterGui.Position = UDim2.new(0, 55, 0, 0) + waterGui.Parent = setGui + setGui.Changed:connect( + function(prop) -- this resizes the preview image to always be the right size if prop == "AbsoluteSize" then handleResize() setSetIndex() end - end) + end + ) - local scrollFrame, controlFrame = t.CreateTrueScrollingFrame() - scrollFrame.Size = UDim2.new(0.54, 0, 0.85, 0) - scrollFrame.Position = UDim2.new(0.24, 0, 0.085, 0) - scrollFrame.Name = "ItemsFrame" - scrollFrame.ZIndex = 6 - scrollFrame.Parent = setGui.SetPanel - scrollFrame.BackgroundTransparency = 1 + local scrollFrame, controlFrame = t.CreateTrueScrollingFrame() + scrollFrame.Size = UDim2.new(0.54, 0, 0.85, 0) + scrollFrame.Position = UDim2.new(0.24, 0, 0.085, 0) + scrollFrame.Name = "ItemsFrame" + scrollFrame.ZIndex = 6 + scrollFrame.Parent = setGui.SetPanel + scrollFrame.BackgroundTransparency = 1 - drillDownSetZIndex(controlFrame, 7) + drillDownSetZIndex(controlFrame, 7) - controlFrame.Parent = setGui.SetPanel - controlFrame.Position = UDim2.new(0.76, 5, 0, 0) + controlFrame.Parent = setGui.SetPanel + controlFrame.Position = UDim2.new(0.76, 5, 0, 0) - local debounce = false - controlFrame.ScrollBottom.Changed:connect(function(_) - if controlFrame.ScrollBottom.Value == true then - if debounce then - return - end - debounce = true - loadSectionOfItems(setGui, rows, columns) - debounce = false + local debounce = false + controlFrame.ScrollBottom.Changed:connect(function(_) + if controlFrame.ScrollBottom.Value == true then + if debounce then + return end - end) + debounce = true + loadSectionOfItems(setGui, rows, columns) + debounce = false + end + end) - local userData = {} - for id = 1, #userIdsForSets do - local newUserData = game:GetService("InsertService"):GetUserSets(userIdsForSets[id]) - if newUserData and #newUserData > 2 then - -- start at #3 to skip over My Decals and My Models for each account - for category = 3, #newUserData do - if newUserData[category].Name == "High Scalability" then -- we want high scalability parts to show first - table.insert(userData, 1, newUserData[category]) - else - table.insert(userData, newUserData[category]) - end + local userData = {} + for id = 1, #userIdsForSets do + local newUserData = game:GetService("InsertService") + :GetUserSets(userIdsForSets[id]) + if newUserData and #newUserData > 2 then + -- start at #3 to skip over My Decals and My Models for each account + for category = 3, #newUserData do + if newUserData[category].Name == "High Scalability" then -- we want high scalability parts to show first + table.insert(userData, 1, newUserData[category]) + else + table.insert(userData, newUserData[category]) end end end - if userData then - userCategoryButtons = processCategory(userData) - end - - rows = math.floor(setGui.SetPanel.ItemsFrame.AbsoluteSize.Y / buttonHeight) - columns = math.floor(setGui.SetPanel.ItemsFrame.AbsoluteSize.X / buttonWidth) - - populateSetsFrame() - - --[[local insertPanelCloseCon = ]] - setGui.SetPanel.CancelButton.MouseButton1Click:connect(function() - setGui.SetPanel.Visible = false - if dialogClosed then - dialogClosed() - end - end) - - local setVisibilityFunction = function(visible) - if visible then - setGui.SetPanel.Visible = true - else - setGui.SetPanel.Visible = false - end - end - - local getVisibilityFunction = function() - if setGui then - if setGui:FindFirstChild "SetPanel" then - return setGui.SetPanel.Visible - end - end - - return false - end - - return setGui, setVisibilityFunction, getVisibilityFunction, waterTypeChangedEvent end + if userData then + userCategoryButtons = processCategory(userData) + end + + rows = math.floor(setGui.SetPanel.ItemsFrame.AbsoluteSize.Y / buttonHeight) + columns = + math.floor(setGui.SetPanel.ItemsFrame.AbsoluteSize.X / buttonWidth) + + populateSetsFrame() + + --[[local insertPanelCloseCon = ]] + setGui.SetPanel.CancelButton.MouseButton1Click:connect(function() + setGui.SetPanel.Visible = false + if dialogClosed then + dialogClosed() + end + end) + + local setVisibilityFunction = function(visible) + if visible then + setGui.SetPanel.Visible = true + else + setGui.SetPanel.Visible = false + end + end + + local getVisibilityFunction = function() + if setGui then + if setGui:FindFirstChild "SetPanel" then + return setGui.SetPanel.Visible + end + end + + return false + end + + return setGui, + setVisibilityFunction, + getVisibilityFunction, + waterTypeChangedEvent +end t.CreateTerrainMaterialSelector = function(size, position) local terrainMaterialSelectionChanged = Instance.new "BindableEvent" terrainMaterialSelectionChanged.Name = "TerrainMaterialSelectionChanged" - local selectedButton = nil + local selectedButton local frame = Instance.new "Frame" frame.Name = "TerrainMaterialSelector" @@ -3435,45 +3770,64 @@ t.CreateTerrainMaterialSelector = function(size, position) for _, v in pairs(materialNames) do materialToImageMap[v] = {} if v == "Grass" then - materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=56563112" + materialToImageMap[v].Regular = + "http://banland.xyz/asset/?id=56563112" elseif v == "Sand" then - materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=62356652" + materialToImageMap[v].Regular = + "http://banland.xyz/asset/?id=62356652" elseif v == "Brick" then - materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=65961537" + materialToImageMap[v].Regular = + "http://banland.xyz/asset/?id=65961537" elseif v == "Granite" then - materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67532153" + materialToImageMap[v].Regular = + "http://banland.xyz/asset/?id=67532153" elseif v == "Asphalt" then - materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67532038" + materialToImageMap[v].Regular = + "http://banland.xyz/asset/?id=67532038" elseif v == "Iron" then - materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67532093" + materialToImageMap[v].Regular = + "http://banland.xyz/asset/?id=67532093" elseif v == "Aluminum" then - materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67531995" + materialToImageMap[v].Regular = + "http://banland.xyz/asset/?id=67531995" elseif v == "Gold" then - materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67532118" + materialToImageMap[v].Regular = + "http://banland.xyz/asset/?id=67532118" elseif v == "Plastic (red)" then - materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67531848" + materialToImageMap[v].Regular = + "http://banland.xyz/asset/?id=67531848" elseif v == "Plastic (blue)" then - materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67531924" + materialToImageMap[v].Regular = + "http://banland.xyz/asset/?id=67531924" elseif v == "Plank" then - materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67532015" + materialToImageMap[v].Regular = + "http://banland.xyz/asset/?id=67532015" elseif v == "Log" then - materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67532051" + materialToImageMap[v].Regular = + "http://banland.xyz/asset/?id=67532051" elseif v == "Gravel" then - materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67532206" + materialToImageMap[v].Regular = + "http://banland.xyz/asset/?id=67532206" elseif v == "Cinder Block" then - materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67532103" + materialToImageMap[v].Regular = + "http://banland.xyz/asset/?id=67532103" elseif v == "Stone Wall" then - materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67531804" + materialToImageMap[v].Regular = + "http://banland.xyz/asset/?id=67531804" elseif v == "Concrete" then - materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67532059" + materialToImageMap[v].Regular = + "http://banland.xyz/asset/?id=67532059" elseif v == "Water" then - materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=81407474" + materialToImageMap[v].Regular = + "http://banland.xyz/asset/?id=81407474" else - materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=66887593" -- fill in the rest here!! + materialToImageMap[v].Regular = + "http://banland.xyz/asset/?id=66887593" -- fill in the rest here!! end end - local scrollFrame, scrollUp, scrollDown, recalculateScroll = t.CreateScrollingFrame(nil, "grid") + local scrollFrame, scrollUp, scrollDown, recalculateScroll = + t.CreateScrollingFrame(nil, "grid") scrollFrame.Size = UDim2.new(0.85, 0, 1, 0) scrollFrame.Position = UDim2.new(0, 0, 0, 0) scrollFrame.Parent = frame @@ -3556,11 +3910,17 @@ t.CreateTerrainMaterialSelector = function(size, position) local matName = getNameFromEnum(newMaterialType) local buttons = scrollFrame:GetChildren() for i = 1, #buttons do - if buttons[i].Name == "Plastic (blue)" and matName == "Plastic (blue)" then + if + buttons[i].Name == "Plastic (blue)" + and matName == "Plastic (blue)" + then goToNewMaterial(buttons[i], matName) return end - if buttons[i].Name == "Plastic (red)" and matName == "Plastic (red)" then + if + buttons[i].Name == "Plastic (red)" + and matName == "Plastic (red)" + then goToNewMaterial(buttons[i], matName) return end @@ -3582,7 +3942,8 @@ t.CreateTerrainMaterialSelector = function(size, position) end t.CreateLoadingFrame = function(name, size, position) - game:GetService("ContentProvider"):Preload "http://www.roblox.com/asset/?id=35238053" + game:GetService("ContentProvider") + :Preload "http://banland.xyz/asset/?id=35238053" local loadingFrame = Instance.new "Frame" loadingFrame.Name = "LoadingFrame" @@ -3609,7 +3970,7 @@ t.CreateLoadingFrame = function(name, size, position) local loadingGreenBar = Instance.new "ImageLabel" loadingGreenBar.Name = "LoadingGreenBar" - loadingGreenBar.Image = "http://www.roblox.com/asset/?id=35238053" + loadingGreenBar.Image = "http://banland.xyz/asset/?id=35238053" loadingGreenBar.Position = UDim2.new(0, 0, 0, 0) loadingGreenBar.Size = UDim2.new(0, 0, 1, 0) loadingGreenBar.Visible = false @@ -3658,10 +4019,14 @@ t.CreateLoadingFrame = function(name, size, position) local updateLoadingGuiPercent = function(percent, tweenAction, tweenLength) if percent and type(percent) ~= "number" then - error("updateLoadingGuiPercent expects number as argument, got", type(percent), "instead") + error( + "updateLoadingGuiPercent expects number as argument, got", + type(percent), + "instead" + ) end - local newSize = nil + local newSize if percent < 0 then newSize = UDim2.new(0, 0, 1, 0) elseif percent > 1 then @@ -3677,7 +4042,13 @@ t.CreateLoadingFrame = function(name, size, position) if newSize.X.Scale > 0 then loadingGreenBar.Visible = true - loadingGreenBar:TweenSize(newSize, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, tweenLength, true) + loadingGreenBar:TweenSize( + newSize, + Enum.EasingDirection.Out, + Enum.EasingStyle.Quad, + tweenLength, + true + ) else loadingGreenBar:TweenSize( newSize, @@ -3700,7 +4071,9 @@ t.CreateLoadingFrame = function(name, size, position) loadingGreenBar.Changed:connect(function(prop) if prop == "Size" then - loadingPercent.Text = tostring(math.ceil(loadingGreenBar.Size.X.Scale * 100)) .. "%" + loadingPercent.Text = tostring( + math.ceil(loadingGreenBar.Size.X.Scale * 100) + ) .. "%" end end) @@ -3745,7 +4118,8 @@ t.CreatePluginFrame = function(name, size, position, scrollable, parent) dragBar.BackgroundColor3 = Color3.new(39 / 255, 39 / 255, 39 / 255) dragBar.BorderColor3 = Color3.new(0, 0, 0) if size then - dragBar.Size = UDim2.new(size.X.Scale, size.X.Offset, 0, 20) + UDim2.new(0, 20, 0, 0) + dragBar.Size = UDim2.new(size.X.Scale, size.X.Offset, 0, 20) + + UDim2.new(0, 20, 0, 0) else dragBar.Size = UDim2.new(0, 183, 0, 20) end @@ -3819,8 +4193,12 @@ t.CreatePluginFrame = function(name, size, position, scrollable, parent) helpButton.BackgroundTransparency = 0 local screenGui = getScreenGuiAncestor(helpFrame) if screenGui then - if helpFrame.AbsolutePosition.X + helpFrame.AbsoluteSize.X > screenGui.AbsoluteSize.X then --position on left hand side - helpFrame.Position = UDim2.new(0, -5 - helpFrame.AbsoluteSize.X, 0, 0) + if + helpFrame.AbsolutePosition.X + helpFrame.AbsoluteSize.X + > screenGui.AbsoluteSize.X + then --position on left hand side + helpFrame.Position = + UDim2.new(0, -5 - helpFrame.AbsoluteSize.X, 0, 0) else -- position on right hand side helpFrame.Position = UDim2.new(1, 5, 0, 0) end @@ -3849,7 +4227,8 @@ t.CreatePluginFrame = function(name, size, position, scrollable, parent) minimizeFrame.BorderColor3 = Color3.new(0, 0, 0) minimizeFrame.Position = UDim2.new(0, 0, 1, 0) if size then - minimizeFrame.Size = UDim2.new(size.X.Scale, size.X.Offset, 0, 50) + UDim2.new(0, 20, 0, 0) + minimizeFrame.Size = UDim2.new(size.X.Scale, size.X.Offset, 0, 50) + + UDim2.new(0, 20, 0, 0) else minimizeFrame.Size = UDim2.new(0, 183, 0, 50) end @@ -3869,7 +4248,8 @@ t.CreatePluginFrame = function(name, size, position, scrollable, parent) local separatingLine = Instance.new "Frame" separatingLine.Name = "SeparatingLine" - separatingLine.BackgroundColor3 = Color3.new(115 / 255, 115 / 255, 115 / 255) + separatingLine.BackgroundColor3 = + Color3.new(115 / 255, 115 / 255, 115 / 255) separatingLine.BorderSizePixel = 0 separatingLine.Position = UDim2.new(1, -18, 0.5, -7) separatingLine.Size = UDim2.new(0, 1, 0, 14) @@ -3886,7 +4266,8 @@ t.CreatePluginFrame = function(name, size, position, scrollable, parent) widgetContainer.BorderColor3 = Color3.new(0, 0, 0) if not scrollable then widgetContainer.BackgroundTransparency = 0 - widgetContainer.BackgroundColor3 = Color3.new(72 / 255, 72 / 255, 72 / 255) + widgetContainer.BackgroundColor3 = + Color3.new(72 / 255, 72 / 255, 72 / 255) end widgetContainer.Parent = dragBar @@ -3894,7 +4275,12 @@ t.CreatePluginFrame = function(name, size, position, scrollable, parent) if scrollable then widgetContainer.Size = size else - widgetContainer.Size = UDim2.new(0, dragBar.AbsoluteSize.X, size.Y.Scale, size.Y.Offset) + widgetContainer.Size = UDim2.new( + 0, + dragBar.AbsoluteSize.X, + size.Y.Scale, + size.Y.Offset + ) end else if scrollable then @@ -3926,7 +4312,8 @@ t.CreatePluginFrame = function(name, size, position, scrollable, parent) else control.Size = UDim2.new(0, 21, 0, 400) end - control:FindFirstChild("ScrollDownButton").Position = UDim2.new(0, 0, 1, -20) + control:FindFirstChild("ScrollDownButton").Position = + UDim2.new(0, 0, 1, -20) local fakeLine = Instance.new "Frame" fakeLine.Name = "FakeLine" @@ -3940,7 +4327,8 @@ t.CreatePluginFrame = function(name, size, position, scrollable, parent) verticalDragger.ZIndex = 2 verticalDragger.AutoButtonColor = false verticalDragger.Name = "VerticalDragger" - verticalDragger.BackgroundColor3 = Color3.new(50 / 255, 50 / 255, 50 / 255) + verticalDragger.BackgroundColor3 = + Color3.new(50 / 255, 50 / 255, 50 / 255) verticalDragger.BorderColor3 = Color3.new(0, 0, 0) verticalDragger.Size = UDim2.new(1, 20, 0, 20) verticalDragger.Position = UDim2.new(0, 0, 1, 0) @@ -3975,12 +4363,14 @@ t.CreatePluginFrame = function(name, size, position, scrollable, parent) areaSoak.Parent = getScreenGuiAncestor(parent) local draggingVertical = false - local startYPos = nil + local startYPos verticalDragger.MouseEnter:connect(function() - verticalDragger.BackgroundColor3 = Color3.new(60 / 255, 60 / 255, 60 / 255) + verticalDragger.BackgroundColor3 = + Color3.new(60 / 255, 60 / 255, 60 / 255) end) verticalDragger.MouseLeave:connect(function() - verticalDragger.BackgroundColor3 = Color3.new(50 / 255, 50 / 255, 50 / 255) + verticalDragger.BackgroundColor3 = + Color3.new(50 / 255, 50 / 255, 50 / 255) end) verticalDragger.MouseButton1Down:connect(function(_, y) draggingVertical = true @@ -4021,7 +4411,8 @@ t.CreatePluginFrame = function(name, size, position, scrollable, parent) widgetContainer.Size.Y.Scale, widgetContainer.Size.Y.Offset + yDelta ) - control.Size = UDim2.new(0, 21, 0, control.Size.Y.Offset + yDelta) + control.Size = + UDim2.new(0, 21, 0, control.Size.Y.Offset + yDelta) end end) end @@ -4060,42 +4451,66 @@ end t.Help = function(funcNameOrFunc) --input argument can be a string or a function. Should return a description (of arguments and expected side effects) - if funcNameOrFunc == "CreatePropertyDropDownMenu" or funcNameOrFunc == t.CreatePropertyDropDownMenu then + if + funcNameOrFunc == "CreatePropertyDropDownMenu" + or funcNameOrFunc == t.CreatePropertyDropDownMenu + then return "Function CreatePropertyDropDownMenu. " .. "Arguments: (instance, propertyName, enumType). " .. "Side effect: returns a container with a drop-down-box that is linked to the 'property' field of 'instance' which is of type 'enumType'" end - if funcNameOrFunc == "CreateDropDownMenu" or funcNameOrFunc == t.CreateDropDownMenu then + if + funcNameOrFunc == "CreateDropDownMenu" + or funcNameOrFunc == t.CreateDropDownMenu + then return "Function CreateDropDownMenu. " .. "Arguments: (items, onItemSelected). " .. "Side effect: Returns 2 results, a container to the gui object and a 'updateSelection' function for external updating. The container is a drop-down-box created around a list of items" end - if funcNameOrFunc == "CreateMessageDialog" or funcNameOrFunc == t.CreateMessageDialog then + if + funcNameOrFunc == "CreateMessageDialog" + or funcNameOrFunc == t.CreateMessageDialog + then return "Function CreateMessageDialog. " .. "Arguments: (title, message, buttons). " .. "Side effect: Returns a gui object of a message box with 'title' and 'message' as passed in. 'buttons' input is an array of Tables contains a 'Text' and 'Function' field for the text/callback of each button" end - if funcNameOrFunc == "CreateStyledMessageDialog" or funcNameOrFunc == t.CreateStyledMessageDialog then + if + funcNameOrFunc == "CreateStyledMessageDialog" + or funcNameOrFunc == t.CreateStyledMessageDialog + then return "Function CreateStyledMessageDialog. " .. "Arguments: (title, message, style, buttons). " .. "Side effect: Returns a gui object of a message box with 'title' and 'message' as passed in. 'buttons' input is an array of Tables contains a 'Text' and 'Function' field for the text/callback of each button, 'style' is a string, either Error, Notify or Confirm" end - if funcNameOrFunc == "GetFontHeight" or funcNameOrFunc == t.GetFontHeight then + if + funcNameOrFunc == "GetFontHeight" + or funcNameOrFunc == t.GetFontHeight + then return "Function GetFontHeight. " .. "Arguments: (font, fontSize). " .. "Side effect: returns the size in pixels of the given font + fontSize" end - if funcNameOrFunc == "CreateScrollingFrame" or funcNameOrFunc == t.CreateScrollingFrame then + if + funcNameOrFunc == "CreateScrollingFrame" + or funcNameOrFunc == t.CreateScrollingFrame + then return "Function CreateScrollingFrame. " .. "Arguments: (orderList, style) " .. "Side effect: returns 4 objects, (scrollFrame, scrollUpButton, scrollDownButton, recalculateFunction). 'scrollFrame' can be filled with GuiObjects. It will lay them out and allow scrollUpButton/scrollDownButton to interact with them. Orderlist is optional (and specifies the order to layout the children. Without orderlist, it uses the children order. style is also optional, and allows for a 'grid' styling if style is passed 'grid' as a string. recalculateFunction can be called when a relayout is needed (when orderList changes)" end - if funcNameOrFunc == "CreateTrueScrollingFrame" or funcNameOrFunc == t.CreateTrueScrollingFrame then + if + funcNameOrFunc == "CreateTrueScrollingFrame" + or funcNameOrFunc == t.CreateTrueScrollingFrame + then return "Function CreateTrueScrollingFrame. " .. "Arguments: (nil) " .. "Side effect: returns 2 objects, (scrollFrame, controlFrame). 'scrollFrame' can be filled with GuiObjects, and they will be clipped if not inside the frame's bounds. controlFrame has children scrollup and scrolldown, as well as a slider. controlFrame can be parented to any guiobject and it will readjust itself to fit." end - if funcNameOrFunc == "AutoTruncateTextObject" or funcNameOrFunc == t.AutoTruncateTextObject then + if + funcNameOrFunc == "AutoTruncateTextObject" + or funcNameOrFunc == t.AutoTruncateTextObject + then return "Function AutoTruncateTextObject. " .. "Arguments: (textLabel) " .. "Side effect: returns 2 objects, (textLabel, changeText). The 'textLabel' input is modified to automatically truncate text (with ellipsis), if it gets too small to fit. 'changeText' is a function that can be used to change the text, it takes 1 string as an argument" @@ -4105,12 +4520,18 @@ t.Help = function(funcNameOrFunc) .. "Arguments: (steps, width, position) " .. "Side effect: returns 2 objects, (sliderGui, sliderPosition). The 'steps' argument specifies how many different positions the slider can hold along the bar. 'width' specifies in pixels how wide the bar should be (modifiable afterwards if desired). 'position' argument should be a UDim2 for slider positioning. 'sliderPosition' is an IntValue whose current .Value specifies the specific step the slider is currently on." end - if funcNameOrFunc == "CreateLoadingFrame" or funcNameOrFunc == t.CreateLoadingFrame then + if + funcNameOrFunc == "CreateLoadingFrame" + or funcNameOrFunc == t.CreateLoadingFrame + then return "Function CreateLoadingFrame. " .. "Arguments: (name, size, position) " .. "Side effect: Creates a gui that can be manipulated to show progress for a particular action. Name appears above the loading bar, and size and position are udim2 values (both size and position are optional arguments). Returns 3 arguments, the first being the gui created. The second being updateLoadingGuiPercent, which is a bindable function. This function takes one argument (two optionally), which should be a number between 0 and 1, representing the percentage the loading gui should be at. The second argument to this function is a boolean value that if set to true will tween the current percentage value to the new percentage value, therefore our third argument is how long this tween should take. Our third returned argument is a BindableEvent, that when fired means that someone clicked the cancel button on the dialog." end - if funcNameOrFunc == "CreateTerrainMaterialSelector" or funcNameOrFunc == t.CreateTerrainMaterialSelector then + if + funcNameOrFunc == "CreateTerrainMaterialSelector" + or funcNameOrFunc == t.CreateTerrainMaterialSelector + then return "Function CreateTerrainMaterialSelector. " .. "Arguments: (size, position) " .. "Side effect: Size and position are UDim2 values that specifies the selector's size and position. Both size and position are optional arguments. This method returns 3 objects (terrainSelectorGui, terrainSelected, forceTerrainSelection). terrainSelectorGui is just the gui object that we generate with this function, parent it as you like. TerrainSelected is a BindableEvent that is fired whenever a new terrain type is selected in the gui. ForceTerrainSelection is a function that takes an argument of Enum.CellMaterial and will force the gui to show that material as currently selected." diff --git a/lua/45374389.lua b/lua/45374389.lua index a197f9f..1d97400 100644 --- a/lua/45374389.lua +++ b/lua/45374389.lua @@ -1,3 +1,4 @@ +print "[Mercury]: Loaded corescript 45374389" local t = {} t.Foo = function() diff --git a/lua/46295863.lua b/lua/46295863.lua index a13a343..c9935a3 100644 --- a/lua/46295863.lua +++ b/lua/46295863.lua @@ -1,3 +1,4 @@ +print "[Mercury]: Loaded corescript 46295863" local function waitForChild(instance, name) while not instance:FindFirstChild(name) do instance.ChildAdded:wait() @@ -18,26 +19,26 @@ else gui = script.Parent end -local helpButton = nil -local updateCameraDropDownSelection = nil -local updateVideoCaptureDropDownSelection = nil +local helpButton +local updateCameraDropDownSelection +local updateVideoCaptureDropDownSelection local tweenTime = 0.2 -local mouseLockLookScreenUrl = "http://www.roblox.com/asset?id=54071825" -local classicLookScreenUrl = "http://www.roblox.com/Asset?id=45915798" +local mouseLockLookScreenUrl = "http://banland.xyz/asset?id=54071825" +local classicLookScreenUrl = "http://banland.xyz/Asset?id=45915798" local hasGraphicsSlider = (game:GetService("CoreGui").Version >= 5) local GraphicsQualityLevels = 10 -- how many levels we allow on graphics slider local recordingVideo = false -local currentMenuSelection = nil +local currentMenuSelection local lastMenuSelection = {} -- local defaultPosition = UDim2.new(0, 0, 0, 0) -- local newGuiPlaces = { 0, 41324860 } local centerDialogs = {} -local mainShield = nil +local mainShield local inStudioMode = UserSettings().GameSettings:InStudioMode() @@ -96,8 +97,12 @@ function goToMenu(container, menuName, moveDirection, size, position) for i = 1, #containerChildren do if containerChildren[i].Name == menuName then containerChildren[i].Visible = true - currentMenuSelection = - { container = container, name = menuName, direction = moveDirection, lastSize = size } + currentMenuSelection = { + container = container, + name = menuName, + direction = moveDirection, + lastSize = size, + } -- selectedMenu = true if size and position then containerChildren[i]:TweenSizeAndPosition( @@ -176,7 +181,13 @@ function resetLocalCharacter() end end -local function createTextButton(text, style, fontSize, buttonSize, buttonPosition) +local function createTextButton( + text, + style, + fontSize, + buttonSize, + buttonPosition +) local newTextButton = Instance.new "TextButton" newTextButton.Font = Enum.Font.Arial newTextButton.FontSize = fontSize @@ -244,9 +255,14 @@ local function CreateTextButtons(frame, buttons, yPos, ySize) buttonNum = 1 while buttonNum <= numButtons do - buttonObjs[buttonNum].Position = - UDim2.new(spacing * buttonNum + (buttonNum - 1) * buttonSize, 0, yPos.Scale, yPos.Offset) - buttonObjs[buttonNum].Size = UDim2.new(buttonSize, 0, ySize.Scale, ySize.Offset) + buttonObjs[buttonNum].Position = UDim2.new( + spacing * buttonNum + (buttonNum - 1) * buttonSize, + 0, + yPos.Scale, + yPos.Offset + ) + buttonObjs[buttonNum].Size = + UDim2.new(buttonSize, 0, ySize.Scale, ySize.Offset) buttonNum = buttonNum + 1 end end @@ -291,16 +307,25 @@ function setDisabledState(guiObject) guiObject.Active = false else if guiObject["ClassName"] then - print("setDisabledState() got object of unsupported type. object type is ", guiObject.ClassName) + print( + "setDisabledState() got object of unsupported type. object type is ", + guiObject.ClassName + ) end end end local function createHelpDialog(baseZIndex) if helpButton == nil then - if gui:FindFirstChild "TopLeftControl" and gui.TopLeftControl:FindFirstChild "Help" then + if + gui:FindFirstChild "TopLeftControl" + and gui.TopLeftControl:FindFirstChild "Help" + then helpButton = gui.TopLeftControl.Help - elseif gui:FindFirstChild "BottomRightControl" and gui.BottomRightControl:FindFirstChild "Help" then + elseif + gui:FindFirstChild "BottomRightControl" + and gui.BottomRightControl:FindFirstChild "Help" + then helpButton = gui.BottomRightControl.Help end end @@ -358,7 +383,10 @@ local function createHelpDialog(baseZIndex) local image = Instance.new "ImageLabel" image.Name = "Image" - if UserSettings().GameSettings.ControlMode == Enum.ControlMode["Mouse Lock Switch"] then + if + UserSettings().GameSettings.ControlMode + == Enum.ControlMode["Mouse Lock Switch"] + then image.Image = mouseLockLookScreenUrl else image.Image = classicLookScreenUrl @@ -372,7 +400,10 @@ local function createHelpDialog(baseZIndex) buttons[1] = {} buttons[1].Text = "Look" buttons[1].Function = function() - if UserSettings().GameSettings.ControlMode == Enum.ControlMode["Mouse Lock Switch"] then + if + UserSettings().GameSettings.ControlMode + == Enum.ControlMode["Mouse Lock Switch"] + then image.Image = mouseLockLookScreenUrl else image.Image = classicLookScreenUrl @@ -381,17 +412,17 @@ local function createHelpDialog(baseZIndex) buttons[2] = {} buttons[2].Text = "Move" buttons[2].Function = function() - image.Image = "http://www.roblox.com/Asset?id=45915811" + image.Image = "http://banland.xyz/Asset?id=45915811" end buttons[3] = {} buttons[3].Text = "Gear" buttons[3].Function = function() - image.Image = "http://www.roblox.com/Asset?id=45917596" + image.Image = "http://banland.xyz/Asset?id=45917596" end buttons[4] = {} buttons[4].Text = "Zoom" buttons[4].Function = function() - image.Image = "http://www.roblox.com/Asset?id=45915825" + image.Image = "http://banland.xyz/Asset?id=45915825" end CreateTextButtons(buttonRow, buttons, UDim.new(0, 0), UDim.new(1, 0)) @@ -401,15 +432,27 @@ local function createHelpDialog(baseZIndex) waitForChild(gui, "UserSettingsShield") waitForChild(gui.UserSettingsShield, "Settings") waitForChild(gui.UserSettingsShield.Settings, "SettingsStyle") - waitForChild(gui.UserSettingsShield.Settings.SettingsStyle, "GameSettingsMenu") - waitForChild(gui.UserSettingsShield.Settings.SettingsStyle.GameSettingsMenu, "CameraField") - waitForChild(gui.UserSettingsShield.Settings.SettingsStyle.GameSettingsMenu.CameraField, "DropDownMenuButton") + waitForChild( + gui.UserSettingsShield.Settings.SettingsStyle, + "GameSettingsMenu" + ) + waitForChild( + gui.UserSettingsShield.Settings.SettingsStyle.GameSettingsMenu, + "CameraField" + ) + waitForChild( + gui.UserSettingsShield.Settings.SettingsStyle.GameSettingsMenu.CameraField, + "DropDownMenuButton" + ) gui.UserSettingsShield.Settings.SettingsStyle.GameSettingsMenu.CameraField.DropDownMenuButton.Changed:connect( function(prop) if prop ~= "Text" then return end - if buttonRow.Button1.Style == Enum.ButtonStyle.RobloxButtonDefault then -- only change if this is the currently selected panel + if + buttonRow.Button1.Style + == Enum.ButtonStyle.RobloxButtonDefault + then -- only change if this is the currently selected panel if gui.UserSettingsShield.Settings.SettingsStyle.GameSettingsMenu.CameraField.DropDownMenuButton.Text == "Classic" @@ -476,7 +519,12 @@ local function createLeaveConfirmationMenu(baseZIndex, shield) noButton.Parent = frame noButton.ZIndex = baseZIndex + 4 noButton.MouseButton1Click:connect(function() - goToMenu(shield.Settings.SettingsStyle, "GameMainMenu", "down", UDim2.new(0, 525, 0, 430)) + goToMenu( + shield.Settings.SettingsStyle, + "GameMainMenu", + "down", + UDim2.new(0, 525, 0, 430) + ) shield.Settings:TweenSize( UDim2.new(0, 525, 0, 430), Enum.EasingDirection.InOut, @@ -536,7 +584,12 @@ local function createResetConfirmationMenu(baseZIndex, shield) noButton.Parent = frame noButton.ZIndex = baseZIndex + 4 noButton.MouseButton1Click:connect(function() - goToMenu(shield.Settings.SettingsStyle, "GameMainMenu", "down", UDim2.new(0, 525, 0, 430)) + goToMenu( + shield.Settings.SettingsStyle, + "GameMainMenu", + "down", + UDim2.new(0, 525, 0, 430) + ) shield.Settings:TweenSize( UDim2.new(0, 525, 0, 430), Enum.EasingDirection.InOut, @@ -739,7 +792,10 @@ local function createGameMainMenu(baseZIndex, shield) gameSettingsButton.ZIndex = baseZIndex + 4 gameSettingsButton.Parent = gameMainMenuFrame - if game:FindFirstChild "LoadingGuiService" and #game.LoadingGuiService:GetChildren() > 0 then + if + game:FindFirstChild "LoadingGuiService" + and #game.LoadingGuiService:GetChildren() > 0 + then local gameSettingsButton = createTextButton( "Game Instructions", Enum.ButtonStyle.RobloxButton, @@ -751,8 +807,11 @@ local function createGameMainMenu(baseZIndex, shield) gameSettingsButton.ZIndex = baseZIndex + 4 gameSettingsButton.Parent = gameMainMenuFrame gameSettingsButton.MouseButton1Click:connect(function() - if game:FindFirstChild "Players" and game.Players["LocalPlayer"] then - local loadingGui = game.Players.LocalPlayer:FindFirstChild "PlayerLoadingGui" + if + game:FindFirstChild "Players" and game.Players["LocalPlayer"] + then + local loadingGui = + game.Players.LocalPlayer:FindFirstChild "PlayerLoadingGui" if loadingGui then loadingGui.Visible = true end @@ -838,7 +897,7 @@ local function createGameSettingsMenu(baseZIndex, _) studioShortcut.Position = UDim2.new(0, 154, 0, 175) studioShortcut.Parent = gameSettingsMenuFrame - local studioCheckbox = nil + local studioCheckbox if hasGraphicsSlider then local qualityText = Instance.new "TextLabel" @@ -909,17 +968,23 @@ local function createGameSettingsMenu(baseZIndex, _) autoGraphicsButton.Parent = gameSettingsMenuFrame autoGraphicsButton.Visible = not inStudioMode - local graphicsSlider, graphicsLevel = RbxGui.CreateSlider(GraphicsQualityLevels, 150, UDim2.new(0, 230, 0, 280)) -- graphics - 1 because slider starts at 1 instead of 0 + local graphicsSlider, graphicsLevel = RbxGui.CreateSlider( + GraphicsQualityLevels, + 150, + UDim2.new(0, 230, 0, 280) + ) -- graphics - 1 because slider starts at 1 instead of 0 graphicsSlider.Parent = gameSettingsMenuFrame graphicsSlider.Bar.ZIndex = baseZIndex + 4 graphicsSlider.Bar.Slider.ZIndex = baseZIndex + 5 graphicsSlider.Visible = not inStudioMode - graphicsLevel.Value = math.floor((settings().Rendering:GetMaxQualityLevel() - 1) / 2) + graphicsLevel.Value = + math.floor((settings().Rendering:GetMaxQualityLevel() - 1) / 2) local graphicsSetter = Instance.new "TextBox" graphicsSetter.Name = "GraphicsSetter" graphicsSetter.BackgroundColor3 = Color3.new(0, 0, 0) - graphicsSetter.BorderColor3 = Color3.new(128 / 255, 128 / 255, 128 / 255) + graphicsSetter.BorderColor3 = + Color3.new(128 / 255, 128 / 255, 128 / 255) graphicsSetter.Size = UDim2.new(0, 50, 0, 25) graphicsSetter.Position = UDim2.new(0, 450, 0, 269) graphicsSetter.TextColor3 = Color3.new(1, 1, 1) @@ -933,7 +998,10 @@ local function createGameSettingsMenu(baseZIndex, _) local isAutoGraphics = true if not inStudioMode then - isAutoGraphics = (UserSettings().GameSettings.SavedQualityLevel == Enum.SavedQualitySetting.Automatic) + isAutoGraphics = ( + UserSettings().GameSettings.SavedQualityLevel + == Enum.SavedQualitySetting.Automatic + ) else settings().Rendering.EnableFRM = false end @@ -967,14 +1035,17 @@ local function createGameSettingsMenu(baseZIndex, _) local function goToAutoGraphics() setAutoGraphicsGui(true) - UserSettings().GameSettings.SavedQualityLevel = Enum.SavedQualitySetting.Automatic + UserSettings().GameSettings.SavedQualityLevel = + Enum.SavedQualitySetting.Automatic settings().Rendering.QualityLevel = Enum.QualityLevel.Automatic end local function setGraphicsQualityLevel(newLevel) local percentage = newLevel / GraphicsQualityLevels - local newSetting = math.floor((settings().Rendering:GetMaxQualityLevel() - 1) * percentage) + local newSetting = math.floor( + (settings().Rendering:GetMaxQualityLevel() - 1) * percentage + ) if newSetting == 20 then -- Level 20 is the same as level 21, except it doesn't render ambient occlusion newSetting = 21 elseif newLevel == 1 then -- make sure we can go to lowest settings (for terrible computers) @@ -994,8 +1065,10 @@ local function createGameSettingsMenu(baseZIndex, _) graphicsLevel.Value = explicitLevel else graphicsLevel.Value = math.floor( - (settings().Rendering.AutoFRMLevel / (settings().Rendering:GetMaxQualityLevel() - 1)) - * GraphicsQualityLevels + ( + settings().Rendering.AutoFRMLevel + / (settings().Rendering:GetMaxQualityLevel() - 1) + ) * GraphicsQualityLevels ) end @@ -1004,7 +1077,8 @@ local function createGameSettingsMenu(baseZIndex, _) end if not explicitLevel then - UserSettings().GameSettings.SavedQualityLevel = graphicsLevel.Value + UserSettings().GameSettings.SavedQualityLevel = + graphicsLevel.Value end graphicsSetter.Text = tostring(graphicsLevel.Value) end @@ -1042,25 +1116,45 @@ local function createGameSettingsMenu(baseZIndex, _) local function translateSavedQualityLevelToInt(savedQualityLevel) if savedQualityLevel == Enum.SavedQualitySetting.Automatic then return 0 - elseif savedQualityLevel == Enum.SavedQualitySetting.QualityLevel1 then + elseif + savedQualityLevel == Enum.SavedQualitySetting.QualityLevel1 + then return 1 - elseif savedQualityLevel == Enum.SavedQualitySetting.QualityLevel2 then + elseif + savedQualityLevel == Enum.SavedQualitySetting.QualityLevel2 + then return 2 - elseif savedQualityLevel == Enum.SavedQualitySetting.QualityLevel3 then + elseif + savedQualityLevel == Enum.SavedQualitySetting.QualityLevel3 + then return 3 - elseif savedQualityLevel == Enum.SavedQualitySetting.QualityLevel4 then + elseif + savedQualityLevel == Enum.SavedQualitySetting.QualityLevel4 + then return 4 - elseif savedQualityLevel == Enum.SavedQualitySetting.QualityLevel5 then + elseif + savedQualityLevel == Enum.SavedQualitySetting.QualityLevel5 + then return 5 - elseif savedQualityLevel == Enum.SavedQualitySetting.QualityLevel6 then + elseif + savedQualityLevel == Enum.SavedQualitySetting.QualityLevel6 + then return 6 - elseif savedQualityLevel == Enum.SavedQualitySetting.QualityLevel7 then + elseif + savedQualityLevel == Enum.SavedQualitySetting.QualityLevel7 + then return 7 - elseif savedQualityLevel == Enum.SavedQualitySetting.QualityLevel8 then + elseif + savedQualityLevel == Enum.SavedQualitySetting.QualityLevel8 + then return 8 - elseif savedQualityLevel == Enum.SavedQualitySetting.QualityLevel9 then + elseif + savedQualityLevel == Enum.SavedQualitySetting.QualityLevel9 + then return 9 - elseif savedQualityLevel == Enum.SavedQualitySetting.QualityLevel10 then + elseif + savedQualityLevel == Enum.SavedQualitySetting.QualityLevel10 + then return 10 end end @@ -1068,14 +1162,21 @@ local function createGameSettingsMenu(baseZIndex, _) local function enableGraphicsWidget() settings().Rendering.EnableFRM = true - isAutoGraphics = (UserSettings().GameSettings.SavedQualityLevel == Enum.SavedQualitySetting.Automatic) + isAutoGraphics = ( + UserSettings().GameSettings.SavedQualityLevel + == Enum.SavedQualitySetting.Automatic + ) if isAutoGraphics then showAutoGraphics() goToAutoGraphics() else showAutoGraphics() showManualGraphics() - goToManualGraphics(translateSavedQualityLevelToInt(UserSettings().GameSettings.SavedQualityLevel)) + goToManualGraphics( + translateSavedQualityLevelToInt( + UserSettings().GameSettings.SavedQualityLevel + ) + ) end end @@ -1099,7 +1200,9 @@ local function createGameSettingsMenu(baseZIndex, _) if newGraphicsValue < 1 then newGraphicsValue = 1 - elseif newGraphicsValue >= settings().Rendering:GetMaxQualityLevel() then + elseif + newGraphicsValue >= settings().Rendering:GetMaxQualityLevel() + then newGraphicsValue = settings().Rendering:GetMaxQualityLevel() - 1 end @@ -1121,7 +1224,11 @@ local function createGameSettingsMenu(baseZIndex, _) end) -- setup our graphic mode on load - if inStudioMode or UserSettings().GameSettings.SavedQualityLevel == Enum.SavedQualitySetting.Automatic then + if + inStudioMode + or UserSettings().GameSettings.SavedQualityLevel + == Enum.SavedQualitySetting.Automatic + then if inStudioMode then settings().Rendering.EnableFRM = false disableGraphicsWidget() @@ -1131,7 +1238,11 @@ local function createGameSettingsMenu(baseZIndex, _) end else settings().Rendering.EnableFRM = true - goToManualGraphics(translateSavedQualityLevelToInt(UserSettings().GameSettings.SavedQualityLevel)) + goToManualGraphics( + translateSavedQualityLevelToInt( + UserSettings().GameSettings.SavedQualityLevel + ) + ) end autoGraphicsButton.MouseButton1Click:connect(function() @@ -1208,7 +1319,9 @@ local function createGameSettingsMenu(baseZIndex, _) studioCheckbox:SetVerb "TogglePlayMode" studioCheckbox.Visible = false -- todo: enabled when studio h4x aren't an issue anymore - local wasManualGraphics = (settings().Rendering.QualityLevel ~= Enum.QualityLevel.Automatic) + local wasManualGraphics = ( + settings().Rendering.QualityLevel ~= Enum.QualityLevel.Automatic + ) if inStudioMode and not game.Players.LocalPlayer then studioCheckbox.Text = "X" disableGraphicsWidget() @@ -1217,23 +1330,28 @@ local function createGameSettingsMenu(baseZIndex, _) enableGraphicsWidget() end if hasGraphicsSlider then - UserSettings().GameSettings.StudioModeChanged:connect(function(isStudioMode) - inStudioMode = isStudioMode - if isStudioMode then - wasManualGraphics = (settings().Rendering.QualityLevel ~= Enum.QualityLevel.Automatic) - goToAutoGraphics() - studioCheckbox.Text = "X" - autoGraphicsButton.ZIndex = 1 - autoText.ZIndex = 1 - else - if wasManualGraphics then - goToManualGraphics() + UserSettings().GameSettings.StudioModeChanged:connect( + function(isStudioMode) + inStudioMode = isStudioMode + if isStudioMode then + wasManualGraphics = ( + settings().Rendering.QualityLevel + ~= Enum.QualityLevel.Automatic + ) + goToAutoGraphics() + studioCheckbox.Text = "X" + autoGraphicsButton.ZIndex = 1 + autoText.ZIndex = 1 + else + if wasManualGraphics then + goToManualGraphics() + end + studioCheckbox.Text = "" + autoGraphicsButton.ZIndex = baseZIndex + 4 + autoText.ZIndex = baseZIndex + 4 end - studioCheckbox.Text = "" - autoGraphicsButton.ZIndex = baseZIndex + 4 - autoText.ZIndex = baseZIndex + 4 end - end) + ) else studioCheckbox.MouseButton1Click:connect(function() if not studioCheckbox.Active then @@ -1264,13 +1382,15 @@ local function createGameSettingsMenu(baseZIndex, _) fullscreenCheckbox.Text = "X" end if hasGraphicsSlider then - UserSettings().GameSettings.FullscreenChanged:connect(function(isFullscreen) - if isFullscreen then - fullscreenCheckbox.Text = "X" - else - fullscreenCheckbox.Text = "" + UserSettings().GameSettings.FullscreenChanged:connect( + function(isFullscreen) + if isFullscreen then + fullscreenCheckbox.Text = "X" + else + fullscreenCheckbox.Text = "" + end end - end) + ) else fullscreenCheckbox.MouseButton1Click:connect(function() if fullscreenCheckbox.Text == "" then @@ -1335,10 +1455,14 @@ local function createGameSettingsMenu(baseZIndex, _) videoNames[2] = "Upload to YouTube" videoNameToItem[videoNames[2]] = Enum.UploadSetting["Ask me first"] - local videoCaptureDropDown = nil - videoCaptureDropDown, updateVideoCaptureDropDownSelection = RbxGui.CreateDropDownMenu(videoNames, function(text) - UserSettings().GameSettings.VideoUploadPromptBehavior = videoNameToItem[text] - end) + local videoCaptureDropDown + videoCaptureDropDown, updateVideoCaptureDropDownSelection = RbxGui.CreateDropDownMenu( + videoNames, + function(text) + UserSettings().GameSettings.VideoUploadPromptBehavior = + videoNameToItem[text] + end + ) videoCaptureDropDown.Name = "VideoCaptureField" videoCaptureDropDown.ZIndex = baseZIndex + 4 videoCaptureDropDown.DropDownMenuButton.ZIndex = baseZIndex + 4 @@ -1348,12 +1472,19 @@ local function createGameSettingsMenu(baseZIndex, _) videoCaptureDropDown.Parent = gameSettingsMenuFrame syncVideoCaptureSetting = function() - if UserSettings().GameSettings.VideoUploadPromptBehavior == Enum.UploadSetting["Never"] then + if + UserSettings().GameSettings.VideoUploadPromptBehavior + == Enum.UploadSetting["Never"] + then updateVideoCaptureDropDownSelection(videoNames[1]) - elseif UserSettings().GameSettings.VideoUploadPromptBehavior == Enum.UploadSetting["Ask me first"] then + elseif + UserSettings().GameSettings.VideoUploadPromptBehavior + == Enum.UploadSetting["Ask me first"] + then updateVideoCaptureDropDownSelection(videoNames[2]) else - UserSettings().GameSettings.VideoUploadPromptBehavior = Enum.UploadSetting["Ask me first"] + UserSettings().GameSettings.VideoUploadPromptBehavior = + Enum.UploadSetting["Ask me first"] updateVideoCaptureDropDownSelection(videoNames[2]) end end @@ -1372,7 +1503,8 @@ local function createGameSettingsMenu(baseZIndex, _) cameraLabel.ZIndex = baseZIndex + 4 cameraLabel.Parent = gameSettingsMenuFrame - local mouseLockLabel = game.CoreGui.RobloxGui:FindFirstChild("MouseLockLabel", true) + local mouseLockLabel = + game.CoreGui.RobloxGui:FindFirstChild("MouseLockLabel", true) local enumItems = Enum.ControlMode:GetEnumItems() local enumNames = {} @@ -1383,17 +1515,24 @@ local function createGameSettingsMenu(baseZIndex, _) end local cameraDropDown - cameraDropDown, updateCameraDropDownSelection = RbxGui.CreateDropDownMenu(enumNames, function(text) - UserSettings().GameSettings.ControlMode = enumNameToItem[text] + cameraDropDown, updateCameraDropDownSelection = RbxGui.CreateDropDownMenu( + enumNames, + function(text) + UserSettings().GameSettings.ControlMode = enumNameToItem[text] - pcall(function() - if mouseLockLabel and UserSettings().GameSettings.ControlMode == Enum.ControlMode["Mouse Lock Switch"] then - mouseLockLabel.Visible = true - elseif mouseLockLabel then - mouseLockLabel.Visible = false - end - end) - end) + pcall(function() + if + mouseLockLabel + and UserSettings().GameSettings.ControlMode + == Enum.ControlMode["Mouse Lock Switch"] + then + mouseLockLabel.Visible = true + elseif mouseLockLabel then + mouseLockLabel.Visible = false + end + end) + end + ) cameraDropDown.Name = "CameraField" cameraDropDown.ZIndex = baseZIndex + 4 cameraDropDown.DropDownMenuButton.ZIndex = baseZIndex + 4 @@ -1411,12 +1550,14 @@ if LoadLibrary then if UserSettings then local createSettingsDialog = function() waitForChild(gui, "BottomLeftControl") - settingsButton = gui.BottomLeftControl:FindFirstChild "SettingsButton" + settingsButton = + gui.BottomLeftControl:FindFirstChild "SettingsButton" if settingsButton == nil then settingsButton = Instance.new "ImageButton" settingsButton.Name = "SettingsButton" - settingsButton.Image = "rbxasset://textures/ui/SettingsButton.png" + settingsButton.Image = + "rbxasset://textures/ui/SettingsButton.png" settingsButton.BackgroundTransparency = 1 settingsButton.Active = false settingsButton.Size = UDim2.new(0, 54, 0, 46) @@ -1457,28 +1598,50 @@ if LoadLibrary then gameMainMenu.Parent = settingsFrame gameMainMenu.ScreenshotButton.MouseButton1Click:connect(function() - backToGame(gameMainMenu.ScreenshotButton, shield, settingsButton) + backToGame( + gameMainMenu.ScreenshotButton, + shield, + settingsButton + ) end) gameMainMenu.RecordVideoButton.MouseButton1Click:connect(function() - recordVideoClick(gameMainMenu.RecordVideoButton, gui.StopRecordButton) - backToGame(gameMainMenu.RecordVideoButton, shield, settingsButton) + recordVideoClick( + gameMainMenu.RecordVideoButton, + gui.StopRecordButton + ) + backToGame( + gameMainMenu.RecordVideoButton, + shield, + settingsButton + ) end) if settings():FindFirstChild "Game Options" then pcall(function() - settings():FindFirstChild("Game Options").VideoRecordingChangeRequest:connect(function(recording) - recordingVideo = recording - setRecordGui(recording, gui.StopRecordButton, gameMainMenu.RecordVideoButton) - end) + settings() + :FindFirstChild("Game Options").VideoRecordingChangeRequest + :connect(function(recording) + recordingVideo = recording + setRecordGui( + recording, + gui.StopRecordButton, + gameMainMenu.RecordVideoButton + ) + end) end) end - game.CoreGui.RobloxGui.Changed:connect(function(prop) -- We have stopped recording when we resize - if prop == "AbsoluteSize" and recordingVideo then - recordVideoClick(gameMainMenu.RecordVideoButton, gui.StopRecordButton) + game.CoreGui.RobloxGui.Changed:connect( + function(prop) -- We have stopped recording when we resize + if prop == "AbsoluteSize" and recordingVideo then + recordVideoClick( + gameMainMenu.RecordVideoButton, + gui.StopRecordButton + ) + end end - end) + ) function localPlayerChange() gameMainMenu.ResetButton.Visible = game.Players.LocalPlayer @@ -1504,100 +1667,123 @@ if LoadLibrary then end) end - gameMainMenu.ReportAbuseButton.Visible = game:FindFirstChild "NetworkClient" + gameMainMenu.ReportAbuseButton.Visible = + game:FindFirstChild "NetworkClient" if not gameMainMenu.ReportAbuseButton.Visible then game.ChildAdded:connect(function(child) if child:IsA "NetworkClient" then - gameMainMenu.ReportAbuseButton.Visible = game:FindFirstChild "NetworkClient" + gameMainMenu.ReportAbuseButton.Visible = + game:FindFirstChild "NetworkClient" end end) end gameMainMenu.ResetButton.MouseButton1Click:connect(function() - goToMenu(settingsFrame, "ResetConfirmationMenu", "up", UDim2.new(0, 525, 0, 370)) + goToMenu( + settingsFrame, + "ResetConfirmationMenu", + "up", + UDim2.new(0, 525, 0, 370) + ) end) gameMainMenu.LeaveGameButton.MouseButton1Click:connect(function() - goToMenu(settingsFrame, "LeaveConfirmationMenu", "down", UDim2.new(0, 525, 0, 300)) + goToMenu( + settingsFrame, + "LeaveConfirmationMenu", + "down", + UDim2.new(0, 525, 0, 300) + ) end) if game.CoreGui.Version >= 4 then -- we can use escape! - game:GetService("GuiService").EscapeKeyPressed:connect(function() - if currentMenuSelection == nil then - game.GuiService:AddCenterDialog( - shield, - Enum.CenterDialogType.ModalDialog, - --showFunction - function() - settingsButton.Active = false - updateCameraDropDownSelection(UserSettings().GameSettings.ControlMode.Name) + game:GetService("GuiService").EscapeKeyPressed:connect( + function() + if currentMenuSelection == nil then + game.GuiService:AddCenterDialog( + shield, + Enum.CenterDialogType.ModalDialog, + --showFunction + function() + settingsButton.Active = false + updateCameraDropDownSelection( + UserSettings().GameSettings.ControlMode.Name + ) - if syncVideoCaptureSetting then - syncVideoCaptureSetting() + if syncVideoCaptureSetting then + syncVideoCaptureSetting() + end + + goToMenu( + settingsFrame, + "GameMainMenu", + "right", + UDim2.new(0, 525, 0, 430) + ) + shield.Visible = true + shield.Active = true + settingsFrame.Parent:TweenPosition( + UDim2.new(0.5, -262, 0.5, -200), + Enum.EasingDirection.InOut, + Enum.EasingStyle.Sine, + tweenTime, + true + ) + settingsFrame.Parent:TweenSize( + UDim2.new(0, 525, 0, 430), + Enum.EasingDirection.InOut, + Enum.EasingStyle.Sine, + tweenTime, + true + ) + end, + --hideFunction + function() + settingsFrame.Parent:TweenPosition( + UDim2.new(0.5, -262, -0.5, -200), + Enum.EasingDirection.InOut, + Enum.EasingStyle.Sine, + tweenTime, + true + ) + settingsFrame.Parent:TweenSize( + UDim2.new(0, 525, 0, 430), + Enum.EasingDirection.InOut, + Enum.EasingStyle.Sine, + tweenTime, + true + ) + shield.Visible = false + settingsButton.Active = true end - - goToMenu(settingsFrame, "GameMainMenu", "right", UDim2.new(0, 525, 0, 430)) - shield.Visible = true - shield.Active = true - settingsFrame.Parent:TweenPosition( - UDim2.new(0.5, -262, 0.5, -200), - Enum.EasingDirection.InOut, - Enum.EasingStyle.Sine, - tweenTime, - true - ) - settingsFrame.Parent:TweenSize( - UDim2.new(0, 525, 0, 430), - Enum.EasingDirection.InOut, - Enum.EasingStyle.Sine, - tweenTime, - true - ) - end, - --hideFunction - function() - settingsFrame.Parent:TweenPosition( - UDim2.new(0.5, -262, -0.5, -200), - Enum.EasingDirection.InOut, - Enum.EasingStyle.Sine, - tweenTime, - true - ) - settingsFrame.Parent:TweenSize( - UDim2.new(0, 525, 0, 430), - Enum.EasingDirection.InOut, - Enum.EasingStyle.Sine, - tweenTime, - true - ) - shield.Visible = false - settingsButton.Active = true + ) + elseif #lastMenuSelection > 0 then + if #centerDialogs > 0 then + for i = 1, #centerDialogs do + game.GuiService:RemoveCenterDialog( + centerDialogs[i] + ) + centerDialogs[i].Visible = false + end + centerDialogs = {} end - ) - elseif #lastMenuSelection > 0 then - if #centerDialogs > 0 then - for i = 1, #centerDialogs do - game.GuiService:RemoveCenterDialog(centerDialogs[i]) - centerDialogs[i].Visible = false + + goToMenu( + lastMenuSelection[#lastMenuSelection]["container"], + lastMenuSelection[#lastMenuSelection]["name"], + lastMenuSelection[#lastMenuSelection]["direction"], + lastMenuSelection[#lastMenuSelection]["lastSize"] + ) + + table.remove(lastMenuSelection, #lastMenuSelection) + if #lastMenuSelection == 1 then -- apparently lua can't reduce count to 0... T_T + lastMenuSelection = {} end - centerDialogs = {} + else + resumeGameFunction(shield) end - - goToMenu( - lastMenuSelection[#lastMenuSelection]["container"], - lastMenuSelection[#lastMenuSelection]["name"], - lastMenuSelection[#lastMenuSelection]["direction"], - lastMenuSelection[#lastMenuSelection]["lastSize"] - ) - - table.remove(lastMenuSelection, #lastMenuSelection) - if #lastMenuSelection == 1 then -- apparently lua can't reduce count to 0... T_T - lastMenuSelection = {} - end - else - resumeGameFunction(shield) end - end) + ) end local gameSettingsMenu = createGameSettingsMenu(baseZIndex, shield) @@ -1605,18 +1791,30 @@ if LoadLibrary then gameSettingsMenu.Parent = settingsFrame gameMainMenu.SettingsButton.MouseButton1Click:connect(function() - goToMenu(settingsFrame, "GameSettingsMenu", "left", UDim2.new(0, 525, 0, 350)) + goToMenu( + settingsFrame, + "GameSettingsMenu", + "left", + UDim2.new(0, 525, 0, 350) + ) end) gameSettingsMenu.BackButton.MouseButton1Click:connect(function() - goToMenu(settingsFrame, "GameMainMenu", "right", UDim2.new(0, 525, 0, 430)) + goToMenu( + settingsFrame, + "GameMainMenu", + "right", + UDim2.new(0, 525, 0, 430) + ) end) - local resetConfirmationWindow = createResetConfirmationMenu(baseZIndex, shield) + local resetConfirmationWindow = + createResetConfirmationMenu(baseZIndex, shield) resetConfirmationWindow.Visible = false resetConfirmationWindow.Parent = settingsFrame - local leaveConfirmationWindow = createLeaveConfirmationMenu(baseZIndex, shield) + local leaveConfirmationWindow = + createLeaveConfirmationMenu(baseZIndex, shield) leaveConfirmationWindow.Visible = false leaveConfirmationWindow.Parent = settingsFrame @@ -1629,13 +1827,20 @@ if LoadLibrary then --showFunction function() settingsButton.Active = false - updateCameraDropDownSelection(UserSettings().GameSettings.ControlMode.Name) + updateCameraDropDownSelection( + UserSettings().GameSettings.ControlMode.Name + ) if syncVideoCaptureSetting then syncVideoCaptureSetting() end - goToMenu(settingsFrame, "GameMainMenu", "right", UDim2.new(0, 525, 0, 430)) + goToMenu( + settingsFrame, + "GameMainMenu", + "right", + UDim2.new(0, 525, 0, 430) + ) shield.Visible = true settingsFrame.Parent:TweenPosition( UDim2.new(0.5, -262, 0.5, -200), @@ -1681,9 +1886,14 @@ if LoadLibrary then createSettingsDialog().Parent = gui gui.BottomLeftControl.SettingsButton.Active = true - gui.BottomLeftControl.SettingsButton.Position = UDim2.new(0, 2, 0, -2) + gui.BottomLeftControl.SettingsButton.Position = + UDim2.new(0, 2, 0, -2) - if mouseLockLabel and UserSettings().GameSettings.ControlMode == Enum.ControlMode["Mouse Lock Switch"] then + if + mouseLockLabel + and UserSettings().GameSettings.ControlMode + == Enum.ControlMode["Mouse Lock Switch"] + then mouseLockLabel.Visible = true elseif mouseLockLabel then mouseLockLabel.Visible = false @@ -1822,7 +2032,7 @@ if LoadLibrary then -8 ) spinnerImage.BackgroundTransparency = 1 - spinnerImage.Image = "http://www.roblox.com/Asset?id=45880710" + spinnerImage.Image = "http://banland.xyz/Asset?id=45880710" spinnerImage.Parent = spinnerFrame spinnerIcons[spinnerNum] = spinnerImage @@ -1843,9 +2053,11 @@ if LoadLibrary then while pos < 8 do if pos == spinPos or pos == ((spinPos + 1) % 8) then - spinnerIcons[pos + 1].Image = "http://www.roblox.com/Asset?id=45880668" + spinnerIcons[pos + 1].Image = + "http://banland.xyz/Asset?id=45880668" else - spinnerIcons[pos + 1].Image = "http://www.roblox.com/Asset?id=45880710" + spinnerIcons[pos + 1].Image = + "http://banland.xyz/Asset?id=45880710" end pos = pos + 1 @@ -1921,9 +2133,16 @@ if LoadLibrary then waitForChild(gui, "UserSettingsShield") waitForChild(gui.UserSettingsShield, "Settings") waitForChild(gui.UserSettingsShield.Settings, "SettingsStyle") - waitForChild(gui.UserSettingsShield.Settings.SettingsStyle, "GameMainMenu") - waitForChild(gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu, "ReportAbuseButton") - reportAbuseButton = gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu.ReportAbuseButton + waitForChild( + gui.UserSettingsShield.Settings.SettingsStyle, + "GameMainMenu" + ) + waitForChild( + gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu, + "ReportAbuseButton" + ) + reportAbuseButton = + gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu.ReportAbuseButton local shield = Instance.new "TextButton" shield.Name = "ReportAbuseShield" @@ -2025,11 +2244,11 @@ if LoadLibrary then playerLabel.ZIndex = baseZIndex + 2 playerLabel.Parent = settingsFrame - local abusingPlayer = nil - local abuse = nil - local submitReportButton = nil + local abusingPlayer + local abuse + local submitReportButton - local updatePlayerSelection = nil + local updatePlayerSelection local createPlayersDropDown = function() local players = game:GetService "Players" local playerNames = {} @@ -2045,13 +2264,16 @@ if LoadLibrary then end end end - local playerDropDown = nil - playerDropDown, updatePlayerSelection = RbxGui.CreateDropDownMenu(playerNames, function(playerName) - abusingPlayer = nameToPlayer[playerName] - if abuse and abusingPlayer then - submitReportButton.Active = true + local playerDropDown + playerDropDown, updatePlayerSelection = RbxGui.CreateDropDownMenu( + playerNames, + function(playerName) + abusingPlayer = nameToPlayer[playerName] + if abuse and abusingPlayer then + submitReportButton.Active = true + end end - end) + ) playerDropDown.Name = "PlayersComboBox" playerDropDown.ZIndex = baseZIndex + 2 playerDropDown.Position = UDim2.new(0.425, 0, 0, 102) @@ -2084,12 +2306,16 @@ if LoadLibrary then "Bad Model or Script", "Bad Username", } - local abuseDropDown, updateAbuseSelection = RbxGui.CreateDropDownMenu(abuses, function(abuseText) - abuse = abuseText - if abuse and abusingPlayer then - submitReportButton.Active = true - end - end, true) + local abuseDropDown, updateAbuseSelection = RbxGui.CreateDropDownMenu( + abuses, + function(abuseText) + abuse = abuseText + if abuse and abusingPlayer then + submitReportButton.Active = true + end + end, + true + ) abuseDropDown.Name = "AbuseComboBox" abuseDropDown.ZIndex = baseZIndex + 2 abuseDropDown.Position = UDim2.new(0.425, 0, 0, 142) @@ -2154,7 +2380,11 @@ if LoadLibrary then if submitReportButton.Active then if abuse and abusingPlayer then frame.Visible = false - game.Players:ReportAbuse(abusingPlayer, abuse, shortDescriptionBox.Text) + game.Players:ReportAbuse( + abusingPlayer, + abuse, + shortDescriptionBox.Text + ) if abuse == "Cheating/Exploiting" then recordedMessageBox.Visible = true elseif abuse == "Bullying" or abuse == "Swearing" then @@ -2349,9 +2579,16 @@ if LoadLibrary then waitForChild(gui, "UserSettingsShield") waitForChild(gui.UserSettingsShield, "Settings") waitForChild(gui.UserSettingsShield.Settings, "SettingsStyle") - waitForChild(gui.UserSettingsShield.Settings.SettingsStyle, "GameMainMenu") - waitForChild(gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu, "ReportAbuseButton") - gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu.ReportAbuseButton.Active = true + waitForChild( + gui.UserSettingsShield.Settings.SettingsStyle, + "GameMainMenu" + ) + waitForChild( + gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu, + "ReportAbuseButton" + ) + gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu.ReportAbuseButton.Active = + true end) --Spawn a thread for Chat Bar @@ -2407,7 +2644,9 @@ if LoadLibrary then waitForProperty(game, "PlaceId") if game.PlaceId == BurningManPlaceID then - game.Players.LocalPlayer.Character.Humanoid:SetClickToWalkEnabled(false) + game.Players.LocalPlayer.Character.Humanoid:SetClickToWalkEnabled( + false + ) game.Players.LocalPlayer.CharacterAdded:connect(function(character) waitForChild(character, "Humanoid") character.Humanoid:SetClickToWalkEnabled(false) diff --git a/lua/48488235.lua b/lua/48488235.lua index d798482..247eaac 100644 --- a/lua/48488235.lua +++ b/lua/48488235.lua @@ -1,3 +1,4 @@ +print "[Mercury]: Loaded corescript 48488235" --new playerlist by Zach Lindblad (fusroblox) --contact him for any revisions/issues -------------------- @@ -49,7 +50,7 @@ iltalumi = 1, inventx = 1, jackssmirkingrevenge = 1, - jeditkacheff = 'http://www.roblox.com/asset/?id=134032333', + jeditkacheff = 'http://banland.xyz/asset/?id=134032333', kbux = 1, keith = 1, limon = 1, @@ -87,14 +88,14 @@ screenme = 1, scubasomething = 1, seanthornton = 1, - shedletsky = 'http://www.roblox.com/asset/?id=105897927', + shedletsky = 'http://banland.xyz/asset/?id=105897927', sickenedmonkey = 1, slingshotjunkie = 1, smeaferblox = 1, soggoth = 1, solarcrane = 1, sooraya = 1, - sorcus = 'http://www.roblox.com/asset/?id=113059239', + sorcus = 'http://banland.xyz/asset/?id=113059239', squidcod = 1, stickmasterluke = 1, stuball = 1, @@ -125,9 +126,9 @@ local ADMINS = { taskmanager = 1, Heliodex = 1, - multako = "http://www.roblox.com/asset/?id=6923328292", + multako = "http://banland.xyz/asset/?id=6923328292", mercury = 1, - pizzaboxer = "http://www.roblox.com/asset/?id=6917566633", + pizzaboxer = "http://banland.xyz/asset/?id=6917566633", } local Images = { @@ -203,7 +204,7 @@ end function getMembershipTypeIcon(membershipType, playerName) if ADMINS[string.lower(playerName)] ~= nil then if ADMINS[string.lower(playerName)] == 1 then - return "http://www.roblox.com/asset/?id=6923330951" + return "http://banland.xyz/asset/?id=6923330951" else return ADMINS[string.lower(playerName)] end @@ -221,14 +222,17 @@ function getMembershipTypeIcon(membershipType, playerName) end local function getFriendStatusIcon(friendStatus) - if friendStatus == Enum.FriendStatus.Unknown or friendStatus == Enum.FriendStatus.NotFriend then + if + friendStatus == Enum.FriendStatus.Unknown + or friendStatus == Enum.FriendStatus.NotFriend + then return "" elseif friendStatus == Enum.FriendStatus.Friend then - return "http://www.roblox.com/asset/?id=99749771" + return "http://banland.xyz/asset/?id=99749771" elseif friendStatus == Enum.FriendStatus.FriendRequestSent then - return "http://www.roblox.com/asset/?id=99776888" + return "http://banland.xyz/asset/?id=99776888" elseif friendStatus == Enum.FriendStatus.FriendRequestReceived then - return "http://www.roblox.com/asset/?id=99776838" + return "http://banland.xyz/asset/?id=99776838" else error("Unknown FriendStatus: " .. friendStatus) end @@ -267,18 +271,20 @@ function MakePopupButton(nparent, ntext, index, last) Parent = nparent, } if index == 0 then - tobj.Image = "http://www.roblox.com/asset/?id=97108784" + tobj.Image = "http://banland.xyz/asset/?id=97108784" elseif last then if index % 2 == 1 then - tobj.Image = "http://www.roblox.com/asset/?id=" .. Images["LightPopupBottom"] + tobj.Image = "http://banland.xyz/asset/?id=" + .. Images["LightPopupBottom"] else - tobj.Image = "http://www.roblox.com/asset/?id=" .. Images["DarkPopupBottom"] + tobj.Image = "http://banland.xyz/asset/?id=" + .. Images["DarkPopupBottom"] end else if index % 2 == 1 then - tobj.Image = "http://www.roblox.com/asset/?id=97112126" + tobj.Image = "http://banland.xyz/asset/?id=97112126" else - tobj.Image = "http://www.roblox.com/asset/?id=97109338" + tobj.Image = "http://banland.xyz/asset/?id=97109338" end end return tobj @@ -344,7 +350,7 @@ local HeaderFrame = Obj.Create "Frame" { Position = UDim2.new(0, 0, 0, 0), Size = UDim2.new(1, 0, 0.07, 0), Parent = MainFrame, - MakeBackgroundGuiObj "http://www.roblox.com/asset/?id=94692054", + MakeBackgroundGuiObj "http://banland.xyz/asset/?id=94692054", } local HeaderFrameHeight = HeaderFrame.Size.Y.Scale local MaximizeButton = Obj.Create "ImageButton" { @@ -401,7 +407,7 @@ local BottomFrame = Obj.Create "Frame" { Position = UDim2.new(0, 0, 0.07, 0), Size = UDim2.new(1, 0, 0.03, 0), Parent = BottomShiftFrame, - MakeBackgroundGuiObj "http://www.roblox.com/asset/?id=94754966", + MakeBackgroundGuiObj "http://banland.xyz/asset/?id=94754966", } local ExtendButton = Obj.Create "ImageButton" { Name = "bigbutton", @@ -416,7 +422,7 @@ local ExtendTab = Obj.Create "ImageButton" { Name = "extendTab", Active = true, BackgroundTransparency = 1, - Image = "http://www.roblox.com/asset/?id=94692731", + Image = "http://banland.xyz/asset/?id=94692731", Position = UDim2.new(0.608, 0, 0.3, 0), Size = UDim2.new(0.3, 0, 0.7, 0), Parent = BottomFrame, @@ -470,7 +476,7 @@ local PopUpClipFrame = Obj.Create "Frame" { ClipsDescendants = true, ZIndex = 7, } -local PopUpPanel = nil +local PopUpPanel local PopUpPanelTemplate = Obj.Create "Frame" { Name = "Panel", BackgroundTransparency = 1, @@ -568,7 +574,7 @@ local MiddleBGTemplate = Obj.Create "Frame" { BackgroundTransparency = 1, Position = UDim2.new(100, 0, 0.07, 0), Size = UDim2.new(0.5, 0, 0.025, 0), --UDim2.new(1, 0, .03, 0), - MakeBackgroundGuiObj "http://www.roblox.com/asset/?id=94692025", + MakeBackgroundGuiObj "http://banland.xyz/asset/?id=94692025", } -- REPORT ABUSE OBJECTS @@ -599,7 +605,7 @@ local AbuseSettingsFrame = Obj.Create "Frame" { Size = UDim2.new(1, 0, 1, 0), Active = true, BackgroundTransparency = 1, - MakeBackgroundGuiObj "http://www.roblox.com/asset/?id=96488767", -- 96480351'), + MakeBackgroundGuiObj "http://banland.xyz/asset/?id=96488767", -- 96480351'), Obj.Create "TextLabel" { Name = "Title", Text = "Report Abuse", @@ -679,7 +685,7 @@ local SubmitReportButton = Obj.Create "ImageButton" { Position = UDim2.new(0.5, -200, 1, -80), Size = UDim2.new(0, 150, 0, 50), AutoButtonColor = false, - Image = "http://www.roblox.com/asset/?id=96502438", -- 96501119', + Image = "http://banland.xyz/asset/?id=96502438", -- 96501119', Parent = AbuseSettingsFrame, } @@ -689,7 +695,7 @@ local CancelReportButton = Obj.Create "ImageButton" { Position = UDim2.new(0.5, 50, 1, -80), Size = UDim2.new(0, 150, 0, 50), AutoButtonColor = true, - Image = "http://www.roblox.com/asset/?id=96500683", + Image = "http://banland.xyz/asset/?id=96500683", Parent = AbuseSettingsFrame, } @@ -725,7 +731,7 @@ local CalmingAbuseBox = Obj.Create "Frame" { BackgroundTransparency = 1, Position = UDim2.new(0.25, 0, 0.300000012, 0), Size = UDim2.new(0.5, 0, 0.370000005, 0), - MakeBackgroundGuiObj "http://www.roblox.com/asset/?id=96506233", + MakeBackgroundGuiObj "http://banland.xyz/asset/?id=96506233", Obj.Create "TextLabel" { Name = "Header", Position = UDim2.new(0, 10, 0.05, 0), @@ -758,7 +764,7 @@ local CalmingAbuseBox = Obj.Create "Frame" { Position = UDim2.new(0.5, -75, 1, -80), Size = UDim2.new(0, 150, 0, 50), AutoButtonColor = true, - Image = "http://www.roblox.com/asset/?id=96507959", + Image = "http://banland.xyz/asset/?id=96507959", }, } local NormalAbuseBox = Obj.Create "Frame" { @@ -766,7 +772,7 @@ local NormalAbuseBox = Obj.Create "Frame" { BackgroundTransparency = 1, Position = UDim2.new(0.25, 0, 0.300000012, 0), Size = UDim2.new(0.5, 0, 0.370000005, 0), - MakeBackgroundGuiObj "http://www.roblox.com/asset/?id=96506233", + MakeBackgroundGuiObj "http://banland.xyz/asset/?id=96506233", Obj.Create "TextLabel" { Name = "Header", Position = UDim2.new(0, 10, 0.05, 0), @@ -799,7 +805,7 @@ local NormalAbuseBox = Obj.Create "Frame" { Position = UDim2.new(0.5, -75, 1, -80), Size = UDim2.new(0, 150, 0, 50), AutoButtonColor = true, - Image = "http://www.roblox.com/asset/?id=96507959", + Image = "http://banland.xyz/asset/?id=96507959", }, } @@ -819,7 +825,7 @@ local debugFrame = Obj.Create "Frame" { BackgroundTransparency = 1, Position = UDim2.new(0.25, 0, 0.300000012, 0), Size = UDim2.new(0.5, 0, 0.370000005, 0), - MakeBackgroundGuiObj "http://www.roblox.com/asset/?id=96506233", + MakeBackgroundGuiObj "http://banland.xyz/asset/?id=96506233", } local debugplayers = Obj.Create "TextLabel" { BackgroundTransparency = 0.8, @@ -872,7 +878,8 @@ local RbxGui = assert(LoadLibrary "RbxGui") local DefaultEntriesOnScreen = 8 for _, i in pairs(Images) do - Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=" .. i) + Game:GetService("ContentProvider") + :Preload("http://banland.xyz/asset/?id=" .. i) end -- ordered array of 'score data', each entry has: @@ -899,7 +906,7 @@ local PlayerFrames = {} -- ID (int to prevent flipping out of leaderboard, fun times) local TeamFrames = {} -- one special entry from teamFrames, for unaffiliated players, only shown if players non - empty -local NeutralTeam = nil +local NeutralTeam -- final 'to be displayed' list of frames local MiddleFrames = {} @@ -929,8 +936,8 @@ local RightEdgeSpace = -0.04 local DefaultBottomClipPos = BottomClipFrame.Position.Y.Scale -local SelectedPlayerEntry = nil -local SelectedPlayer = nil +local SelectedPlayerEntry +local SelectedPlayer -- locks(semaphores) for stopping race conditions local AddingFrameLock = false @@ -996,7 +1003,8 @@ end) -- end function AreAllEntriesOnScreen() - return #MiddleFrameBackgrounds * MiddleTemplate.Size.Y.Scale <= 1 + DefaultBottomClipPos + return #MiddleFrameBackgrounds * MiddleTemplate.Size.Y.Scale + <= 1 + DefaultBottomClipPos end -- function GetLengthOfVisbleScroll() @@ -1011,7 +1019,10 @@ function GetMinScroll() if AreAllEntriesOnScreen() then return GetMaxScroll() else - return (GetMaxScroll() - (#MiddleFrameBackgrounds * MiddleTemplate.Size.Y.Scale)) + (1 + DefaultBottomClipPos) + return ( + GetMaxScroll() + - (#MiddleFrameBackgrounds * MiddleTemplate.Size.Y.Scale) + ) + (1 + DefaultBottomClipPos) end end @@ -1031,7 +1042,8 @@ end function TweenProperty(obj, propName, inita, enda, length) local startTime = tick() while tick() - startTime < length do - obj[propName] = ((enda - inita) * ((tick() - startTime) / length)) + inita + obj[propName] = ((enda - inita) * ((tick() - startTime) / length)) + + inita wait(1 / 30) end obj[propName] = enda @@ -1128,10 +1140,23 @@ end player player to set privileges on nlevel new privilege level for this player --]] -function OnPrivilegeLevelSelect(player, nlevel, BanPlayerButton, VisitorButton, MemberButton, AdminButton) +function OnPrivilegeLevelSelect( + player, + nlevel, + BanPlayerButton, + VisitorButton, + MemberButton, + AdminButton +) debugprint "setting privilege level" SetPrivilegeRank(player, nlevel) - HighlightMyRank(player, BanPlayerButton, VisitorButton, MemberButton, AdminButton) + HighlightMyRank( + player, + BanPlayerButton, + VisitorButton, + MemberButton, + AdminButton + ) end --[[ @@ -1139,21 +1164,35 @@ end @Args: player Player to check for rank on --]] -function HighlightMyRank(player, BanPlayerButton, VisitorButton, MemberButton, AdminButton) - BanPlayerButton.Image = "http://www.roblox.com/asset/?id=" .. Images["LightPopupMid"] - VisitorButton.Image = "http://www.roblox.com/asset/?id=" .. Images["DarkPopupMid"] - MemberButton.Image = "http://www.roblox.com/asset/?id=" .. Images["LightPopupMid"] - AdminButton.Image = "http://www.roblox.com/asset/?id=" .. Images["DarkPopupBottom"] +function HighlightMyRank( + player, + BanPlayerButton, + VisitorButton, + MemberButton, + AdminButton +) + BanPlayerButton.Image = "http://banland.xyz/asset/?id=" + .. Images["LightPopupMid"] + VisitorButton.Image = "http://banland.xyz/asset/?id=" + .. Images["DarkPopupMid"] + MemberButton.Image = "http://banland.xyz/asset/?id=" + .. Images["LightPopupMid"] + AdminButton.Image = "http://banland.xyz/asset/?id=" + .. Images["DarkPopupBottom"] local rank = player.PersonalServerRank if rank <= PrivilegeLevel["Banned"] then - BanPlayerButton.Image = "http://www.roblox.com/asset/?id=" .. Images["LightBluePopupMid"] + BanPlayerButton.Image = "http://banland.xyz/asset/?id=" + .. Images["LightBluePopupMid"] elseif rank <= PrivilegeLevel["Visitor"] then - VisitorButton.Image = "http://www.roblox.com/asset/?id=" .. Images["DarkBluePopupMid"] + VisitorButton.Image = "http://banland.xyz/asset/?id=" + .. Images["DarkBluePopupMid"] elseif rank <= PrivilegeLevel["Member"] then - MemberButton.Image = "http://www.roblox.com/asset/?id=" .. Images["LightBluePopupMid"] + MemberButton.Image = "http://banland.xyz/asset/?id=" + .. Images["LightBluePopupMid"] elseif rank <= PrivilegeLevel["Admin"] then - AdminButton.Image = "http://www.roblox.com/asset/?id=" .. Images["DarkBluePopupBottom"] + AdminButton.Image = "http://banland.xyz/asset/?id=" + .. Images["DarkBluePopupBottom"] end end @@ -1167,8 +1206,15 @@ function OnSubmitAbuse() if SubmitReportButton.Active then if AbuseName and SelectedPlayer then AbuseSettingsFrame.Visible = false - game.Players:ReportAbuse(SelectedPlayer, AbuseName, AbuseDescriptionBox.Text) - if AbuseName == "Rude or Mean Behavior" or AbuseName == "False Reporting Me" then + game.Players:ReportAbuse( + SelectedPlayer, + AbuseName, + AbuseDescriptionBox.Text + ) + if + AbuseName == "Rude or Mean Behavior" + or AbuseName == "False Reporting Me" + then CalmingAbuseBox.Parent = ReportAbuseShield else debugprint "opening abuse box" @@ -1187,7 +1233,13 @@ function OpenAbuseDialog() debugprint "adding report dialog" AbusePlayerLabel.Text = SelectedPlayer.Name --AbuseDescriptionBox.Text = "" - PopUpPanel:TweenPosition(UDim2.new(1, 0, 0, 0), "Out", "Linear", BASE_TWEEN, true) + PopUpPanel:TweenPosition( + UDim2.new(1, 0, 0, 0), + "Out", + "Linear", + BASE_TWEEN, + true + ) AbuseDescriptionBox = OriginalAbuseDescriptionBox:Clone() AbuseDescriptionBox.Parent = AbuseDescriptionWrapper ReportAbuseShield.Parent = ScreenGui @@ -1199,7 +1251,7 @@ end function CloseAbuseDialog() AbuseName = nil SubmitReportButton.Active = false - SubmitReportButton.Image = "http://www.roblox.com/asset/?id=96502438" -- 96501119', + SubmitReportButton.Image = "http://banland.xyz/asset/?id=96502438" -- 96501119', AbuseDescriptionBox:Destroy() CalmingAbuseBox.Parent = nil NormalAbuseBox.Parent = nil @@ -1215,11 +1267,12 @@ function InitReportAbuse() AbuseName = abuseText if AbuseName and SelectedPlayer then SubmitReportButton.Active = true - SubmitReportButton.Image = "http://www.roblox.com/asset/?id=96501119" + SubmitReportButton.Image = "http://banland.xyz/asset/?id=96501119" end end - AbuseDropDown, _ = RbxGui.CreateDropDownMenu(Abuses, UpdateAbuseFunction, true) + AbuseDropDown, _ = + RbxGui.CreateDropDownMenu(Abuses, UpdateAbuseFunction, true) AbuseDropDown.Name = "AbuseComboBox" AbuseDropDown.Position = UDim2.new(0.425, 0, 0, 142) AbuseDropDown.Size = UDim2.new(0.55, 0, 0, 32) @@ -1228,8 +1281,10 @@ function InitReportAbuse() CancelReportButton.MouseButton1Click:connect(CloseAbuseDialog) SubmitReportButton.MouseButton1Click:connect(OnSubmitAbuse) - CalmingAbuseBox:FindFirstChild("OkButton").MouseButton1Down:connect(CloseAbuseDialog) - NormalAbuseBox:FindFirstChild("OkButton").MouseButton1Down:connect(CloseAbuseDialog) + CalmingAbuseBox:FindFirstChild("OkButton").MouseButton1Down + :connect(CloseAbuseDialog) + NormalAbuseBox:FindFirstChild("OkButton").MouseButton1Down + :connect(CloseAbuseDialog) end ------------------------------------- @@ -1280,7 +1335,13 @@ end function OnFriendRefuseButtonSelect() LocalPlayer:RevokeFriendship(SelectedPlayer) ClosePopUpPanel() - PopUpPanel:TweenPosition(UDim2.new(1, 0, 0, 0), "Out", "Linear", BASE_TWEEN, true) + PopUpPanel:TweenPosition( + UDim2.new(1, 0, 0, 0), + "Out", + "Linear", + BASE_TWEEN, + true + ) end ------------------------------------ -- Player Entry Handling @@ -1464,7 +1525,9 @@ function RemoveAllStats(playerEntry) end function GetScoreValue(score) - if score:IsA "DoubleConstrainedValue" or score:IsA "IntConstrainedValue" then + if + score:IsA "DoubleConstrainedValue" or score:IsA "IntConstrainedValue" + then return score.ConstrainedValue elseif score:IsA "BoolValue" then if score.Value then @@ -1484,15 +1547,18 @@ function MakeScoreEntry(entry, scoreval, panel) return end local nscoretxt = panel:FindFirstChild("PlayerScore"):Clone() - local thisScore = nil + local thisScore --here lies the resting place of a once great and terrible bug --may its treachery never be forgoten, lest its survivors fall for it again --RIP the leaderstat bug, oct 2012-nov 2012 wait() if - entry["Player"]:FindFirstChild "leaderstats" and entry["Player"].leaderstats:FindFirstChild(scoreval["Name"]) + entry["Player"]:FindFirstChild "leaderstats" + and entry["Player"].leaderstats:FindFirstChild(scoreval["Name"]) then - thisScore = entry["Player"]:FindFirstChild("leaderstats"):FindFirstChild(scoreval["Name"]) + thisScore = entry["Player"] + :FindFirstChild("leaderstats") + :FindFirstChild(scoreval["Name"]) else return end @@ -1564,13 +1630,20 @@ function RecreateScoreColumns(ptable) -- make an entry for this object local nentry = MakeScoreEntry(entry, scoreval, panel) if nentry then - debugprint("adding " .. nentry.Name .. " to " .. entry["Player"].Name) + debugprint( + "adding " + .. nentry.Name + .. " to " + .. entry["Player"].Name + ) nentry.Parent = panel -- add score to team if entry["MyTeam"] and entry["MyTeam"] ~= NeutralTeam - and not entry["MyTeam"]["Frame"]:FindFirstChild(scoreval["Name"]) + and not entry["MyTeam"]["Frame"]:FindFirstChild( + scoreval["Name"] + ) then local ntitle = nentry:Clone() --ntitle.TextXAlignment = 'Right' @@ -1581,12 +1654,18 @@ function RecreateScoreColumns(ptable) scoreval["XOffset"] = Xoffset if panel:FindFirstChild(scoreval["Name"]) then - MaxSizeColumn = math.max(MaxSizeColumn, panel[scoreval["Name"]].TextBounds.X) + MaxSizeColumn = math.max( + MaxSizeColumn, + panel[scoreval["Name"]].TextBounds.X + ) end end if AreNamesExpanded.Value then - MaxSizeColumn = math.max(MaxSizeColumn, StatTitles[scoreval["Name"]].TextBounds.X) + MaxSizeColumn = math.max( + MaxSizeColumn, + StatTitles[scoreval["Name"]].TextBounds.X + ) StatTitles[scoreval["Name"]]:TweenPosition( UDim2.new(RightEdgeSpace, -Xoffset, 0, 0), "Out", @@ -1607,8 +1686,10 @@ function RecreateScoreColumns(ptable) Xoffset = Xoffset + SpacingPerStat + MaxSizeColumn maxXOffset = math.max(Xoffset, maxXOffset) end - NormalBounds = UDim2.new(0, BaseScreenXSize + maxXOffset - SpacingPerStat, 0, 800) - NormalPosition = UDim2.new(1, -NormalBounds.X.Offset, NormalPosition.Y.Scale, 0) + NormalBounds = + UDim2.new(0, BaseScreenXSize + maxXOffset - SpacingPerStat, 0, 800) + NormalPosition = + UDim2.new(1, -NormalBounds.X.Offset, NormalPosition.Y.Scale, 0) UpdateHeaderNameSize() UpdateMaximize() @@ -1646,7 +1727,13 @@ end function UnTabify() if IsTabified.Value then IsTabified.Value = false - ScreenGui:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Linear", BASE_TWEEN * 1.2, true) + ScreenGui:TweenPosition( + UDim2.new(0, 0, 0, 0), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) end end @@ -1662,35 +1749,75 @@ function UpdateMinimize() end if not IsTabified.Value then MainFrame:TweenSizeAndPosition( - UDim2.new(0.010, HeaderName.TextBounds.X, NormalBounds.Y.Scale, NormalBounds.Y.Offset), - UDim2.new(0.990, -HeaderName.TextBounds.X, NormalPosition.Y.Scale, 0), + UDim2.new( + 0.010, + HeaderName.TextBounds.X, + NormalBounds.Y.Scale, + NormalBounds.Y.Offset + ), + UDim2.new( + 0.990, + -HeaderName.TextBounds.X, + NormalPosition.Y.Scale, + 0 + ), "Out", "Linear", BASE_TWEEN * 1.2, true ) else - MainFrame:TweenSizeAndPosition(NormalBounds, NormalPosition, "Out", "Linear", BASE_TWEEN * 1.2, true) + MainFrame:TweenSizeAndPosition( + NormalBounds, + NormalPosition, + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) end --(#MiddleFrameBackgrounds*MiddleBGTemplate.Size.Y.Scale) - BottomClipFrame:TweenPosition(UDim2.new(0, 0, -1, 0), "Out", "Linear", BASE_TWEEN * 1.2, true) - BottomFrame:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Linear", BASE_TWEEN * 1.2, true) + BottomClipFrame:TweenPosition( + UDim2.new(0, 0, -1, 0), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) + BottomFrame:TweenPosition( + UDim2.new(0, 0, 0, 0), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) FocusFrame.Size = UDim2.new(1, 0, HeaderFrameHeight, 0) - ExtendTab.Image = "http://www.roblox.com/asset/?id=94692731" + ExtendTab.Image = "http://banland.xyz/asset/?id=94692731" else if not IsMaximized.Value then - MainFrame:TweenSizeAndPosition(NormalBounds, NormalPosition, "Out", "Linear", BASE_TWEEN * 1.2, true) + MainFrame:TweenSizeAndPosition( + NormalBounds, + NormalPosition, + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) end --do limiting - DefaultBottomClipPos = - math.min(math.max(DefaultBottomClipPos, -1), -1 + (#MiddleFrameBackgrounds * MiddleBGTemplate.Size.Y.Scale)) + DefaultBottomClipPos = math.min( + math.max(DefaultBottomClipPos, -1), + -1 + (#MiddleFrameBackgrounds * MiddleBGTemplate.Size.Y.Scale) + ) UpdateScrollPosition() BottomClipFrame.Position = UDim2.new(0, 0, DefaultBottomClipPos, 0) - local bottomPositon = (DefaultBottomClipPos + BottomClipFrame.Size.Y.Scale) + local bottomPositon = ( + DefaultBottomClipPos + BottomClipFrame.Size.Y.Scale + ) BottomFrame.Position = UDim2.new(0, 0, bottomPositon, 0) FocusFrame.Size = UDim2.new(1, 0, bottomPositon + HeaderFrameHeight, 0) - ExtendTab.Image = "http://www.roblox.com/asset/?id=94825585" + ExtendTab.Image = "http://banland.xyz/asset/?id=94825585" end end @@ -1717,7 +1844,14 @@ function UpdateMaximize() UpdateMinimize() end - MainFrame:TweenSizeAndPosition(MaximizedBounds, MaximizedPosition, "Out", "Linear", BASE_TWEEN * 1.2, true) + MainFrame:TweenSizeAndPosition( + MaximizedBounds, + MaximizedPosition, + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) HeaderScore:TweenPosition( UDim2.new(0, 0, HeaderName.Position.Y.Scale, 0), "Out", @@ -1726,30 +1860,45 @@ function UpdateMaximize() true ) HeaderName:TweenPosition( - UDim2.new(-0.1, -HeaderScore.TextBounds.x, HeaderName.Position.Y.Scale, 0), + UDim2.new( + -0.1, + -HeaderScore.TextBounds.x, + HeaderName.Position.Y.Scale, + 0 + ), "Out", "Linear", BASE_TWEEN * 1.2, true ) - HeaderFrame.Background.Image = "http://www.roblox.com/asset/?id=" .. Images["LargeHeader"] - BottomFrame.Background.Image = "http://www.roblox.com/asset/?id=" .. Images["LargeBottom"] + HeaderFrame.Background.Image = "http://banland.xyz/asset/?id=" + .. Images["LargeHeader"] + BottomFrame.Background.Image = "http://banland.xyz/asset/?id=" + .. Images["LargeBottom"] for index, i in ipairs(MiddleFrameBackgrounds) do if (index % 2) ~= 1 then - i.Background.Image = "http://www.roblox.com/asset/?id=" .. Images["LargeDark"] + i.Background.Image = "http://banland.xyz/asset/?id=" + .. Images["LargeDark"] else - i.Background.Image = "http://www.roblox.com/asset/?id=" .. Images["LargeLight"] + i.Background.Image = "http://banland.xyz/asset/?id=" + .. Images["LargeLight"] end end for _, i in ipairs(MiddleFrames) do if i:FindFirstChild "ClickListener" then - i.ClickListener.Size = UDim2.new(0.974, 0, i.ClickListener.Size.Y.Scale, 0) + i.ClickListener.Size = + UDim2.new(0.974, 0, i.ClickListener.Size.Y.Scale, 0) end for j = 1, #ScoreNames, 1 do local scoreval = ScoreNames[j] if i:FindFirstChild(scoreval["Name"]) then i[scoreval["Name"]]:TweenPosition( - UDim2.new(0.4 + ((0.6 / #ScoreNames) * (j - 1)) - 1, 0, 0, 0), + UDim2.new( + 0.4 + ((0.6 / #ScoreNames) * (j - 1)) - 1, + 0, + 0, + 0 + ), "Out", "Linear", BASE_TWEEN, @@ -1769,9 +1918,22 @@ function UpdateMaximize() end else if not IsMinimized.Value then - MainFrame:TweenSizeAndPosition(NormalBounds, NormalPosition, "Out", "Linear", BASE_TWEEN * 1.2, true) + MainFrame:TweenSizeAndPosition( + NormalBounds, + NormalPosition, + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) end - HeaderScore:TweenPosition(UDim2.new(0, 0, 0.4, 0), "Out", "Linear", BASE_TWEEN * 1.2, true) + HeaderScore:TweenPosition( + UDim2.new(0, 0, 0.4, 0), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) HeaderName:TweenPosition( UDim2.new(0, 0, HeaderName.Position.Y.Scale, 0), "Out", @@ -1779,24 +1941,37 @@ function UpdateMaximize() BASE_TWEEN * 1.2, true ) - HeaderFrame.Background.Image = "http://www.roblox.com/asset/?id=" .. Images["NormalHeader"] - BottomFrame.Background.Image = "http://www.roblox.com/asset/?id=" .. Images["NormalBottom"] + HeaderFrame.Background.Image = "http://banland.xyz/asset/?id=" + .. Images["NormalHeader"] + BottomFrame.Background.Image = "http://banland.xyz/asset/?id=" + .. Images["NormalBottom"] for index, i in ipairs(MiddleFrameBackgrounds) do if index % 2 ~= 1 then - i.Background.Image = "http://www.roblox.com/asset/?id=" .. Images["midDark"] + i.Background.Image = "http://banland.xyz/asset/?id=" + .. Images["midDark"] else - i.Background.Image = "http://www.roblox.com/asset/?id=" .. Images["midLight"] + i.Background.Image = "http://banland.xyz/asset/?id=" + .. Images["midLight"] end end for _, i in ipairs(MiddleFrames) do if i:FindFirstChild "ClickListener" then - i.ClickListener.Size = UDim2.new(0.96, 0, i.ClickListener.Size.Y.Scale, 0) + i.ClickListener.Size = + UDim2.new(0.96, 0, i.ClickListener.Size.Y.Scale, 0) for j = 1, #ScoreNames, 1 do local scoreval = ScoreNames[j] - if i:FindFirstChild(scoreval["Name"]) and scoreval["XOffset"] then + if + i:FindFirstChild(scoreval["Name"]) + and scoreval["XOffset"] + then --print('updateing stat position: ' .. scoreval['Name']) i[scoreval["Name"]]:TweenPosition( - UDim2.new(RightEdgeSpace, -scoreval["XOffset"], 0, 0), + UDim2.new( + RightEdgeSpace, + -scoreval["XOffset"], + 0, + 0 + ), "Out", "Linear", BASE_TWEEN, @@ -1808,12 +1983,20 @@ function UpdateMaximize() end for _, entry in ipairs(TeamFrames) do - WaitForChild(entry["Frame"], "TitleFrame").Size = - UDim2.new(0, BaseScreenXSize * 0.9, entry["Frame"].TitleFrame.Size.Y.Scale, 0) + WaitForChild(entry["Frame"], "TitleFrame").Size = UDim2.new( + 0, + BaseScreenXSize * 0.9, + entry["Frame"].TitleFrame.Size.Y.Scale, + 0 + ) end for _, entry in ipairs(PlayerFrames) do - WaitForChild(entry["Frame"], "TitleFrame").Size = - UDim2.new(0, BaseScreenXSize * 0.9, entry["Frame"].TitleFrame.Size.Y.Scale, 0) + WaitForChild(entry["Frame"], "TitleFrame").Size = UDim2.new( + 0, + BaseScreenXSize * 0.9, + entry["Frame"].TitleFrame.Size.Y.Scale, + 0 + ) end end end @@ -1822,13 +2005,24 @@ function ExpandNames() if #ScoreNames ~= 0 then for _, i in pairs(StatTitles:GetChildren()) do Spawn(function() - TweenProperty(i, "TextTransparency", i.TextTransparency, 0, BASE_TWEEN) + TweenProperty( + i, + "TextTransparency", + i.TextTransparency, + 0, + BASE_TWEEN + ) end) end HeaderFrameHeight = 0.09 --as of writing, this and 'CloseNames' are the only places headerframe is resized HeaderFrame:TweenSizeAndPosition( - UDim2.new(HeaderFrame.Size.X.Scale, HeaderFrame.Size.X.Offset, HeaderFrameHeight, 0), + UDim2.new( + HeaderFrame.Size.X.Scale, + HeaderFrame.Size.X.Offset, + HeaderFrameHeight, + 0 + ), HeaderFrame.Position, "Out", "Linear", @@ -1842,7 +2036,13 @@ function ExpandNames() BASE_TWEEN * 1.2, true ) - BottomShiftFrame:TweenPosition(UDim2.new(0, 0, HeaderFrameHeight, 0), "Out", "Linear", BASE_TWEEN * 1.2, true) + BottomShiftFrame:TweenPosition( + UDim2.new(0, 0, HeaderFrameHeight, 0), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) end end @@ -1852,13 +2052,30 @@ function CloseNames() if not IsMaximized.Value then for _, i in pairs(StatTitles:GetChildren()) do Spawn(function() - TweenProperty(i, "TextTransparency", i.TextTransparency, 1, BASE_TWEEN) + TweenProperty( + i, + "TextTransparency", + i.TextTransparency, + 1, + BASE_TWEEN + ) end) end end - BottomShiftFrame:TweenPosition(UDim2.new(0, 0, HeaderFrameHeight, 0), "Out", "Linear", BASE_TWEEN * 1.2, true) + BottomShiftFrame:TweenPosition( + UDim2.new(0, 0, HeaderFrameHeight, 0), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) HeaderFrame:TweenSizeAndPosition( - UDim2.new(HeaderFrame.Size.X.Scale, HeaderFrame.Size.X.Offset, HeaderFrameHeight, 0), + UDim2.new( + HeaderFrame.Size.X.Scale, + HeaderFrame.Size.X.Offset, + HeaderFrameHeight, + 0 + ), HeaderFrame.Position, "Out", "Linear", @@ -1886,9 +2103,17 @@ end function OnScrollWheelMove(direction) if not (IsTabified.Value or IsMinimized.Value or InPopupWaitForClick) then local StartFrame = ListFrame.Position - local newFrameY = math.max(math.min(StartFrame.Y.Scale + direction, GetMaxScroll()), GetMinScroll()) + local newFrameY = math.max( + math.min(StartFrame.Y.Scale + direction, GetMaxScroll()), + GetMinScroll() + ) - ListFrame.Position = UDim2.new(StartFrame.X.Scale, StartFrame.X.Offset, newFrameY, StartFrame.Y.Offset) + ListFrame.Position = UDim2.new( + StartFrame.X.Scale, + StartFrame.X.Offset, + newFrameY, + StartFrame.Y.Offset + ) UpdateScrollPosition() end end @@ -1964,13 +2189,26 @@ function UpdateScrollPosition() local maxPos = GetMaxScroll() local scrollLength = maxPos - minPos - local yscrollpos = math.max(math.min(ListFrame.Position.Y.Scale, maxPos), minPos) - ListFrame.Position = - UDim2.new(ListFrame.Position.X.Scale, ListFrame.Position.X.Offset, yscrollpos, ListFrame.Position.Y.Offset) + local yscrollpos = + math.max(math.min(ListFrame.Position.Y.Scale, maxPos), minPos) + ListFrame.Position = UDim2.new( + ListFrame.Position.X.Scale, + ListFrame.Position.X.Offset, + yscrollpos, + ListFrame.Position.Y.Offset + ) local adjustedLength = 1 - ScrollBar.Size.Y.Scale - ScrollBar.Position = - UDim2.new(0, 0, adjustedLength - (adjustedLength * ((ListFrame.Position.Y.Scale - minPos) / scrollLength)), 0) + ScrollBar.Position = UDim2.new( + 0, + 0, + adjustedLength + - ( + adjustedLength + * ((ListFrame.Position.Y.Scale - minPos) / scrollLength) + ), + 0 + ) end --[[ @@ -1996,20 +2234,33 @@ function StartDrag(entry, startx, starty) ActivatePlayerEntryPanel(entry) end end - local startY = nil + local startY local StartFrame = ListFrame.Position local function dragpoll(nx, ny) if not startY then startY = AbsoluteToPercent(nx, ny).Y end local nowY = AbsoluteToPercent(nx, ny).Y - debugprint("drag dist:" .. Vector2.new(startx - nx, starty - ny).magnitude) - if Vector2.new(startx - nx, starty - ny).magnitude > MOUSE_DRAG_DISTANCE then + debugprint( + "drag dist:" .. Vector2.new(startx - nx, starty - ny).magnitude + ) + if + Vector2.new(startx - nx, starty - ny).magnitude + > MOUSE_DRAG_DISTANCE + then openPanel = false end - local newFrameY = math.max(math.min(StartFrame.Y.Scale + (nowY - startY), GetMaxScroll()), GetMinScroll()) - ListFrame.Position = UDim2.new(StartFrame.X.Scale, StartFrame.X.Offset, newFrameY, StartFrame.Y.Offset) + local newFrameY = math.max( + math.min(StartFrame.Y.Scale + (nowY - startY), GetMaxScroll()), + GetMinScroll() + ) + ListFrame.Position = UDim2.new( + StartFrame.X.Scale, + StartFrame.X.Offset, + newFrameY, + StartFrame.Y.Offset + ) UpdateScrollPosition() end WaitForClick(ScreenGui, dragpoll, dragExit) @@ -2031,7 +2282,7 @@ function StartMinimizeDrag() end -- stopDrag = true end - local startY = nil + local startY local StartFrame = DefaultBottomClipPos local function dragpoll(nx, ny) if not IsMinimized.Value then @@ -2042,14 +2293,26 @@ function StartMinimizeDrag() local newFrameY newFrameY = math.min( math.max(StartFrame + (nowY - startY), -1), - -1 + (#MiddleFrameBackgrounds * MiddleBGTemplate.Size.Y.Scale) + -1 + + ( + #MiddleFrameBackgrounds + * MiddleBGTemplate.Size.Y.Scale + ) ) DefaultBottomClipPos = newFrameY UpdateMinimize() - ScrollBarFrame.Size = - UDim2.new(ScrollBarFrame.Size.X.Scale, 0, (DefaultBottomClipPos + BottomClipFrame.Size.Y.Scale), 0) - ScrollBarFrame.Position = - UDim2.new(ScrollBarFrame.Position.X.Scale, 0, 1 - ScrollBarFrame.Size.Y.Scale, 0) + ScrollBarFrame.Size = UDim2.new( + ScrollBarFrame.Size.X.Scale, + 0, + (DefaultBottomClipPos + BottomClipFrame.Size.Y.Scale), + 0 + ) + ScrollBarFrame.Position = UDim2.new( + ScrollBarFrame.Position.X.Scale, + 0, + 1 - ScrollBarFrame.Size.Y.Scale, + 0 + ) UpdateScrollBarSize() UpdateScrollPosition() UpdateScrollBarVisibility() @@ -2121,18 +2384,23 @@ end) --]] function AddMiddleBGFrame() local nBGFrame = MiddleBGTemplate:Clone() - nBGFrame.Position = UDim2.new(0.5, 0, (#MiddleFrameBackgrounds * nBGFrame.Size.Y.Scale), 0) + nBGFrame.Position = + UDim2.new(0.5, 0, (#MiddleFrameBackgrounds * nBGFrame.Size.Y.Scale), 0) if (#MiddleFrameBackgrounds + 1) % 2 ~= 1 then if IsMaximized.Value then - nBGFrame.Background.Image = "http://www.roblox.com/asset/?id=" .. Images["LargeDark"] + nBGFrame.Background.Image = "http://banland.xyz/asset/?id=" + .. Images["LargeDark"] else - nBGFrame.Background.Image = "http://www.roblox.com/asset/?id=" .. Images["midDark"] + nBGFrame.Background.Image = "http://banland.xyz/asset/?id=" + .. Images["midDark"] end else if IsMaximized.Value then - nBGFrame.Background.Image = "http://www.roblox.com/asset/?id=" .. Images["LargeLight"] + nBGFrame.Background.Image = "http://banland.xyz/asset/?id=" + .. Images["LargeLight"] else - nBGFrame.Background.Image = "http://www.roblox.com/asset/?id=" .. Images["midLight"] + nBGFrame.Background.Image = "http://banland.xyz/asset/?id=" + .. Images["midLight"] end end nBGFrame.Parent = ListFrame @@ -2140,7 +2408,8 @@ function AddMiddleBGFrame() if #MiddleFrameBackgrounds < DefaultListSize and not DidMinimizeDrag then --print('readjusting bottom clip') - DefaultBottomClipPos = -1 + (#MiddleFrameBackgrounds * MiddleBGTemplate.Size.Y.Scale) + DefaultBottomClipPos = -1 + + (#MiddleFrameBackgrounds * MiddleBGTemplate.Size.Y.Scale) end if not IsMinimized.Value then @@ -2160,7 +2429,17 @@ end ------------------------------- -- Player Callback functions ------------------------------- -local FONT_SIZES = { "Size8", "Size9", "Size10", "Size11", "Size12", "Size14", "Size24", "Size36", "Size48" } +local FONT_SIZES = { + "Size8", + "Size9", + "Size10", + "Size11", + "Size12", + "Size14", + "Size24", + "Size36", + "Size48", +} --[[ note:should probably set to something other than mainFrame.AbsoluteSize, should work for now if textbounds ever works on textscaled, switch to that :( @@ -2239,7 +2518,13 @@ function ClosePopUpPanel() TweenProperty(tframe, "BackgroundTransparency", 0.5, 1, BASE_TWEEN) end) end - PopUpPanel:TweenPosition(UDim2.new(1, 0, 0, 0), "Out", "Linear", BASE_TWEEN, true) + PopUpPanel:TweenPosition( + UDim2.new(1, 0, 0, 0), + "Out", + "Linear", + BASE_TWEEN, + true + ) wait(0.1) InPopupWaitForClick = false SelectedPlayerEntry = nil @@ -2263,7 +2548,8 @@ function InitMovingPanel(entry, player) debugprint(tostring(friendStatus)) local showRankMenu = IsPersonalServer and LocalPlayer.PersonalServerRank >= PrivilegeLevel["Admin"] - and LocalPlayer.PersonalServerRank > SelectedPlayer.PersonalServerRank + and LocalPlayer.PersonalServerRank + > SelectedPlayer.PersonalServerRank local ReportPlayerButton = MakePopupButton(PopUpPanel, "Report Player", 0) ReportPlayerButton.MouseButton1Click:connect(function() @@ -2273,28 +2559,36 @@ function InitMovingPanel(entry, player) PopUpPanel, "Friend", 1, - not showRankMenu and friendStatus ~= Enum.FriendStatus.FriendRequestReceived + not showRankMenu + and friendStatus ~= Enum.FriendStatus.FriendRequestReceived ) FriendPlayerButton.MouseButton1Click:connect(OnFriendButtonSelect) if friendStatus == Enum.FriendStatus.Friend then FriendPlayerButton:FindFirstChild("ButtonText").Text = "UnFriend Player" - elseif friendStatus == Enum.FriendStatus.Unknown or friendStatus == Enum.FriendStatus.NotFriend then + elseif + friendStatus == Enum.FriendStatus.Unknown + or friendStatus == Enum.FriendStatus.NotFriend + then FriendPlayerButton:FindFirstChild("ButtonText").Text = "Send Request" elseif friendStatus == Enum.FriendStatus.FriendRequestSent then FriendPlayerButton:FindFirstChild("ButtonText").Text = "Revoke Request" elseif friendStatus == Enum.FriendStatus.FriendRequestReceived then FriendPlayerButton:FindFirstChild("ButtonText").Text = "Accept Friend" - local FriendRefuseButton = MakePopupButton(PopUpPanel, "Decline Friend", 2, not showRankMenu) + local FriendRefuseButton = + MakePopupButton(PopUpPanel, "Decline Friend", 2, not showRankMenu) FriendRefuseButton.MouseButton1Click:connect(OnFriendRefuseButtonSelect) nextIndex = nextIndex + 1 end if showRankMenu then local BanPlayerButton = MakePopupButton(PopUpPanel, "Ban", nextIndex) - local VisitorButton = MakePopupButton(PopUpPanel, "Visitor", nextIndex + 1) - local MemberButton = MakePopupButton(PopUpPanel, "Member", nextIndex + 2) - local AdminButton = MakePopupButton(PopUpPanel, "Admin", nextIndex + 3, true) + local VisitorButton = + MakePopupButton(PopUpPanel, "Visitor", nextIndex + 1) + local MemberButton = + MakePopupButton(PopUpPanel, "Member", nextIndex + 2) + local AdminButton = + MakePopupButton(PopUpPanel, "Admin", nextIndex + 3, true) BanPlayerButton.MouseButton1Click:connect(function() OnPrivilegeLevelSelect( @@ -2337,10 +2631,22 @@ function InitMovingPanel(entry, player) ) end) - HighlightMyRank(SelectedPlayer, BanPlayerButton, VisitorButton, MemberButton, AdminButton) + HighlightMyRank( + SelectedPlayer, + BanPlayerButton, + VisitorButton, + MemberButton, + AdminButton + ) end - PopUpPanel:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Linear", BASE_TWEEN, true) + PopUpPanel:TweenPosition( + UDim2.new(0, 0, 0, 0), + "Out", + "Linear", + BASE_TWEEN, + true + ) Delay(0, function() local tconnection tconnection = Mouse.Button1Down:connect(function() @@ -2355,8 +2661,12 @@ function InitMovingPanel(entry, player) -- sometimes garbage is the only option. Spawn(function() while InPopupWaitForClick do - PopUpClipFrame.Position = - UDim2.new(0, myFrame.AbsolutePosition.X - PopUpClipFrame.Size.X.Offset, 0, myFrame.AbsolutePosition.Y) + PopUpClipFrame.Position = UDim2.new( + 0, + myFrame.AbsolutePosition.X - PopUpClipFrame.Size.X.Offset, + 0, + myFrame.AbsolutePosition.Y + ) wait() end end) @@ -2416,23 +2726,30 @@ function InsertPlayerFrame(nplayer) AddingFrameLock = true local nFrame = MiddleTemplate:Clone() - WaitForChild(WaitForChild(nFrame, "TitleFrame"), "Title").Text = nplayer.Name + WaitForChild(WaitForChild(nFrame, "TitleFrame"), "Title").Text = + nplayer.Name nFrame.Position = UDim2.new(1, 0, (#MiddleFrames * nFrame.Size.Y.Scale), 0) local nfriendstatus = GetFriendStatus(nplayer) - nFrame:FindFirstChild("BCLabel").Image = getMembershipTypeIcon(nplayer.MembershipType, nplayer.Name) - nFrame:FindFirstChild("FriendLabel").Image = getFriendStatusIcon(nfriendstatus) + nFrame:FindFirstChild("BCLabel").Image = + getMembershipTypeIcon(nplayer.MembershipType, nplayer.Name) + nFrame:FindFirstChild("FriendLabel").Image = + getFriendStatusIcon(nfriendstatus) nFrame.Name = nplayer.Name - WaitForChild(WaitForChild(nFrame, "TitleFrame"), "Title").Text = nplayer.Name + WaitForChild(WaitForChild(nFrame, "TitleFrame"), "Title").Text = + nplayer.Name --move for bc label - nFrame.FriendLabel.Position = nFrame.FriendLabel.Position + UDim2.new(0, 17, 0, 0) - nFrame.TitleFrame.Title.Position = nFrame.TitleFrame.Title.Position + UDim2.new(0, 17, 0, 0) + nFrame.FriendLabel.Position = nFrame.FriendLabel.Position + + UDim2.new(0, 17, 0, 0) + nFrame.TitleFrame.Title.Position = nFrame.TitleFrame.Title.Position + + UDim2.new(0, 17, 0, 0) if nFrame:FindFirstChild("FriendLabel").Image ~= "" then - nFrame.TitleFrame.Title.Position = nFrame.TitleFrame.Title.Position + UDim2.new(0, 17, 0, 0) + nFrame.TitleFrame.Title.Position = nFrame.TitleFrame.Title.Position + + UDim2.new(0, 17, 0, 0) end if nplayer.Name == LocalPlayer.Name then @@ -2443,7 +2760,8 @@ function InsertPlayerFrame(nplayer) dropShadow.TextColor3 = Color3.new(0, 0, 0) dropShadow.TextTransparency = 0 dropShadow.ZIndex = 2 - dropShadow.Position = nFrame.TitleFrame.Title.Position + UDim2.new(0, 1, 0, 1) + dropShadow.Position = nFrame.TitleFrame.Title.Position + + UDim2.new(0, 1, 0, 1) dropShadow.Name = "DropShadow" dropShadow.Parent = nFrame.TitleFrame -- else @@ -2452,7 +2770,13 @@ function InsertPlayerFrame(nplayer) nFrame.TitleFrame.Title.Font = "ArialBold" nFrame.Parent = ListFrame - nFrame:TweenPosition(UDim2.new(0.5, 0, (#MiddleFrames * nFrame.Size.Y.Scale), 0), "Out", "Linear", BASE_TWEEN, true) + nFrame:TweenPosition( + UDim2.new(0.5, 0, (#MiddleFrames * nFrame.Size.Y.Scale), 0), + "Out", + "Linear", + BASE_TWEEN, + true + ) UpdateMinimize() local nentry = {} nentry["Frame"] = nFrame @@ -2649,9 +2973,11 @@ function AddTeamScores(team) local i = ScoreNames[j] local tscore = 0 for _, j in ipairs(team["MyPlayers"]) do - local tval = j["Player"]:FindFirstChild "leaderstats" and j["Player"].leaderstats:FindFirstChild(i["Name"]) + local tval = j["Player"]:FindFirstChild "leaderstats" + and j["Player"].leaderstats:FindFirstChild(i["Name"]) if tval and not tval:IsA "StringValue" then - tscore = tscore + GetScoreValue((j["Player"].leaderstats)[i["Name"]]) + tscore = tscore + + GetScoreValue((j["Player"].leaderstats)[i["Name"]]) end end if team["Frame"]:FindFirstChild(i["Name"]) then @@ -2770,17 +3096,24 @@ function PlayerChanged(entry, property) SetPlayerToTeam(entry) end BaseUpdate() - elseif property == "TeamColor" and not entry["Player"].Neutral and entry["Player"] ~= entry["MyTeam"] then + elseif + property == "TeamColor" + and not entry["Player"].Neutral + and entry["Player"] ~= entry["MyTeam"] + then debugprint(entry["Player"].Name .. "setting to new team") SetPlayerToTeam(entry) BaseUpdate() elseif property == "Name" or property == "MembershipType" then - entry["Frame"]:FindFirstChild("BCLabel").Image = - getMembershipTypeIcon(entry["Player"].MembershipType, entry["Player"].Name) + entry["Frame"]:FindFirstChild("BCLabel").Image = getMembershipTypeIcon( + entry["Player"].MembershipType, + entry["Player"].Name + ) entry["Frame"].Name = entry["Player"].Name entry["Frame"].TitleFrame.Title.Text = entry["Player"].Name if entry["Frame"].BCLabel.Image ~= "" then - entry["Frame"].TitleFrame.Title.Position = UDim2.new(0.01, 30, 0.1, 0) + entry["Frame"].TitleFrame.Title.Position = + UDim2.new(0.01, 30, 0.1, 0) end if entry["Player"] == LocalPlayer then entry["Frame"].TitleFrame.DropShadow.Text = entry["Player"].Name @@ -2807,7 +3140,9 @@ function OnFriendshipChanged(player, friendStatus) if nicon == "" and entry["Frame"].FriendLabel.Image ~= "" then entry["Frame"].TitleFrame.Title.Position = entry["Frame"].TitleFrame.Title.Position - UDim2.new(0, 17, 0, 0) - elseif nicon ~= "" and entry["Frame"].FriendLabel.Image == "" then + elseif + nicon ~= "" and entry["Frame"].FriendLabel.Image == "" + then entry["Frame"].TitleFrame.Title.Position = entry["Frame"].TitleFrame.Title.Position + UDim2.new(0, 17, 0, 0) debugprint("confirmed status:" .. player.Name) @@ -2839,16 +3174,28 @@ function AddNeutralTeam() nentry["MyTeam"] = defaultTeam nentry["MyPlayers"] = {} nentry["Frame"] = MiddleTemplate:Clone() - WaitForChild(WaitForChild(nentry["Frame"], "TitleFrame"), "Title").Text = defaultTeam.Name - nentry["Frame"].TitleFrame.Position = - UDim2.new(nentry["Frame"].TitleFrame.Position.X.Scale, nentry["Frame"].TitleFrame.Position.X.Offset, 0.1, 0) - nentry["Frame"].TitleFrame.Size = - UDim2.new(nentry["Frame"].TitleFrame.Size.X.Scale, nentry["Frame"].TitleFrame.Size.X.Offset, 0.8, 0) + WaitForChild(WaitForChild(nentry["Frame"], "TitleFrame"), "Title").Text = + defaultTeam.Name + nentry["Frame"].TitleFrame.Position = UDim2.new( + nentry["Frame"].TitleFrame.Position.X.Scale, + nentry["Frame"].TitleFrame.Position.X.Offset, + 0.1, + 0 + ) + nentry["Frame"].TitleFrame.Size = UDim2.new( + nentry["Frame"].TitleFrame.Size.X.Scale, + nentry["Frame"].TitleFrame.Size.X.Offset, + 0.8, + 0 + ) nentry["Frame"].TitleFrame.Title.Font = "ArialBold" - nentry["Frame"].Position = UDim2.new(1, 0, (#MiddleFrames * nentry["Frame"].Size.Y.Scale), 0) - WaitForChild(nentry["Frame"], "ClickListener").MouseButton1Down:connect(function(nx, ny) - StartDrag(nentry, nx, ny) - end) + nentry["Frame"].Position = + UDim2.new(1, 0, (#MiddleFrames * nentry["Frame"].Size.Y.Scale), 0) + WaitForChild(nentry["Frame"], "ClickListener").MouseButton1Down:connect( + function(nx, ny) + StartDrag(nentry, nx, ny) + end + ) nentry["Frame"].ClickListener.BackgroundColor3 = Color3.new(1, 1, 1) nentry["Frame"].ClickListener.BackgroundTransparency = 0.7 nentry["Frame"].ClickListener.AutoButtonColor = false @@ -2894,7 +3241,8 @@ function TeamChildAdded(entry, nchild) if nchild.Name == "AutoHide" then entry["AutoHide"] = true elseif nchild.Name == "TeamScore" then - WaitForChild(entry["Frame"], "PlayerScore").Text = tostring(nchild.Value) + WaitForChild(entry["Frame"], "PlayerScore").Text = + tostring(nchild.Value) entry["TeamScore"] = nchild.Value nchild.Changed:connect(function() TeamScoreChanged(entry, nchild.Value) @@ -2916,9 +3264,11 @@ end function TeamChanged(entry, property) if property == "Name" then - WaitForChild(WaitForChild(entry["Frame"], "TitleFrame"), "Title").Text = entry["MyTeam"].Name + WaitForChild(WaitForChild(entry["Frame"], "TitleFrame"), "Title").Text = + entry["MyTeam"].Name elseif property == "TeamColor" then - entry["Frame"].ClickListener.BackgroundColor3 = entry["MyTeam"].TeamColor.Color + entry["Frame"].ClickListener.BackgroundColor3 = + entry["MyTeam"].TeamColor.Color for _, i in pairs(TeamFrames) do if i["MyTeam"].TeamColor == entry["MyTeam"] then @@ -2953,17 +3303,29 @@ function InsertTeamFrame(nteam) nentry["MyTeam"] = nteam nentry["MyPlayers"] = {} nentry["Frame"] = MiddleTemplate:Clone() - WaitForChild(WaitForChild(nentry["Frame"], "TitleFrame"), "Title").Text = nteam.Name + WaitForChild(WaitForChild(nentry["Frame"], "TitleFrame"), "Title").Text = + nteam.Name nentry["Frame"].TitleFrame.Title.Font = "ArialBold" nentry["Frame"].TitleFrame.Title.FontSize = "Size18" - nentry["Frame"].TitleFrame.Position = - UDim2.new(nentry["Frame"].TitleFrame.Position.X.Scale, nentry["Frame"].TitleFrame.Position.X.Offset, 0.1, 0) - nentry["Frame"].TitleFrame.Size = - UDim2.new(nentry["Frame"].TitleFrame.Size.X.Scale, nentry["Frame"].TitleFrame.Size.X.Offset, 0.8, 0) - nentry["Frame"].Position = UDim2.new(1, 0, (#MiddleFrames * nentry["Frame"].Size.Y.Scale), 0) - WaitForChild(nentry["Frame"], "ClickListener").MouseButton1Down:connect(function(nx, ny) - StartDrag(nentry, nx, ny) - end) + nentry["Frame"].TitleFrame.Position = UDim2.new( + nentry["Frame"].TitleFrame.Position.X.Scale, + nentry["Frame"].TitleFrame.Position.X.Offset, + 0.1, + 0 + ) + nentry["Frame"].TitleFrame.Size = UDim2.new( + nentry["Frame"].TitleFrame.Size.X.Scale, + nentry["Frame"].TitleFrame.Size.X.Offset, + 0.8, + 0 + ) + nentry["Frame"].Position = + UDim2.new(1, 0, (#MiddleFrames * nentry["Frame"].Size.Y.Scale), 0) + WaitForChild(nentry["Frame"], "ClickListener").MouseButton1Down:connect( + function(nx, ny) + StartDrag(nentry, nx, ny) + end + ) nentry["Frame"].ClickListener.BackgroundColor3 = nteam.TeamColor.Color nentry["Frame"].ClickListener.BackgroundTransparency = 0.7 nentry["Frame"].ClickListener.AutoButtonColor = false @@ -2988,7 +3350,10 @@ function InsertTeamFrame(nteam) end) for _, i in pairs(PlayerFrames) do - if not i["Player"].Neutral and i["Player"].TeamColor == nteam.TeamColor then + if + not i["Player"].Neutral + and i["Player"].TeamColor == nteam.TeamColor + then AddPlayerToTeam(nentry, i) end end @@ -3119,11 +3484,22 @@ game.GuiService.KeyPressed:connect(function(key) LastTabTime = time() if IsTabified.Value then if not IsMaximized.Value then - ScreenGui:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Linear", BASE_TWEEN * 1.2, true) + ScreenGui:TweenPosition( + UDim2.new(0, 0, 0, 0), + "Out", + "Linear", + BASE_TWEEN * 1.2, + true + ) IsMaximized.Value = true else ScreenGui:TweenPosition( - UDim2.new(NormalBounds.X.Scale, NormalBounds.X.Offset - 10, 0, 0), + UDim2.new( + NormalBounds.X.Scale, + NormalBounds.X.Offset - 10, + 0, + 0 + ), "Out", "Linear", BASE_TWEEN * 1.2, @@ -3151,7 +3527,10 @@ function PlayersChildAdded(tplayer) end function coreGuiChanged(coreGuiType, enabled) - if coreGuiType == Enum.CoreGuiType.All or coreGuiType == Enum.CoreGuiType.PlayerList then + if + coreGuiType == Enum.CoreGuiType.All + or coreGuiType == Enum.CoreGuiType.PlayerList + then MainFrame.Visible = enabled end end @@ -3180,7 +3559,10 @@ function debugPlayerAdd(p) end pcall(function() - coreGuiChanged(Enum.CoreGuiType.PlayerList, Game.StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.PlayerList)) + coreGuiChanged( + Enum.CoreGuiType.PlayerList, + Game.StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.PlayerList) + ) Game.StarterGui.CoreGuiChangedSignal:connect(coreGuiChanged) end) @@ -3214,7 +3596,10 @@ IsPersonalServer = not not game.Workspace:FindFirstChild "PSVariable" ---------------------------- --debug stuffs, will only run for 'newplayerlistisbad' -if LocalPlayer.Name == "newplayerlistisbad" or LocalPlayer.Name == "imtotallyadmin" then +if + LocalPlayer.Name == "newplayerlistisbad" + or LocalPlayer.Name == "imtotallyadmin" +then debugFrame.Parent = ScreenGui Spawn(function() while true do diff --git a/lua/48488398.lua b/lua/48488398.lua index bb9e594..9374322 100644 --- a/lua/48488398.lua +++ b/lua/48488398.lua @@ -1,3 +1,4 @@ +print "[Mercury]: Loaded corescript 48488398" function waitForProperty(instance, property) while not instance[property] do instance.Changed:wait() @@ -15,7 +16,7 @@ waitForChild(script.Parent.Popup, "AcceptButton") script.Parent.Popup.AcceptButton.Modal = true local localPlayer = game.Players.LocalPlayer -local teleportUI = nil +local teleportUI local friendRequestBlacklist = {} @@ -39,8 +40,10 @@ function makeFriend(fromPlayer, toPlayer) return end -- previously cancelled friend request, we don't want it! - popup.PopupText.Text = "Accept Friend Request from " .. tostring(fromPlayer.Name) .. "?" - popup.PopupImage.Image = "http://www.roblox.com/thumbs/avatar.ashx?userId=" + popup.PopupText.Text = "Accept Friend Request from " + .. tostring(fromPlayer.Name) + .. "?" + popup.PopupImage.Image = "http://banland.xyz/thumbs/avatar.ashx?userId=" .. tostring(fromPlayer.userId) .. "&x=352&y=352" @@ -48,7 +51,13 @@ function makeFriend(fromPlayer, toPlayer) popup.Visible = true popup.AcceptButton.Text = "Accept" popup.DeclineButton.Text = "Decline" - popup:TweenSize(UDim2.new(0, 330, 0, 350), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true) + popup:TweenSize( + UDim2.new(0, 330, 0, 350), + Enum.EasingDirection.Out, + Enum.EasingStyle.Quart, + 1, + true + ) local yesCon, noCon @@ -104,7 +113,9 @@ game.Players.FriendRequestEvent:connect(function(fromPlayer, toPlayer, event) game:GetService("GuiService"):SendNotification( "You are Friends", "With " .. toPlayer.Name .. "!", - "http://www.roblox.com/thumbs/avatar.ashx?userId=" .. tostring(toPlayer.userId) .. "&x=48&y=48", + "http://banland.xyz/thumbs/avatar.ashx?userId=" + .. tostring(toPlayer.userId) + .. "&x=48&y=48", 5, function() end ) @@ -117,7 +128,9 @@ game.Players.FriendRequestEvent:connect(function(fromPlayer, toPlayer, event) game:GetService("GuiService"):SendNotification( "Friend Request", "From " .. fromPlayer.Name, - "http://www.roblox.com/thumbs/avatar.ashx?userId=" .. tostring(fromPlayer.userId) .. "&x=48&y=48", + "http://banland.xyz/thumbs/avatar.ashx?userId=" + .. tostring(fromPlayer.userId) + .. "&x=48&y=48", 8, function() makeFriend(fromPlayer, toPlayer) @@ -127,7 +140,9 @@ game.Players.FriendRequestEvent:connect(function(fromPlayer, toPlayer, event) game:GetService("GuiService"):SendNotification( "You are Friends", "With " .. fromPlayer.Name .. "!", - "http://www.roblox.com/thumbs/avatar.ashx?userId=" .. tostring(fromPlayer.userId) .. "&x=48&y=48", + "http://banland.xyz/thumbs/avatar.ashx?userId=" + .. tostring(fromPlayer.userId) + .. "&x=48&y=48", 5, function() end ) @@ -176,7 +191,10 @@ function onTeleport(teleportState, _, _) elseif teleportState == Enum.TeleportState.InProgress then showTeleportUI("Teleporting...", 0) elseif teleportState == Enum.TeleportState.Failed then - showTeleportUI("Teleport failed. Insufficient privileges or target place does not exist.", 3) + showTeleportUI( + "Teleport failed. Insufficient privileges or target place does not exist.", + 3 + ) end end end @@ -194,7 +212,9 @@ if teleportEnabled then if clickCon then clickCon:disconnect() end - game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild "Popup") + game.GuiService:RemoveCenterDialog( + script.Parent:FindFirstChild "Popup" + ) popup:TweenSize( UDim2.new(0, 0, 0, 0), Enum.EasingDirection.Out, @@ -211,7 +231,13 @@ if teleportEnabled then function() showOneButton() script.Parent:FindFirstChild("Popup").Visible = true - popup:TweenSize(UDim2.new(0, 330, 0, 350), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true) + popup:TweenSize( + UDim2.new(0, 330, 0, 350), + Enum.EasingDirection.Out, + Enum.EasingStyle.Quart, + 1, + true + ) end, --HideFunction function() @@ -226,7 +252,11 @@ if teleportEnabled then end ) end - game:GetService("TeleportService").ConfirmationCallback = function(message, placeId, spawnName) + game:GetService("TeleportService").ConfirmationCallback = function( + message, + placeId, + spawnName + ) local popup = script.Parent:FindFirstChild "Popup" popup.PopupText.Text = message popup.PopupImage.Image = "" @@ -240,7 +270,9 @@ if teleportEnabled then if noCon then noCon:disconnect() end - game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild "Popup") + game.GuiService:RemoveCenterDialog( + script.Parent:FindFirstChild "Popup" + ) popup:TweenSize( UDim2.new(0, 0, 0, 0), Enum.EasingDirection.Out, @@ -254,7 +286,8 @@ if teleportEnabled then yesCon = popup.AcceptButton.MouseButton1Click:connect(function() killCons() local success, err = pcall(function() - game:GetService("TeleportService"):TeleportImpl(placeId, spawnName) + game:GetService("TeleportService") + :TeleportImpl(placeId, spawnName) end) if not success then showOneButton() @@ -264,7 +297,9 @@ if teleportEnabled then if clickCon then clickCon:disconnect() end - game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild "Popup") + game.GuiService:RemoveCenterDialog( + script.Parent:FindFirstChild "Popup" + ) popup:TweenSize( UDim2.new(0, 0, 0, 0), Enum.EasingDirection.Out, @@ -347,7 +382,13 @@ if teleportEnabled then script.Parent:FindFirstChild("Popup").Visible = true popup.AcceptButton.Text = "Leave" popup.DeclineButton.Text = "Stay" - popup:TweenSize(UDim2.new(0, 330, 0, 350), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true) + popup:TweenSize( + UDim2.new(0, 330, 0, 350), + Enum.EasingDirection.Out, + Enum.EasingStyle.Quart, + 1, + true + ) end return true end diff --git a/lua/48488451.lua b/lua/48488451.lua index f93b7c3..76f8558 100644 --- a/lua/48488451.lua +++ b/lua/48488451.lua @@ -1,3 +1,4 @@ +print "[Mercury]: Loaded corescript 48488451" --build our gui local popupFrame = Instance.new "Frame" @@ -52,7 +53,7 @@ popupImage.Parent = popupFrame local backing = Instance.new "ImageLabel" backing.BackgroundTransparency = 1 backing.Size = UDim2.new(1, 0, 1, 0) -backing.Image = "http://www.roblox.com/asset/?id=47574181" +backing.Image = "http://banland.xyz/asset/?id=47574181" backing.Name = "Backing" backing.ZIndex = 2 backing.Parent = popupImage diff --git a/lua/53878047.lua b/lua/53878047.lua index eb5b87d..e9a6f25 100644 --- a/lua/53878047.lua +++ b/lua/53878047.lua @@ -1,3 +1,4 @@ +print "[Mercury]: Loaded corescript 53878047" -- This script creates almost all gui elements found in the backpack (warning: there are a lot!) -- TODO: automate this process @@ -49,7 +50,7 @@ CurrentLoadout.Parent = gui local CLBackground = Instance.new "ImageLabel" CLBackground.Name = "Background" CLBackground.Size = UDim2.new(1.2, 0, 1.2, 0) -CLBackground.Image = "http://www.roblox.com/asset/?id=96536002" +CLBackground.Image = "http://banland.xyz/asset/?id=96536002" CLBackground.BackgroundTransparency = 1 CLBackground.Position = UDim2.new(-0.1, 0, -0.1, 0) CLBackground.ZIndex = 0.0 @@ -59,7 +60,7 @@ CLBackground.Visible = false local BackgroundUp = Instance.new "ImageLabel" BackgroundUp.Size = UDim2.new(1, 0, 0.025, 1) BackgroundUp.Position = UDim2.new(0, 0, 0, 0) -BackgroundUp.Image = "http://www.roblox.com/asset/?id=97662207" +BackgroundUp.Image = "http://banland.xyz/asset/?id=97662207" BackgroundUp.BackgroundTransparency = 1 BackgroundUp.Parent = CLBackground @@ -73,7 +74,7 @@ BackpackButton.RobloxLocked = true BackpackButton.Visible = false BackpackButton.Name = "BackpackButton" BackpackButton.BackgroundTransparency = 1 -BackpackButton.Image = "http://www.roblox.com/asset/?id=97617958" +BackpackButton.Image = "http://banland.xyz/asset/?id=97617958" BackpackButton.Position = UDim2.new(0.5, -60, 1, -108) BackpackButton.Size = UDim2.new(0, 120, 0, 18) waitForChild(gui, "ControlFrame") @@ -106,7 +107,12 @@ for i = 0, NumSlots do if gui.AbsoluteSize.Y <= 320 then slotFrame.Position = UDim2.new(0, (i - 1) * 60, 0, -50) - print("Well got here", slotFrame, slotFrame.Position.X.Scale, slotFrame.Position.X.Offset) + print( + "Well got here", + slotFrame, + slotFrame.Position.X.Scale, + slotFrame.Position.X.Offset + ) end if gui.AbsoluteSize.Y <= 320 and i == 0 then slotFrame:Destroy() @@ -127,14 +133,14 @@ TempSlot.ZIndex = 3.0 local slotBackground = Instance.new "ImageLabel" slotBackground.Name = "Background" slotBackground.BackgroundTransparency = 1 -slotBackground.Image = "http://www.roblox.com/asset/?id=97613075" +slotBackground.Image = "http://banland.xyz/asset/?id=97613075" slotBackground.Size = UDim2.new(1, 0, 1, 0) slotBackground.Parent = TempSlot local HighLight = Instance.new "ImageLabel" HighLight.Name = "Highlight" HighLight.BackgroundTransparency = 1 -HighLight.Image = "http://www.roblox.com/asset/?id=97643886" +HighLight.Image = "http://banland.xyz/asset/?id=97643886" HighLight.Size = UDim2.new(1, 0, 1, 0) --HighLight.Parent = TempSlot HighLight.Visible = false @@ -328,8 +334,9 @@ closeButton.Modal = true local XImage = Instance.new "ImageLabel" XImage.RobloxLocked = true XImage.Name = "XImage" -game:GetService("ContentProvider"):Preload "http://www.roblox.com/asset/?id=75547445" -XImage.Image = "http://www.roblox.com/asset/?id=75547445" --TODO: move to rbxasset +game:GetService("ContentProvider") + :Preload "http://banland.xyz/asset/?id=75547445" +XImage.Image = "http://banland.xyz/asset/?id=75547445" --TODO: move to rbxasset XImage.BackgroundTransparency = 1 XImage.Position = UDim2.new(-0.25, -1, -0.25, -1) XImage.Size = UDim2.new(1.5, 2, 1.5, 2) @@ -431,7 +438,7 @@ GearButton.Parent = GearGrid local slotBackground = Instance.new "ImageLabel" slotBackground.Name = "Background" slotBackground.BackgroundTransparency = 1 -slotBackground.Image = "http://www.roblox.com/asset/?id=97613075" +slotBackground.Image = "http://banland.xyz/asset/?id=97613075" slotBackground.Size = UDim2.new(1, 0, 1, 0) slotBackground.Parent = GearButton @@ -760,31 +767,43 @@ CharacterPane.Parent = Wardrobe --CharacterPane Children local FaceFrame = makeCharFrame("FacesFrame", CharacterPane) -game:GetService("ContentProvider"):Preload "http://www.roblox.com/asset/?id=75460621" +game:GetService("ContentProvider") + :Preload "http://banland.xyz/asset/?id=75460621" makeZone( "FaceZone", - "http://www.roblox.com/asset/?id=75460621", + "http://banland.xyz/asset/?id=75460621", UDim2.new(0, 157, 0, 137), UDim2.new(0.5, -78, 0.5, -68), FaceFrame ) -makeStyledButton("Face", UDim2.new(0, 64, 0, 64), UDim2.new(0.5, -32, 0.5, -135), FaceFrame) +makeStyledButton( + "Face", + UDim2.new(0, 64, 0, 64), + UDim2.new(0.5, -32, 0.5, -135), + FaceFrame +) local HeadFrame = makeCharFrame("HeadsFrame", CharacterPane) makeZone( "FaceZone", - "http://www.roblox.com/asset/?id=75460621", + "http://banland.xyz/asset/?id=75460621", UDim2.new(0, 157, 0, 137), UDim2.new(0.5, -78, 0.5, -68), HeadFrame ) -makeStyledButton("Head", UDim2.new(0, 64, 0, 64), UDim2.new(0.5, -32, 0.5, -135), HeadFrame) +makeStyledButton( + "Head", + UDim2.new(0, 64, 0, 64), + UDim2.new(0.5, -32, 0.5, -135), + HeadFrame +) local HatsFrame = makeCharFrame("HatsFrame", CharacterPane) -game:GetService("ContentProvider"):Preload "http://www.roblox.com/asset/?id=75457888" +game:GetService("ContentProvider") + :Preload "http://banland.xyz/asset/?id=75457888" local HatsZone = makeZone( "HatsZone", - "http://www.roblox.com/asset/?id=75457888", + "http://banland.xyz/asset/?id=75457888", UDim2.new(0, 186, 0, 184), UDim2.new(0.5, -93, 0.5, -100), HatsFrame @@ -812,10 +831,11 @@ makeStyledButton( ) local PantsFrame = makeCharFrame("PantsFrame", CharacterPane) -game:GetService("ContentProvider"):Preload "http://www.roblox.com/asset/?id=75457920" +game:GetService("ContentProvider") + :Preload "http://banland.xyz/asset/?id=75457920" makeZone( "PantsZone", - "http://www.roblox.com/asset/?id=75457920", + "http://banland.xyz/asset/?id=75457920", UDim2.new(0, 121, 0, 99), UDim2.new(0.5, -60, 0.5, -100), PantsFrame @@ -860,7 +880,12 @@ local leftLegButton = makeStyledButton( MeshFrame, Enum.ButtonStyle.RobloxButton ) -makeTextLabel("LeftLegLabel", "Left Leg", UDim2.new(0.5, -16, 0, -25), leftLegButton) +makeTextLabel( + "LeftLegLabel", + "Left Leg", + UDim2.new(0.5, -16, 0, -25), + leftLegButton +) local rightLegButton = makeStyledButton( "RightLegMeshButton", UDim2.new(0, 64, 0, 64), @@ -868,7 +893,12 @@ local rightLegButton = makeStyledButton( MeshFrame, Enum.ButtonStyle.RobloxButton ) -makeTextLabel("RightLegLabel", "Right Leg", UDim2.new(0.5, -16, 0, -25), rightLegButton) +makeTextLabel( + "RightLegLabel", + "Right Leg", + UDim2.new(0.5, -16, 0, -25), + rightLegButton +) local rightArmButton = makeStyledButton( "RightArmMeshButton", UDim2.new(0, 64, 0, 64), @@ -876,7 +906,12 @@ local rightArmButton = makeStyledButton( MeshFrame, Enum.ButtonStyle.RobloxButton ) -makeTextLabel("RightArmLabel", "Right Arm", UDim2.new(0.5, -16, 0, -25), rightArmButton) +makeTextLabel( + "RightArmLabel", + "Right Arm", + UDim2.new(0.5, -16, 0, -25), + rightArmButton +) local leftArmButton = makeStyledButton( "LeftArmMeshButton", UDim2.new(0, 64, 0, 64), @@ -884,46 +919,96 @@ local leftArmButton = makeStyledButton( MeshFrame, Enum.ButtonStyle.RobloxButton ) -makeTextLabel("LeftArmLabel", "Left Arm", UDim2.new(0.5, -16, 0, -25), leftArmButton) +makeTextLabel( + "LeftArmLabel", + "Left Arm", + UDim2.new(0.5, -16, 0, -25), + leftArmButton +) local TShirtFrame = makeCharFrame("T-ShirtsFrame", CharacterPane) -game:GetService("ContentProvider"):Preload "http://www.roblox.com/asset/?id=75460642" +game:GetService("ContentProvider") + :Preload "http://banland.xyz/asset/?id=75460642" makeZone( "TShirtZone", - "http://www.roblox.com/asset/?id=75460642", + "http://banland.xyz/asset/?id=75460642", UDim2.new(0, 121, 0, 154), UDim2.new(0.5, -60, 0.5, -100), TShirtFrame ) -makeStyledButton("TShirtButton", UDim2.new(0, 64, 0, 64), UDim2.new(0.5, -32, 0.5, -64), TShirtFrame) +makeStyledButton( + "TShirtButton", + UDim2.new(0, 64, 0, 64), + UDim2.new(0.5, -32, 0.5, -64), + TShirtFrame +) local ShirtFrame = makeCharFrame("ShirtsFrame", CharacterPane) makeZone( "ShirtZone", - "http://www.roblox.com/asset/?id=75460642", + "http://banland.xyz/asset/?id=75460642", UDim2.new(0, 121, 0, 154), UDim2.new(0.5, -60, 0.5, -100), ShirtFrame ) -makeStyledButton("ShirtButton", UDim2.new(0, 64, 0, 64), UDim2.new(0.5, -32, 0.5, -64), ShirtFrame) +makeStyledButton( + "ShirtButton", + UDim2.new(0, 64, 0, 64), + UDim2.new(0.5, -32, 0.5, -64), + ShirtFrame +) local ColorFrame = makeCharFrame("ColorFrame", CharacterPane) -game:GetService("ContentProvider"):Preload "http://www.roblox.com/asset/?id=76049888" +game:GetService("ContentProvider") + :Preload "http://banland.xyz/asset/?id=76049888" local ColorZone = makeZone( "ColorZone", - "http://www.roblox.com/asset/?id=76049888", + "http://banland.xyz/asset/?id=76049888", UDim2.new(0, 120, 0, 150), UDim2.new(0.5, -60, 0.5, -100), ColorFrame ) -makeStyledButton("Head", UDim2.new(0.26, 0, 0.19, 0), UDim2.new(0.37, 0, 0.02, 0), ColorZone).AutoButtonColor = false -makeStyledButton("LeftArm", UDim2.new(0.19, 0, 0.36, 0), UDim2.new(0.78, 0, 0.26, 0), ColorZone).AutoButtonColor = false -makeStyledButton("RightArm", UDim2.new(0.19, 0, 0.36, 0), UDim2.new(0.025, 0, 0.26, 0), ColorZone).AutoButtonColor = +makeStyledButton( + "Head", + UDim2.new(0.26, 0, 0.19, 0), + UDim2.new(0.37, 0, 0.02, 0), + ColorZone +).AutoButtonColor = false -makeStyledButton("Torso", UDim2.new(0.43, 0, 0.36, 0), UDim2.new(0.28, 0, 0.26, 0), ColorZone).AutoButtonColor = false -makeStyledButton("RightLeg", UDim2.new(0.19, 0, 0.31, 0), UDim2.new(0.275, 0, 0.67, 0), ColorZone).AutoButtonColor = +makeStyledButton( + "LeftArm", + UDim2.new(0.19, 0, 0.36, 0), + UDim2.new(0.78, 0, 0.26, 0), + ColorZone +).AutoButtonColor = false -makeStyledButton("LeftLeg", UDim2.new(0.19, 0, 0.31, 0), UDim2.new(0.525, 0, 0.67, 0), ColorZone).AutoButtonColor = +makeStyledButton( + "RightArm", + UDim2.new(0.19, 0, 0.36, 0), + UDim2.new(0.025, 0, 0.26, 0), + ColorZone +).AutoButtonColor = + false +makeStyledButton( + "Torso", + UDim2.new(0.43, 0, 0.36, 0), + UDim2.new(0.28, 0, 0.26, 0), + ColorZone +).AutoButtonColor = + false +makeStyledButton( + "RightLeg", + UDim2.new(0.19, 0, 0.31, 0), + UDim2.new(0.275, 0, 0.67, 0), + ColorZone +).AutoButtonColor = + false +makeStyledButton( + "LeftLeg", + UDim2.new(0.19, 0, 0.31, 0), + UDim2.new(0.525, 0, 0.67, 0), + ColorZone +).AutoButtonColor = false -- Character Panel label (shows what category we are currently browsing) diff --git a/lua/53878057.lua b/lua/53878057.lua index 2b3168a..c354fe1 100644 --- a/lua/53878057.lua +++ b/lua/53878057.lua @@ -1,3 +1,4 @@ +print "[Mercury]: Loaded corescript 53878057" if game.CoreGui.Version < 3 then return end -- peace out if we aren't using the right client @@ -77,7 +78,8 @@ game.LocalBackpack:SetOldSchoolBackpack(false) waitForChild(currentLoadout.Parent, "Backpack") local guiBackpack = currentLoadout.Parent.Backpack -local backpackManager = waitForChild(guiBackpack, "CoreScripts/BackpackScripts/BackpackManager") +local backpackManager = + waitForChild(guiBackpack, "CoreScripts/BackpackScripts/BackpackManager") local backpackOpenEvent = waitForChild(backpackManager, "BackpackOpenEvent") local backpackCloseEvent = waitForChild(backpackManager, "BackpackCloseEvent") local tabClickedEvent = waitForChild(backpackManager, "TabClickedEvent") @@ -90,8 +92,8 @@ if robloxGui.AbsoluteSize.Y <= 320 then maxNumLoadoutItems = 4 end -local characterChildAddedCon = nil -local backpackChildCon = nil +local characterChildAddedCon +local backpackChildCon local debounce = false @@ -159,7 +161,7 @@ function characterInWorkspace() end function removeGear(gear) - local emptySlot = nil + local emptySlot for i = 1, #gearSlots do if gearSlots[i] == gear and gear.Parent ~= nil then emptySlot = i @@ -168,8 +170,12 @@ function removeGear(gear) end if emptySlot then if gearSlots[emptySlot].GearReference.Value then - if gearSlots[emptySlot].GearReference.Value.Parent == game.Players.LocalPlayer.Character then -- if we currently have this equipped, unequip it - gearSlots[emptySlot].GearReference.Value.Parent = game.Players.LocalPlayer.Backpack + if + gearSlots[emptySlot].GearReference.Value.Parent + == game.Players.LocalPlayer.Character + then -- if we currently have this equipped, unequip it + gearSlots[emptySlot].GearReference.Value.Parent = + game.Players.LocalPlayer.Backpack end if @@ -217,7 +223,7 @@ function removeGear(gear) end function insertGear(gear, addToSlot) - local pos = nil + local pos if not addToSlot then for i = 1, #gearSlots do if gearSlots[i] == "empty" then @@ -269,7 +275,7 @@ function insertGear(gear, addToSlot) end gear.Visible = true - local con = nil + local con con = gear.Kill.Changed:connect(function(prop) kill(prop, con, gear) end) @@ -292,7 +298,10 @@ function checkToolAncestry(child, parent) end -- don't show roblox build tools if child:IsA "Tool" or child:IsA "HopperBin" then for i = 1, #gearSlots do - if gearSlots[i] ~= "empty" and gearSlots[i].GearReference.Value == child then + if + gearSlots[i] ~= "empty" + and gearSlots[i].GearReference.Value == child + then if parent == nil then gearSlots[i].Kill.Value = true return false @@ -316,7 +325,10 @@ end function removeAllEquippedGear(physGear) local stuff = player.Character:GetChildren() for i = 1, #stuff do - if (stuff[i]:IsA "Tool" or stuff[i]:IsA "HopperBin") and stuff[i] ~= physGear then + if + (stuff[i]:IsA "Tool" or stuff[i]:IsA "HopperBin") + and stuff[i] ~= physGear + then if stuff[i]:IsA "Tool" then stuff[i].Parent = player.Backpack end @@ -400,7 +412,7 @@ function toolSwitcher(numKey) end function activateGear(num) - local numKey = nil + local numKey if num == "0" then numKey = 10 -- why do lua indexes have to start at 1? :( else @@ -446,8 +458,12 @@ enlargeButton = function(button) if button:IsA "ImageButton" or button:IsA "TextButton" then button.ZIndex = 5 - local centerizeX = -(buttonSizeEnlarge.X.Scale - button.Size.X.Scale) / 2 - local centerizeY = -(buttonSizeEnlarge.Y.Scale - button.Size.Y.Scale) / 2 + local centerizeX = -( + buttonSizeEnlarge.X.Scale - button.Size.X.Scale + ) / 2 + local centerizeY = -( + buttonSizeEnlarge.Y.Scale - button.Size.Y.Scale + ) / 2 button:TweenSizeAndPosition( buttonSizeEnlarge, UDim2.new( @@ -526,7 +542,10 @@ end function pointInRectangle(point, rectTopLeft, rectSize) if point.x > rectTopLeft.x and point.x < (rectTopLeft.x + rectSize.x) then - if point.y > rectTopLeft.y and point.y < (rectTopLeft.y + rectSize.y) then + if + point.y > rectTopLeft.y + and point.y < (rectTopLeft.y + rectSize.y) + then return true end end @@ -550,17 +569,28 @@ function swapGear(gearClone, toFrame) gearSlots[gearCloneSlot] = toFrameChildren[1] toFrameChildren[1].SlotNumber.Text = gearClone.SlotNumber.Text - toFrameChildren[1].SlotNumberDownShadow.Text = gearClone.SlotNumber.Text - toFrameChildren[1].SlotNumberUpShadow.Text = gearClone.SlotNumber.Text + toFrameChildren[1].SlotNumberDownShadow.Text = + gearClone.SlotNumber.Text + toFrameChildren[1].SlotNumberUpShadow.Text = + gearClone.SlotNumber.Text local subString = string.sub(toFrame.Name, 5) gearClone.SlotNumber.Text = subString gearClone.SlotNumberDownShadow.Text = subString gearClone.SlotNumberUpShadow.Text = subString - gearClone.Position = UDim2.new(gearClone.Position.X.Scale, 0, gearClone.Position.Y.Scale, 0) - toFrameChildren[1].Position = - UDim2.new(toFrameChildren[1].Position.X.Scale, 0, toFrameChildren[1].Position.Y.Scale, 0) + gearClone.Position = UDim2.new( + gearClone.Position.X.Scale, + 0, + gearClone.Position.Y.Scale, + 0 + ) + toFrameChildren[1].Position = UDim2.new( + toFrameChildren[1].Position.X.Scale, + 0, + toFrameChildren[1].Position.Y.Scale, + 0 + ) toFrameChildren[1].Parent = gearClone.Parent gearClone.Parent = toFrame @@ -582,7 +612,12 @@ function swapGear(gearClone, toFrame) toSlotNum = 10 end gearSlots[toSlotNum] = gearClone - gearClone.Position = UDim2.new(gearClone.Position.X.Scale, 0, gearClone.Position.Y.Scale, 0) + gearClone.Position = UDim2.new( + gearClone.Position.X.Scale, + 0, + gearClone.Position.Y.Scale, + 0 + ) gearClone.Parent = toFrame end end @@ -595,7 +630,13 @@ function resolveDrag(gearClone, x, y) for i = 1, #frames do if frames[i]:IsA "Frame" then - if pointInRectangle(mousePoint, frames[i].AbsolutePosition, frames[i].AbsoluteSize) then + if + pointInRectangle( + mousePoint, + frames[i].AbsolutePosition, + frames[i].AbsoluteSize + ) + then swapGear(gearClone, frames[i]) return true end @@ -603,8 +644,14 @@ function resolveDrag(gearClone, x, y) end if - (x < frame.AbsolutePosition.x or x > (frame.AbsolutePosition.x + frame.AbsoluteSize.x)) - or (y < frame.AbsolutePosition.y or y > (frame.AbsolutePosition.y + frame.AbsoluteSize.y)) + ( + x < frame.AbsolutePosition.x + or x > (frame.AbsolutePosition.x + frame.AbsoluteSize.x) + ) + or ( + y < frame.AbsolutePosition.y + or y > (frame.AbsolutePosition.y + frame.AbsoluteSize.y) + ) then reorganizeLoadout(gearClone, false) return false @@ -621,11 +668,15 @@ function unequipAllItems(dontEquipThis) if gearSlots[i] == "empty" then break end - if gearSlots[i].GearReference.Value and gearSlots[i].GearReference.Value ~= dontEquipThis then + if + gearSlots[i].GearReference.Value + and gearSlots[i].GearReference.Value ~= dontEquipThis + then if gearSlots[i].GearReference.Value:IsA "HopperBin" then gearSlots[i].GearReference.Value:Disable() elseif gearSlots[i].GearReference.Value:IsA "Tool" then - gearSlots[i].GearReference.Value.Parent = game.Players.LocalPlayer.Backpack + gearSlots[i].GearReference.Value.Parent = + game.Players.LocalPlayer.Backpack end gearSlots[i].Selected = false end @@ -648,12 +699,21 @@ function showToolTip(button, tip) end function hideToolTip(button, _) - if button and button:FindFirstChild "ToolTipLabel" and button.ToolTipLabel:IsA "TextLabel" then + if + button + and button:FindFirstChild "ToolTipLabel" + and button.ToolTipLabel:IsA "TextLabel" + then button.ToolTipLabel.Visible = false end end -local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButton) +local addingPlayerChild = function( + child, + equipped, + addToSlot, + inventoryGearButton +) waitForDebounce() debounce = true @@ -670,7 +730,10 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt if not addToSlot then for i = 1, #gearSlots do - if gearSlots[i] ~= "empty" and gearSlots[i].GearReference.Value == child then -- we already have gear, do nothing + if + gearSlots[i] ~= "empty" + and gearSlots[i].GearReference.Value == child + then -- we already have gear, do nothing debounce = false return end @@ -733,7 +796,12 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt local absolutePositionFinal = inventoryGearButton.AbsolutePosition local currentAbsolutePosition = gearClone.AbsolutePosition local diff = absolutePositionFinal - currentAbsolutePosition - gearClone.Position = UDim2.new(gearClone.Position.X.Scale, diff.x, gearClone.Position.Y.Scale, diff.y) + gearClone.Position = UDim2.new( + gearClone.Position.X.Scale, + diff.x, + gearClone.Position.Y.Scale, + diff.y + ) gearClone.ZIndex = 4 end @@ -751,20 +819,27 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt if equipped then gearClone.Selected = true unequipAllItems(child) - delay(guiTweenSpeed + 0.01, function() -- if our gear is equipped, we will want to enlarge it when done moving - if - gearClone:FindFirstChild "GearReference" - and ( - ( - gearClone.GearReference.Value:IsA "Tool" - and gearClone.GearReference.Value.Parent == player.Character + delay( + guiTweenSpeed + 0.01, + function() -- if our gear is equipped, we will want to enlarge it when done moving + if + gearClone:FindFirstChild "GearReference" + and ( + ( + gearClone.GearReference.Value:IsA "Tool" + and gearClone.GearReference.Value.Parent + == player.Character + ) + or ( + gearClone.GearReference.Value:IsA "HopperBin" + and gearClone.GearReference.Value.Active == true + ) ) - or (gearClone.GearReference.Value:IsA "HopperBin" and gearClone.GearReference.Value.Active == true) - ) - then - enlargeButton(gearClone) + then + enlargeButton(gearClone) + end end - end) + ) end local dragBeginPos @@ -844,8 +919,8 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt end end) -- this probably isn't necessary since objects are being deleted (probably), but this might still leak just in case - local childCon = nil - local childChangeCon = nil + local childCon + local childChangeCon childCon = child.AncestryChanged:connect(function(newChild, parent) if not checkToolAncestry(newChild, parent) then if childCon then @@ -900,7 +975,7 @@ function addToInventory(child) return end - local slot = nil + local slot for i = 1, #inventory do if inventory[i] and inventory[i] == child then return @@ -961,7 +1036,7 @@ end local centerGear = function() loadoutChildren = currentLoadout:GetChildren() local gearButtons = {} - local lastSlotAdd = nil + local lastSlotAdd for i = 1, #loadoutChildren do if loadoutChildren[i]:IsA "Frame" then @@ -1056,7 +1131,10 @@ function tabHandler(inFocus) end function coreGuiChanged(coreGuiType, enabled) - if coreGuiType == Enum.CoreGuiType.Backpack or coreGuiType == Enum.CoreGuiType.All then + if + coreGuiType == Enum.CoreGuiType.Backpack + or coreGuiType == Enum.CoreGuiType.All + then backpackButton.Visible = enabled clBackground.Visible = enabled backpackEnabled = enabled @@ -1068,7 +1146,10 @@ function coreGuiChanged(coreGuiType, enabled) end end - if coreGuiType == Enum.CoreGuiType.Health or coreGuiType == Enum.CoreGuiType.All then + if + coreGuiType == Enum.CoreGuiType.Health + or coreGuiType == Enum.CoreGuiType.All + then setHealthBarVisible(game.Players.LocalPlayer.PlayerGui, enabled) end end @@ -1078,8 +1159,14 @@ end registerNumberKeys() pcall(function() - coreGuiChanged(Enum.CoreGuiType.Backpack, Game.StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.Backpack)) - coreGuiChanged(Enum.CoreGuiType.Health, Game.StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.Health)) + coreGuiChanged( + Enum.CoreGuiType.Backpack, + Game.StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.Backpack) + ) + coreGuiChanged( + Enum.CoreGuiType.Health, + Game.StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.Health) + ) Game.StarterGui.CoreGuiChangedSignal:connect(coreGuiChanged) end) @@ -1108,9 +1195,16 @@ delay(2, function() if robloxGui.AbsoluteSize.Y <= 320 then local cChildren = currentLoadout:GetChildren() for i = 1, #cChildren do - local slotNum = tonumber(string.sub(cChildren[i].Name, 5, string.len(cChildren[i].Name))) + local slotNum = tonumber( + string.sub( + cChildren[i].Name, + 5, + string.len(cChildren[i].Name) + ) + ) if type(slotNum) == "number" then - cChildren[i].Position = UDim2.new(0, (slotNum - 1) * 60, 0, 0) + cChildren[i].Position = + UDim2.new(0, (slotNum - 1) * 60, 0, 0) end end end @@ -1214,9 +1308,16 @@ player.CharacterAdded:connect(function() if robloxGui.AbsoluteSize.Y <= 320 then local cChildren = currentLoadout:GetChildren() for i = 1, #cChildren do - local slotNum = tonumber(string.sub(cChildren[i].Name, 5, string.len(cChildren[i].Name))) + local slotNum = tonumber( + string.sub( + cChildren[i].Name, + 5, + string.len(cChildren[i].Name) + ) + ) if type(slotNum) == "number" then - cChildren[i].Position = UDim2.new(0, (slotNum - 1) * 60, 0, 0) + cChildren[i].Position = + UDim2.new(0, (slotNum - 1) * 60, 0, 0) end end end @@ -1238,7 +1339,11 @@ guiBackpack.SwapSlot.Changed:connect(function() reorganizeLoadout(gearSlots[pos], false) end if swapSlot.GearButton.Value then - addingPlayerChild(swapSlot.GearButton.Value.GearReference.Value, false, pos) + addingPlayerChild( + swapSlot.GearButton.Value.GearReference.Value, + false, + pos + ) end guiBackpack.SwapSlot.Value = false end diff --git a/lua/59002209.lua b/lua/59002209.lua index e69de29..e1963bd 100644 --- a/lua/59002209.lua +++ b/lua/59002209.lua @@ -0,0 +1 @@ +print "[Mercury]: Loaded corescript 59002209" diff --git a/lua/60595411.lua b/lua/60595411.lua index 6115b7f..b013cab 100644 --- a/lua/60595411.lua +++ b/lua/60595411.lua @@ -1,3 +1,4 @@ +print "[Mercury]: Loaded corescript 60595411" local t = {} ------------------------------------------------------------------------------------------------------------------------ @@ -273,7 +274,13 @@ end function JsonReader:TestReservedWord(t) for _, v in ipairs(t) do if self:Next() ~= v then - error(string.format("Error reading '%s': %s", table.concat(t), self:All())) + error( + string.format( + "Error reading '%s': %s", + table.concat(t), + self:All() + ) + ) end end end @@ -333,7 +340,9 @@ function JsonReader:ReadBlockComment() done = true end if not done and ch == "/" and self:Peek() == "*" then - error(string.format("Invalid comment: %s, '/*' illegal.", self:All())) + error( + string.format("Invalid comment: %s, '/*' illegal.", self:All()) + ) end end self:Next() @@ -363,7 +372,13 @@ function JsonReader:ReadArray() if not done then local ch = self:Next() if ch ~= "," then - error(string.format("Invalid array: '%s' due to: '%s'", self:All(), ch)) + error( + string.format( + "Invalid array: '%s' due to: '%s'", + self:All(), + ch + ) + ) end end end @@ -386,7 +401,13 @@ function JsonReader:ReadObject() self:SkipWhiteSpace() local ch = self:Next() if ch ~= ":" then - error(string.format("Invalid object: '%s' due to: '%s'", self:All(), ch)) + error( + string.format( + "Invalid object: '%s' due to: '%s'", + self:All(), + ch + ) + ) end self:SkipWhiteSpace() local val = self:Read() @@ -398,7 +419,13 @@ function JsonReader:ReadObject() if not done then ch = self:Next() if ch ~= "," then - error(string.format("Invalid array: '%s' near: '%s'", self:All(), ch)) + error( + string.format( + "Invalid array: '%s' near: '%s'", + self:All(), + ch + ) + ) end end end @@ -479,7 +506,12 @@ t.MakeWedge = function(x, y, z, _) return game:GetService("Terrain"):AutoWedgeCell(x, y, z) end -t.SelectTerrainRegion = function(regionToSelect, color, selectEmptyCells, selectionParent) +t.SelectTerrainRegion = function( + regionToSelect, + color, + selectEmptyCells, + selectionParent +) local terrain = game.Workspace:FindFirstChild "Terrain" if not terrain then return @@ -489,10 +521,16 @@ t.SelectTerrainRegion = function(regionToSelect, color, selectEmptyCells, select assert(color) if not type(regionToSelect) == "Region3" then - error("regionToSelect (first arg), should be of type Region3, but is type", type(regionToSelect)) + error( + "regionToSelect (first arg), should be of type Region3, but is type", + type(regionToSelect) + ) end if not type(color) == "BrickColor" then - error("color (second arg), should be of type BrickColor, but is type", type(color)) + error( + "color (second arg), should be of type BrickColor, but is type", + type(color) + ) end -- frequently used terrain calls (speeds up call, no lookup necessary) @@ -511,10 +549,10 @@ t.SelectTerrainRegion = function(regionToSelect, color, selectEmptyCells, select selectionContainer.Parent = game.Workspace end - local updateSelection = nil -- function we return to allow user to update selection - local currentKeepAliveTag = nil -- a tag that determines whether adorns should be destroyed + local updateSelection -- function we return to allow user to update selection + local currentKeepAliveTag -- a tag that determines whether adorns should be destroyed local aliveCounter = 0 -- helper for currentKeepAliveTag - local lastRegion = nil -- used to stop updates that do nothing + local lastRegion -- used to stop updates that do nothing local adornments = {} -- contains all adornments local reusableAdorns = {} @@ -544,8 +582,8 @@ t.SelectTerrainRegion = function(regionToSelect, color, selectEmptyCells, select -- helper function that creates the basis for a selection box function createAdornment(theColor) - local selectionPartClone = nil - local selectionBoxClone = nil + local selectionPartClone + local selectionBoxClone if #reusableAdorns > 0 then selectionPartClone = reusableAdorns[1]["part"] @@ -580,7 +618,10 @@ t.SelectTerrainRegion = function(regionToSelect, color, selectEmptyCells, select for cellPos, adornTable in pairs(adornments) do if adornTable.KeepAlive ~= currentKeepAliveTag then -- old news, we should get rid of this adornTable.SelectionBox.Visible = false - table.insert(reusableAdorns, { part = adornTable.SelectionPart, box = adornTable.SelectionBox }) + table.insert(reusableAdorns, { + part = adornTable.SelectionPart, + box = adornTable.SelectionBox, + }) adornments[cellPos] = nil end end @@ -597,8 +638,12 @@ t.SelectTerrainRegion = function(regionToSelect, color, selectEmptyCells, select -- finds full cells in region and adorns each cell with a box, with the argument color function adornFullCellsInRegion(region, color) - local regionBegin = region.CFrame.p - (region.Size / 2) + Vector3.new(2, 2, 2) - local regionEnd = region.CFrame.p + (region.Size / 2) - Vector3.new(2, 2, 2) + local regionBegin = region.CFrame.p + - (region.Size / 2) + + Vector3.new(2, 2, 2) + local regionEnd = region.CFrame.p + + (region.Size / 2) + - Vector3.new(2, 2, 2) local cellPosBegin = WorldToCellPreferSolid(terrain, regionBegin) local cellPosEnd = WorldToCellPreferSolid(terrain, regionEnd) @@ -626,7 +671,8 @@ t.SelectTerrainRegion = function(regionToSelect, color, selectEmptyCells, select end if not updated then - local selectionPart, selectionBox = createAdornment(color) + local selectionPart, selectionBox = + createAdornment(color) selectionPart.Size = Vector3.new(4, 4, 4) selectionPart.CFrame = CFrame.new(cframePos) local adornTable = { @@ -735,7 +781,11 @@ function t.CreateSignal() error("connect must be called with `:`, not `.`", 2) end if type(func) ~= "function" then - error("Argument #1 of connect must be a function, got a " .. type(func), 2) + error( + "Argument #1 of connect must be a function, got a " + .. type(func), + 2 + ) end local cn = mBindableEvent.Event:connect(func) mAllCns[cn] = true @@ -890,10 +940,10 @@ local function Create_PrivImpl(objectType) --make the object to mutate local obj = Instance.new(objectType) - local parent = nil + local parent --stored constructor function to be called after other initialization - local ctor = nil + local ctor for k, v in pairs(dat) do --add property @@ -909,7 +959,11 @@ local function Create_PrivImpl(objectType) --add child elseif type(k) == "number" then if type(v) ~= "userdata" then - error("Bad entry in Create body: Numeric keys must be paired with children, got a: " .. type(v), 2) + error( + "Bad entry in Create body: Numeric keys must be paired with children, got a: " + .. type(v), + 2 + ) end v.Parent = obj @@ -936,11 +990,21 @@ local function Create_PrivImpl(objectType) ) elseif ctor then --ctor already exists, only one allowed - error("Bad entry in Create body: Only one constructor function is allowed", 2) + error( + "Bad entry in Create body: Only one constructor function is allowed", + 2 + ) end ctor = v else - error("Bad entry (" .. tostring(k) .. " => " .. tostring(v) .. ") in Create body", 2) + error( + "Bad entry (" + .. tostring(k) + .. " => " + .. tostring(v) + .. ") in Create body", + 2 + ) end end @@ -1000,7 +1064,10 @@ t.Help = function(funcNameOrFunc) .. "parameter is provided, if not sets cell x, y, z to be whatever material it previously was. " .. "Returns true if made a wedge, false if the cell remains a block " end - if funcNameOrFunc == "SelectTerrainRegion" or funcNameOrFunc == t.SelectTerrainRegion then + if + funcNameOrFunc == "SelectTerrainRegion" + or funcNameOrFunc == t.SelectTerrainRegion + then return "Function SelectTerrainRegion. " .. "Arguments: (regionToSelect, color, selectEmptyCells, selectionParent). " .. "Description: Selects all terrain via a series of selection boxes within the regionToSelect " diff --git a/lua/60595695.lua b/lua/60595695.lua index a151712..97fd97d 100644 --- a/lua/60595695.lua +++ b/lua/60595695.lua @@ -1,3 +1,4 @@ +print "[Mercury]: Loaded corescript 60595695" -- Library Registration Script -- This script is used to register RbxLua libraries on game servers, so game scripts have -- access to all of the libraries (otherwise only local scripts do) diff --git a/lua/73157242.lua b/lua/73157242.lua index 6dd5e2a..77aea71 100644 --- a/lua/73157242.lua +++ b/lua/73157242.lua @@ -1,3 +1,4 @@ +print "[Mercury]: Loaded corescript 73157242" local t = {} -- function waitForChild(instance, name) @@ -16,8 +17,11 @@ local t = {} function PlaneIntersection(vectorPos) local hit = false local currCamera = game.Workspace.CurrentCamera - local startPos = - Vector3.new(currCamera.CoordinateFrame.p.X, currCamera.CoordinateFrame.p.Y, currCamera.CoordinateFrame.p.Z) + local startPos = Vector3.new( + currCamera.CoordinateFrame.p.X, + currCamera.CoordinateFrame.p.Y, + currCamera.CoordinateFrame.p.Z + ) local endPos = Vector3.new(vectorPos.X, vectorPos.Y, vectorPos.Z) local normal = Vector3.new(0, 1, 0) local p3 = Vector3.new(0, 0, 0) @@ -46,12 +50,16 @@ end function GetTerrainForMouse(mouse) -- There was no target, so all it could be is a plane intersection. -- Check for a plane intersection. If there isn't one then nothing will get hit. - local cell = game.Workspace.Terrain:WorldToCellPreferSolid(Vector3.new(mouse.hit.x, mouse.hit.y, mouse.hit.z)) - local planeLoc = nil + local cell = game.Workspace.Terrain:WorldToCellPreferSolid( + Vector3.new(mouse.hit.x, mouse.hit.y, mouse.hit.z) + ) + local planeLoc -- If nothing was hit, do the plane intersection. if 0 == game.Workspace.Terrain:GetCell(cell.X, cell.Y, cell.Z).Value then cell = nil - planeLoc, hit = PlaneIntersection(Vector3.new(mouse.hit.x, mouse.hit.y, mouse.hit.z)) + planeLoc, hit = PlaneIntersection( + Vector3.new(mouse.hit.x, mouse.hit.y, mouse.hit.z) + ) if hit then cell = planeLoc end @@ -66,7 +74,8 @@ local insertBoundingBoxOverlapVector = Vector3.new(0.3, 0.3, 0.3) -- we can stil local function rotatePartAndChildren(part, rotCF, offsetFromOrigin) -- rotate this thing, if it's a part if part:IsA "BasePart" then - part.CFrame = (rotCF * (part.CFrame - offsetFromOrigin)) + offsetFromOrigin + part.CFrame = (rotCF * (part.CFrame - offsetFromOrigin)) + + offsetFromOrigin end -- recursively do the same to all children @@ -195,9 +204,15 @@ local function getClosestAlignedWorldDirection(aVector3InWorld) local xDir = Vector3.new(1, 0, 0) local yDir = Vector3.new(0, 1, 0) local zDir = Vector3.new(0, 0, 1) - local xDot = aVector3InWorld.x * xDir.x + aVector3InWorld.y * xDir.y + aVector3InWorld.z * xDir.z - local yDot = aVector3InWorld.x * yDir.x + aVector3InWorld.y * yDir.y + aVector3InWorld.z * yDir.z - local zDot = aVector3InWorld.x * zDir.x + aVector3InWorld.y * zDir.y + aVector3InWorld.z * zDir.z + local xDot = aVector3InWorld.x * xDir.x + + aVector3InWorld.y * xDir.y + + aVector3InWorld.z * xDir.z + local yDot = aVector3InWorld.x * yDir.x + + aVector3InWorld.y * yDir.y + + aVector3InWorld.z * yDir.z + local zDot = aVector3InWorld.x * zDir.x + + aVector3InWorld.y * zDir.y + + aVector3InWorld.z * zDir.z if math.abs(xDot) > math.abs(yDot) and math.abs(xDot) > math.abs(zDot) then if xDot > 0 then @@ -205,7 +220,9 @@ local function getClosestAlignedWorldDirection(aVector3InWorld) else return 3 end - elseif math.abs(yDot) > math.abs(xDot) and math.abs(yDot) > math.abs(zDot) then + elseif + math.abs(yDot) > math.abs(xDot) and math.abs(yDot) > math.abs(zDot) + then if yDot > 0 then return 1 else @@ -221,11 +238,13 @@ local function getClosestAlignedWorldDirection(aVector3InWorld) end local function positionPartsAtCFrame3(aCFrame, currentParts) - local insertCFrame = nil + local insertCFrame if not currentParts then return currentParts end - if currentParts and (currentParts:IsA "Model" or currentParts:IsA "Tool") then + if + currentParts and (currentParts:IsA "Model" or currentParts:IsA "Tool") + then insertCFrame = currentParts:GetModelCFrame() currentParts:TranslateBy(aCFrame.p - insertCFrame.p) else @@ -246,8 +265,8 @@ local function modelTargetSurface(partOrModel, rayStart, rayEnd) return 0 end - local modelCFrame = nil - local modelSize = nil + local modelCFrame + local modelSize if partOrModel:IsA "Model" then modelCFrame = partOrModel:GetModelCFrame() modelSize = partOrModel:GetModelSize() @@ -274,9 +293,21 @@ local function modelTargetSurface(partOrModel, rayStart, rayEnd) end -- find which surface the transformed mouse ray hits (using modelSize): - local xHitTime = calcRayHitTime(mouseRayStart.X, mouseSlope.X, modelSize.X / 2 * xPositive) - local yHitTime = calcRayHitTime(mouseRayStart.Y, mouseSlope.Y, modelSize.Y / 2 * yPositive) - local zHitTime = calcRayHitTime(mouseRayStart.Z, mouseSlope.Z, modelSize.Z / 2 * zPositive) + local xHitTime = calcRayHitTime( + mouseRayStart.X, + mouseSlope.X, + modelSize.X / 2 * xPositive + ) + local yHitTime = calcRayHitTime( + mouseRayStart.Y, + mouseSlope.Y, + modelSize.Y / 2 * yPositive + ) + local zHitTime = calcRayHitTime( + mouseRayStart.Z, + mouseSlope.Z, + modelSize.Z / 2 * zPositive + ) local hitFace = 0 @@ -326,8 +357,11 @@ local function getBoundingBox2(partOrModel) local justify = justifyValue.Value local two = Vector3.new(2, 2, 2) local actualBox = maxVec - minVec - Vector3.new(0.01, 0.01, 0.01) - local containingGridBox = - Vector3.new(4 * math.ceil(actualBox.x / 4), 4 * math.ceil(actualBox.y / 4), 4 * math.ceil(actualBox.z / 4)) + local containingGridBox = Vector3.new( + 4 * math.ceil(actualBox.x / 4), + 4 * math.ceil(actualBox.y / 4), + 4 * math.ceil(actualBox.z / 4) + ) local adjustment = containingGridBox - actualBox minVec = minVec - 0.5 * adjustment * justify maxVec = maxVec + 0.5 * adjustment * (two - justify) @@ -341,19 +375,41 @@ local function getBoundingBoxInWorldCoordinates(partOrModel) local maxVec = Vector3.new(-math.huge, -math.huge, -math.huge) if partOrModel:IsA "BasePart" and not partOrModel:IsA "Terrain" then - local vec1 = partOrModel.CFrame:pointToWorldSpace(-0.5 * partOrModel.Size) - local vec2 = partOrModel.CFrame:pointToWorldSpace(0.5 * partOrModel.Size) - minVec = Vector3.new(math.min(vec1.X, vec2.X), math.min(vec1.Y, vec2.Y), math.min(vec1.Z, vec2.Z)) - maxVec = Vector3.new(math.max(vec1.X, vec2.X), math.max(vec1.Y, vec2.Y), math.max(vec1.Z, vec2.Z)) + local vec1 = + partOrModel.CFrame:pointToWorldSpace(-0.5 * partOrModel.Size) + local vec2 = + partOrModel.CFrame:pointToWorldSpace(0.5 * partOrModel.Size) + minVec = Vector3.new( + math.min(vec1.X, vec2.X), + math.min(vec1.Y, vec2.Y), + math.min(vec1.Z, vec2.Z) + ) + maxVec = Vector3.new( + math.max(vec1.X, vec2.X), + math.max(vec1.Y, vec2.Y), + math.max(vec1.Z, vec2.Z) + ) elseif not partOrModel:IsA "Terrain" then -- we shouldn't have to deal with this case --minVec = Vector3.new(-2, -2, -2) --maxVec = Vector3.new(2, 2, 2) -- else - local vec1 = partOrModel:GetModelCFrame():pointToWorldSpace(-0.5 * partOrModel:GetModelSize()) - local vec2 = partOrModel:GetModelCFrame():pointToWorldSpace(0.5 * partOrModel:GetModelSize()) - minVec = Vector3.new(math.min(vec1.X, vec2.X), math.min(vec1.Y, vec2.Y), math.min(vec1.Z, vec2.Z)) - maxVec = Vector3.new(math.max(vec1.X, vec2.X), math.max(vec1.Y, vec2.Y), math.max(vec1.Z, vec2.Z)) + local vec1 = partOrModel + :GetModelCFrame() + :pointToWorldSpace(-0.5 * partOrModel:GetModelSize()) + local vec2 = partOrModel + :GetModelCFrame() + :pointToWorldSpace(0.5 * partOrModel:GetModelSize()) + minVec = Vector3.new( + math.min(vec1.X, vec2.X), + math.min(vec1.Y, vec2.Y), + math.min(vec1.Z, vec2.Z) + ) + maxVec = Vector3.new( + math.max(vec1.X, vec2.X), + math.max(vec1.Y, vec2.Y), + math.max(vec1.Z, vec2.Z) + ) end return minVec, maxVec @@ -389,7 +445,9 @@ local function isBlocker(part) -- returns whether or not we want to cancel the s if part:FindFirstChild "Humanoid" then return false end - if part:FindFirstChild "RobloxStamper" or part:FindFirstChild "RobloxModel" then + if + part:FindFirstChild "RobloxStamper" or part:FindFirstChild "RobloxModel" + then return true end if part:IsA "Part" and not part.CanCollide then @@ -406,23 +464,30 @@ end local function spaceAboveCharacter(charTorso, newTorsoY, stampData) local partsAboveChar = game.Workspace:FindPartsInRegion3( Region3.new( - Vector3.new(charTorso.Position.X, newTorsoY, charTorso.Position.Z) - Vector3.new(0.75, 2.75, 0.75), - Vector3.new(charTorso.Position.X, newTorsoY, charTorso.Position.Z) + Vector3.new(0.75, 1.75, 0.75) + Vector3.new(charTorso.Position.X, newTorsoY, charTorso.Position.Z) + - Vector3.new(0.75, 2.75, 0.75), + Vector3.new(charTorso.Position.X, newTorsoY, charTorso.Position.Z) + + Vector3.new(0.75, 1.75, 0.75) ), charTorso.Parent, 100 ) for j = 1, #partsAboveChar do - if partsAboveChar[j].CanCollide and not partsAboveChar[j]:IsDescendantOf(stampData.CurrentParts) then + if + partsAboveChar[j].CanCollide + and not partsAboveChar[j]:IsDescendantOf(stampData.CurrentParts) + then return false end end if clusterPartsInRegion( - Vector3.new(charTorso.Position.X, newTorsoY, charTorso.Position.Z) - Vector3.new(0.75, 2.75, 0.75), - Vector3.new(charTorso.Position.X, newTorsoY, charTorso.Position.Z) + Vector3.new(0.75, 1.75, 0.75) + Vector3.new(charTorso.Position.X, newTorsoY, charTorso.Position.Z) + - Vector3.new(0.75, 2.75, 0.75), + Vector3.new(charTorso.Position.X, newTorsoY, charTorso.Position.Z) + + Vector3.new(0.75, 1.75, 0.75) ) then return false @@ -457,7 +522,9 @@ local function findConfigAtMouseTarget(Mouse, stampData) local diagBB = maxBB - minBB local insertCFrame - if stampData.CurrentParts:IsA "Model" or stampData.CurrentParts:IsA "Tool" then + if + stampData.CurrentParts:IsA "Model" or stampData.CurrentParts:IsA "Tool" + then insertCFrame = stampData.CurrentParts:GetModelCFrame() else insertCFrame = stampData.CurrentParts.CFrame @@ -472,7 +539,7 @@ local function findConfigAtMouseTarget(Mouse, stampData) end local hitPlane = false - local targetPart = nil + local targetPart local success = pcall(function() targetPart = Mouse.Target end) @@ -486,7 +553,7 @@ local function findConfigAtMouseTarget(Mouse, stampData) mouseHitInWorld = Vector3.new(Mouse.Hit.x, Mouse.Hit.y, Mouse.Hit.z) end - local cellPos = nil + local cellPos -- Nothing was hit, so check for the default plane. if nil == targetPart then @@ -499,7 +566,11 @@ local function findConfigAtMouseTarget(Mouse, stampData) hitPlane = true -- Take into account error that will occur. cellPos = Vector3.new(cellPos.X - 1, cellPos.Y, cellPos.Z) - mouseHitInWorld = game.Workspace.Terrain:CellCenterToWorld(cellPos.x, cellPos.y, cellPos.z) + mouseHitInWorld = game.Workspace.Terrain:CellCenterToWorld( + cellPos.x, + cellPos.y, + cellPos.z + ) end end @@ -517,7 +588,13 @@ local function findConfigAtMouseTarget(Mouse, stampData) cellID = cellPos end - targetCFrame = CFrame.new(game.Workspace.Terrain:CellCenterToWorld(cellID.x, cellID.y, cellID.z)) + targetCFrame = CFrame.new( + game.Workspace.Terrain:CellCenterToWorld( + cellID.x, + cellID.y, + cellID.z + ) + ) end local mouseHitInTarget = targetCFrame:pointToObjectSpace(mouseHitInWorld) @@ -526,7 +603,9 @@ local function findConfigAtMouseTarget(Mouse, stampData) -- DON'T WANT THIS IN TERMS OF THE MODEL CFRAME! (.TargetSurface is in terms of the part CFrame, so this would break, right? [HotThoth]) -- (ideally, we would want to make the Mouse.TargetSurface a model-targetsurface instead, but for testing will be using the converse) --targetVectorInWorld = targetCFrame:vectorToWorldSpace(Vector3.FromNormalId(Mouse.TargetSurface)) - targetVectorInWorld = targetPart.CFrame:vectorToWorldSpace(Vector3.FromNormalId(Mouse.TargetSurface)) -- better, but model cframe would be best + targetVectorInWorld = targetPart.CFrame:vectorToWorldSpace( + Vector3.FromNormalId(Mouse.TargetSurface) + ) -- better, but model cframe would be best --[[if targetPart.Parent:IsA("Model") then local hitFace = modelTargetSurface(targetPart.Parent, Mouse.Hit.p, game.Workspace.CurrentCamera.CoordinateFrame.p) -- best, if you get it right local WORLD_AXES = {Vector3.new(1, 0, 0), Vector3.new(0, 1, 0), Vector3.new(0, 0, 1)} @@ -542,33 +621,47 @@ local function findConfigAtMouseTarget(Mouse, stampData) local clampToSurface if getClosestAlignedWorldDirection(targetVectorInWorld) == 0 then - targetRefPointInTarget = targetCFrame:vectorToObjectSpace(Vector3.new(1, -1, 1)) - insertRefPointInInsert = insertCFrame:vectorToObjectSpace(Vector3.new(-1, -1, 1)) + targetRefPointInTarget = + targetCFrame:vectorToObjectSpace(Vector3.new(1, -1, 1)) + insertRefPointInInsert = + insertCFrame:vectorToObjectSpace(Vector3.new(-1, -1, 1)) clampToSurface = Vector3.new(0, 1, 1) elseif getClosestAlignedWorldDirection(targetVectorInWorld) == 3 then - targetRefPointInTarget = targetCFrame:vectorToObjectSpace(Vector3.new(-1, -1, -1)) - insertRefPointInInsert = insertCFrame:vectorToObjectSpace(Vector3.new(1, -1, -1)) + targetRefPointInTarget = + targetCFrame:vectorToObjectSpace(Vector3.new(-1, -1, -1)) + insertRefPointInInsert = + insertCFrame:vectorToObjectSpace(Vector3.new(1, -1, -1)) clampToSurface = Vector3.new(0, 1, 1) elseif getClosestAlignedWorldDirection(targetVectorInWorld) == 1 then - targetRefPointInTarget = targetCFrame:vectorToObjectSpace(Vector3.new(-1, 1, 1)) - insertRefPointInInsert = insertCFrame:vectorToObjectSpace(Vector3.new(-1, -1, 1)) + targetRefPointInTarget = + targetCFrame:vectorToObjectSpace(Vector3.new(-1, 1, 1)) + insertRefPointInInsert = + insertCFrame:vectorToObjectSpace(Vector3.new(-1, -1, 1)) clampToSurface = Vector3.new(1, 0, 1) elseif getClosestAlignedWorldDirection(targetVectorInWorld) == 4 then - targetRefPointInTarget = targetCFrame:vectorToObjectSpace(Vector3.new(-1, -1, 1)) - insertRefPointInInsert = insertCFrame:vectorToObjectSpace(Vector3.new(-1, 1, 1)) + targetRefPointInTarget = + targetCFrame:vectorToObjectSpace(Vector3.new(-1, -1, 1)) + insertRefPointInInsert = + insertCFrame:vectorToObjectSpace(Vector3.new(-1, 1, 1)) clampToSurface = Vector3.new(1, 0, 1) elseif getClosestAlignedWorldDirection(targetVectorInWorld) == 2 then - targetRefPointInTarget = targetCFrame:vectorToObjectSpace(Vector3.new(-1, -1, 1)) - insertRefPointInInsert = insertCFrame:vectorToObjectSpace(Vector3.new(-1, -1, -1)) + targetRefPointInTarget = + targetCFrame:vectorToObjectSpace(Vector3.new(-1, -1, 1)) + insertRefPointInInsert = + insertCFrame:vectorToObjectSpace(Vector3.new(-1, -1, -1)) clampToSurface = Vector3.new(1, 1, 0) else - targetRefPointInTarget = targetCFrame:vectorToObjectSpace(Vector3.new(1, -1, -1)) - insertRefPointInInsert = insertCFrame:vectorToObjectSpace(Vector3.new(1, -1, 1)) + targetRefPointInTarget = + targetCFrame:vectorToObjectSpace(Vector3.new(1, -1, -1)) + insertRefPointInInsert = + insertCFrame:vectorToObjectSpace(Vector3.new(1, -1, 1)) clampToSurface = Vector3.new(1, 1, 0) end - targetRefPointInTarget = targetRefPointInTarget * (0.5 * diagBBTarget) + 0.5 * (maxBBTarget + minBBTarget) - insertRefPointInInsert = insertRefPointInInsert * (0.5 * diagBB) + 0.5 * (maxBB + minBB) + targetRefPointInTarget = targetRefPointInTarget * (0.5 * diagBBTarget) + + 0.5 * (maxBBTarget + minBBTarget) + insertRefPointInInsert = insertRefPointInInsert * (0.5 * diagBB) + + 0.5 * (maxBB + minBB) -- To Do: For cases that are not aligned to the world grid, account for the minimal rotation -- needed to bring the Insert part(s) into alignment with the Target Part @@ -583,11 +676,14 @@ local function findConfigAtMouseTarget(Mouse, stampData) deltaClamped = deltaClamped * clampToSurface local targetTouchInTarget = deltaClamped + targetRefPointInTarget - local TargetTouchRelToWorld = targetCFrame:pointToWorldSpace(targetTouchInTarget) - local InsertTouchInWorld = insertCFrame:vectorToWorldSpace(insertRefPointInInsert) + local TargetTouchRelToWorld = + targetCFrame:pointToWorldSpace(targetTouchInTarget) + local InsertTouchInWorld = + insertCFrame:vectorToWorldSpace(insertRefPointInInsert) local posInsertOriginInWorld = TargetTouchRelToWorld - InsertTouchInWorld - local _, _, _, R00, R01, R02, R10, R11, R12, R20, R21, R22 = insertCFrame:components() + local _, _, _, R00, R01, R02, R10, R11, R12, R20, R21, R22 = + insertCFrame:components() targetConfig = CFrame.new( posInsertOriginInWorld.x, posInsertOriginInWorld.y, @@ -604,7 +700,9 @@ local function findConfigAtMouseTarget(Mouse, stampData) ) admissibleConfig = true - return admissibleConfig, targetConfig, getClosestAlignedWorldDirection(targetVectorInWorld) + return admissibleConfig, + targetConfig, + getClosestAlignedWorldDirection(targetVectorInWorld) end local function truncateToCircleEighth(bigValue, littleValue) @@ -624,7 +722,8 @@ local function truncateToCircleEighth(bigValue, littleValue) if frac > 0.382683432 then -- between 22.5 and 45 degrees, so truncate to 45-degree tilt - return 0.707106781 * hypotenuse * bigSign, 0.707106781 * hypotenuse * littleSign + return 0.707106781 * hypotenuse * bigSign, + 0.707106781 * hypotenuse * littleSign else -- between 0 and 22.5 degrees, so truncate to 0-degree tilt return hypotenuse * bigSign, 0 @@ -733,7 +832,7 @@ t.GetStampModel = function(assetId, terrainShape, useAssetVersionId) end local function setupFakeTerrainPart(cellMat, cellType, cellOrient) - local newTerrainPiece = nil + local newTerrainPiece if cellType == 1 or cellType == 4 then newTerrainPiece = Instance.new "WedgePart" newTerrainPiece.formFactor = "Custom" @@ -759,12 +858,14 @@ t.GetStampModel = function(assetId, terrainShape, useAssetVersionId) if cellType == 2 or cellType == 3 then flipped = 0 end - newTerrainPiece.CFrame = CFrame.Angles(0, math.pi / 2 * cellOrient + flipped, sideways) + newTerrainPiece.CFrame = + CFrame.Angles(0, math.pi / 2 * cellOrient + flipped, sideways) if cellType == 3 then local inverseCornerWedgeMesh = Instance.new "SpecialMesh" inverseCornerWedgeMesh.MeshType = "FileMesh" - inverseCornerWedgeMesh.MeshId = "http://www.roblox.com/asset?id=66832495" + inverseCornerWedgeMesh.MeshId = + "http://banland.xyz/asset?id=66832495" inverseCornerWedgeMesh.Scale = Vector3.new(2, 2, 2) inverseCornerWedgeMesh.Parent = newTerrainPiece end @@ -869,9 +970,17 @@ t.GetStampModel = function(assetId, terrainShape, useAssetVersionId) local clusterTag = root:FindFirstChild "ClusterMaterial" if clusterTag then if clusterTag:IsA "Vector3Value" then - root = setupFakeTerrainPart(clusterTag.Value.X, terrainShape, clusterTag.Value.Z) + root = setupFakeTerrainPart( + clusterTag.Value.X, + terrainShape, + clusterTag.Value.Z + ) else - root = setupFakeTerrainPart(clusterTag.Value, terrainShape, 0) + root = setupFakeTerrainPart( + clusterTag.Value, + terrainShape, + 0 + ) end else root = setupFakeTerrainPart(1, terrainShape, 0) @@ -883,7 +992,13 @@ t.GetStampModel = function(assetId, terrainShape, useAssetVersionId) return root end -t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStampRegion, StampFailedFunc) +t.SetupStamperDragger = function( + modelToStamp, + Mouse, + StampInModel, + AllowedStampRegion, + StampFailedFunc +) if not modelToStamp then error "SetupStamperDragger: modelToStamp (first arg) is nil! Should be a stamper model" return nil @@ -901,9 +1016,9 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp return nil end - local stampInModel = nil - local allowedStampRegion = nil - local stampFailedFunc = nil + local stampInModel + local allowedStampRegion + local stampFailedFunc if StampInModel then if not StampInModel:IsA "Model" then error "SetupStamperDragger: StampInModel (optional third arg) is not of type 'Model'" @@ -920,8 +1035,8 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp -- Init all state variables local gInitial90DegreeRotations = 0 - local stampData = nil - local mouseTarget = nil + local stampData + local mouseTarget local errorBox = Instance.new "SelectionBox" errorBox.Color = BrickColor.new "Bright red" @@ -961,7 +1076,7 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp local stampUpLock = false local unstampableSurface = false local mouseCons = {} - local keyCon = nil + local keyCon local stamped = Instance.new "BoolValue" stamped.Archivable = false @@ -1001,7 +1116,7 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp end HighScalabilityLine.End = megaCube.CFrame.p - local line = nil + local line local line2 = Vector3.new(0, 0, 0) local line3 = Vector3.new(0, 0, 0) @@ -1050,7 +1165,10 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp -- take out any component of line2 along line1, so you get perpendicular to line1 component line2 = line2 - line.unit * line.unit:Dot(line2) - tempCFrame = CFrame.new(HighScalabilityLine.Start, HighScalabilityLine.Start + line) + tempCFrame = CFrame.new( + HighScalabilityLine.Start, + HighScalabilityLine.Start + line + ) -- then zero out whichever is the smaller component local yAxis = tempCFrame:vectorToWorldSpace(Vector3.new(0, 1, 0)) @@ -1079,22 +1197,34 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp end -- resize the "line" graphic to be the correct size and orientation - tempCFrame = CFrame.new(HighScalabilityLine.Start, HighScalabilityLine.Start + line) + tempCFrame = CFrame.new( + HighScalabilityLine.Start, + HighScalabilityLine.Start + line + ) if HighScalabilityLine.Dimensions == 1 then -- faster calculation for line - HighScalabilityLine.AdornPart.Size = Vector3.new(4, 4, line.magnitude + 4) + HighScalabilityLine.AdornPart.Size = + Vector3.new(4, 4, line.magnitude + 4) HighScalabilityLine.AdornPart.CFrame = tempCFrame - + tempCFrame:vectorToWorldSpace(Vector3.new(2, 2, 2) - HighScalabilityLine.AdornPart.Size / 2) + + tempCFrame:vectorToWorldSpace( + Vector3.new(2, 2, 2) + - HighScalabilityLine.AdornPart.Size / 2 + ) else local boxSize = tempCFrame:vectorToObjectSpace(line + line2 + line3) HighScalabilityLine.AdornPart.Size = Vector3.new(4, 4, 4) - + Vector3.new(math.abs(boxSize.X), math.abs(boxSize.Y), math.abs(boxSize.Z)) - HighScalabilityLine.AdornPart.CFrame = tempCFrame + tempCFrame:vectorToWorldSpace(boxSize / 2) + + Vector3.new( + math.abs(boxSize.X), + math.abs(boxSize.Y), + math.abs(boxSize.Z) + ) + HighScalabilityLine.AdornPart.CFrame = tempCFrame + + tempCFrame:vectorToWorldSpace(boxSize / 2) end -- make player able to see this ish - local gui = nil + local gui if game.Players["LocalPlayer"] then gui = game.Players.LocalPlayer:FindFirstChild "PlayerGui" if gui and gui:IsA "PlayerGui" then @@ -1109,7 +1239,10 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp if gui == nil then -- we are in studio gui = game:GetService "CoreGui" - if (HighScalabilityLine.Dimensions == 1 and line.magnitude > 3) or HighScalabilityLine.Dimensions > 1 then -- don't show if mouse hasn't moved enough + if + (HighScalabilityLine.Dimensions == 1 and line.magnitude > 3) + or HighScalabilityLine.Dimensions > 1 + then -- don't show if mouse hasn't moved enough HighScalabilityLine.Adorn.Parent = gui end end @@ -1121,7 +1254,11 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp return end if not Mouse:IsA "Mouse" then - error("Error: RbxStamper.DoStamperMouseMove: Mouse is of type", Mouse.className, "should be of type Mouse") + error( + "Error: RbxStamper.DoStamperMouseMove: Mouse is of type", + Mouse.className, + "should be of type Mouse" + ) return end @@ -1139,40 +1276,60 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp -- don't move with dragger - will move in one step on mouse down -- draw ghost at acceptable positions - configFound, targetCFrame, targetSurface = findConfigAtMouseTarget(Mouse, stampData) + configFound, targetCFrame, targetSurface = + findConfigAtMouseTarget(Mouse, stampData) if not configFound then error "RbxStamper.DoStamperMouseMove No configFound, returning" return end local numRotations = 0 -- update this according to how many rotations you need to get it to target surface - if autoAlignToFace(stampData.CurrentParts) and targetSurface ~= 1 and targetSurface ~= 4 then -- pre-rotate the flag or portrait so it's aligned correctly + if + autoAlignToFace(stampData.CurrentParts) + and targetSurface ~= 1 + and targetSurface ~= 4 + then -- pre-rotate the flag or portrait so it's aligned correctly if targetSurface == 3 then - numRotations = 0 - gInitial90DegreeRotations + autoAlignToFace(stampData.CurrentParts) + numRotations = 0 + - gInitial90DegreeRotations + + autoAlignToFace(stampData.CurrentParts) elseif targetSurface == 0 then - numRotations = 2 - gInitial90DegreeRotations + autoAlignToFace(stampData.CurrentParts) + numRotations = 2 + - gInitial90DegreeRotations + + autoAlignToFace(stampData.CurrentParts) elseif targetSurface == 5 then - numRotations = 3 - gInitial90DegreeRotations + autoAlignToFace(stampData.CurrentParts) + numRotations = 3 + - gInitial90DegreeRotations + + autoAlignToFace(stampData.CurrentParts) elseif targetSurface == 2 then - numRotations = 1 - gInitial90DegreeRotations + autoAlignToFace(stampData.CurrentParts) + numRotations = 1 + - gInitial90DegreeRotations + + autoAlignToFace(stampData.CurrentParts) end end local ry = math.pi / 2 gInitial90DegreeRotations = gInitial90DegreeRotations + numRotations - if stampData.CurrentParts:IsA "Model" or stampData.CurrentParts:IsA "Tool" then + if + stampData.CurrentParts:IsA "Model" + or stampData.CurrentParts:IsA "Tool" + then --stampData.CurrentParts:Rotate(0, ry*numRotations, 0) modelRotate(stampData.CurrentParts, ry * numRotations) else - stampData.CurrentParts.CFrame = CFrame.fromEulerAnglesXYZ(0, ry * numRotations, 0) - * stampData.CurrentParts.CFrame + stampData.CurrentParts.CFrame = CFrame.fromEulerAnglesXYZ( + 0, + ry * numRotations, + 0 + ) * stampData.CurrentParts.CFrame end -- CODE TO CHECK FOR DRAGGING GHOST PART INTO A COLLIDING STATE - local minBB, maxBB = getBoundingBoxInWorldCoordinates(stampData.CurrentParts) + local minBB, maxBB = + getBoundingBoxInWorldCoordinates(stampData.CurrentParts) -- need to offset by distance to be dragged - local currModelCFrame = nil + local currModelCFrame if stampData.CurrentParts:IsA "Model" then currModelCFrame = stampData.CurrentParts:GetModelCFrame() else @@ -1183,12 +1340,30 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp maxBB = maxBB + targetCFrame.p - currModelCFrame.p -- don't drag into terrain - if clusterPartsInRegion(minBB + insertBoundingBoxOverlapVector, maxBB - insertBoundingBoxOverlapVector) then + if + clusterPartsInRegion( + minBB + insertBoundingBoxOverlapVector, + maxBB - insertBoundingBoxOverlapVector + ) + then if lastTarget.CFrame then - if stampData.CurrentParts:FindFirstChild("ClusterMaterial", true) then - local theClusterMaterial = stampData.CurrentParts:FindFirstChild("ClusterMaterial", true) + if + stampData.CurrentParts:FindFirstChild( + "ClusterMaterial", + true + ) + then + local theClusterMaterial = + stampData.CurrentParts:FindFirstChild( + "ClusterMaterial", + true + ) if theClusterMaterial:IsA "Vector3Value" then - local stampClusterMaterial = stampData.CurrentParts:FindFirstChild("ClusterMaterial", true) + local stampClusterMaterial = + stampData.CurrentParts:FindFirstChild( + "ClusterMaterial", + true + ) if stampClusterMaterial then stampClusterMaterial = clusterMat end @@ -1200,10 +1375,15 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp -- if we are stamping a terrain part, make sure it goes on the grid! Otherwise preview block could be placed off grid, but stamped on grid if isMegaClusterPart() then - local cellToStamp = game.Workspace.Terrain:WorldToCell(targetCFrame.p) - local newCFramePosition = - game.Workspace.Terrain:CellCenterToWorld(cellToStamp.X, cellToStamp.Y, cellToStamp.Z) - local _, _, _, R00, R01, R02, R10, R11, R12, R20, R21, R22 = targetCFrame:components() + local cellToStamp = + game.Workspace.Terrain:WorldToCell(targetCFrame.p) + local newCFramePosition = game.Workspace.Terrain:CellCenterToWorld( + cellToStamp.X, + cellToStamp.Y, + cellToStamp.Z + ) + local _, _, _, R00, R01, R02, R10, R11, R12, R20, R21, R22 = + targetCFrame:components() targetCFrame = CFrame.new( newCFramePosition.X, newCFramePosition.Y, @@ -1223,7 +1403,8 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp positionPartsAtCFrame3(targetCFrame, stampData.CurrentParts) lastTarget.CFrame = targetCFrame -- successful positioning, so update 'dat cframe if stampData.CurrentParts:FindFirstChild("ClusterMaterial", true) then - local clusterMat = stampData.CurrentParts:FindFirstChild("ClusterMaterial", true) + local clusterMat = + stampData.CurrentParts:FindFirstChild("ClusterMaterial", true) if clusterMat:IsA "Vector3Value" then lastTarget.TerrainOrientation = clusterMat.Value.Z end @@ -1236,13 +1417,17 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp modelInfo = Mouse.Target.Parent:FindFirstChild "RobloxModel" end - local myModelInfo = stampData.CurrentParts:FindFirstChild "UnstampableFaces" + local myModelInfo = + stampData.CurrentParts:FindFirstChild "UnstampableFaces" --if (modelInfo and modelInfo.Parent:FindFirstChild("UnstampableFaces")) or (modelInfo and myModelInfo) then -- need better targetSurface calcs if true then local breakingFaces = "" local myBreakingFaces = "" - if modelInfo and modelInfo.Parent:FindFirstChild "UnstampableFaces" then + if + modelInfo + and modelInfo.Parent:FindFirstChild "UnstampableFaces" + then breakingFaces = modelInfo.Parent.UnstampableFaces.Value end if myModelInfo then @@ -1296,7 +1481,12 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp -- most common mouse inactive error occurs here, so check mouse active one more time in a pcall if not pcall(function() - if Mouse and Mouse.Target and Mouse.Target.Parent:FindFirstChild "RobloxModel" == nil then + if + Mouse + and Mouse.Target + and Mouse.Target.Parent:FindFirstChild "RobloxModel" + == nil + then return else return @@ -1309,7 +1499,11 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp return end - if Mouse and Mouse.Target and Mouse.Target.Parent:FindFirstChild "RobloxModel" == nil then + if + Mouse + and Mouse.Target + and Mouse.Target.Parent:FindFirstChild "RobloxModel" == nil + then game.JointsService:SetJoinAfterMoveTarget(Mouse.Target) else game.JointsService:SetJoinAfterMoveTarget(nil) @@ -1317,7 +1511,11 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp game.JointsService:ShowPermissibleJoints() -- here we allow for a line of high-scalability parts - if isMegaClusterPart() and HighScalabilityLine and HighScalabilityLine.Start then + if + isMegaClusterPart() + and HighScalabilityLine + and HighScalabilityLine.Start + then DoHighScalabilityRegionSelect() end end @@ -1332,23 +1530,35 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp gInitial90DegreeRotations = gInitial90DegreeRotations + 1 -- Update orientation value if this is a fake terrain part - local clusterValues = stampData.CurrentParts:FindFirstChild("ClusterMaterial", true) + local clusterValues = + stampData.CurrentParts:FindFirstChild("ClusterMaterial", true) if clusterValues and clusterValues:IsA "Vector3Value" then - clusterValues.Value = - Vector3.new(clusterValues.Value.X, clusterValues.Value.Y, (clusterValues.Value.Z + 1) % 4) + clusterValues.Value = Vector3.new( + clusterValues.Value.X, + clusterValues.Value.Y, + (clusterValues.Value.Z + 1) % 4 + ) end -- Rotate the parts or all the parts in the model local ry = math.pi / 2 - if stampData.CurrentParts:IsA "Model" or stampData.CurrentParts:IsA "Tool" then + if + stampData.CurrentParts:IsA "Model" + or stampData.CurrentParts:IsA "Tool" + then --stampData.CurrentParts:Rotate(0, ry, 0) modelRotate(stampData.CurrentParts, ry) else - stampData.CurrentParts.CFrame = CFrame.fromEulerAnglesXYZ(0, ry, 0) * stampData.CurrentParts.CFrame + stampData.CurrentParts.CFrame = CFrame.fromEulerAnglesXYZ( + 0, + ry, + 0 + ) * stampData.CurrentParts.CFrame end -- After rotating, update the position - configFound, targetCFrame = findConfigAtMouseTarget(Mouse, stampData) + configFound, targetCFrame = + findConfigAtMouseTarget(Mouse, stampData) if configFound then positionPartsAtCFrame3(targetCFrame, stampData.CurrentParts) @@ -1361,17 +1571,22 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp and HighScalabilityLine.InternalLine.magnitude > 0 and HighScalabilityLine.Dimensions < 3 then - HighScalabilityLine.MorePoints[HighScalabilityLine.Dimensions] = HighScalabilityLine.End - HighScalabilityLine.MoreLines[HighScalabilityLine.Dimensions] = HighScalabilityLine.InternalLine - HighScalabilityLine.Dimensions = HighScalabilityLine.Dimensions + 1 + HighScalabilityLine.MorePoints[HighScalabilityLine.Dimensions] = + HighScalabilityLine.End + HighScalabilityLine.MoreLines[HighScalabilityLine.Dimensions] = + HighScalabilityLine.InternalLine + HighScalabilityLine.Dimensions = HighScalabilityLine.Dimensions + + 1 HighScalabilityLine.NewHint = true end end end - keyCon = Mouse.KeyDown:connect(function(key) -- init key connection (keeping code close to func) - setupKeyListener(key, Mouse) - end) + keyCon = Mouse.KeyDown:connect( + function(key) -- init key connection (keeping code close to func) + setupKeyListener(key, Mouse) + end + ) local function resetHighScalabilityLine() if HighScalabilityLine then @@ -1426,7 +1641,11 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp return end if not Mouse:IsA "Mouse" then - error("Error: RbxStamper.DoStamperMouseDown: Mouse is of type", Mouse.className, "should be of type Mouse") + error( + "Error: RbxStamper.DoStamperMouseDown: Mouse is of type", + Mouse.className, + "should be of type Mouse" + ) return end if not stampData then @@ -1435,17 +1654,29 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp if isMegaClusterPart() then if Mouse and HighScalabilityLine then - local megaCube = stampData.CurrentParts:FindFirstChild("MegaClusterCube", true) + local megaCube = stampData.CurrentParts:FindFirstChild( + "MegaClusterCube", + true + ) local terrain = game.Workspace.Terrain if megaCube then HighScalabilityLine.Dimensions = 1 local tempCell = terrain:WorldToCell(megaCube.CFrame.p) - HighScalabilityLine.Start = terrain:CellCenterToWorld(tempCell.X, tempCell.Y, tempCell.Z) + HighScalabilityLine.Start = terrain:CellCenterToWorld( + tempCell.X, + tempCell.Y, + tempCell.Z + ) return else HighScalabilityLine.Dimensions = 1 - local tempCell = terrain:WorldToCell(stampData.CurrentParts.CFrame.p) - HighScalabilityLine.Start = terrain:CellCenterToWorld(tempCell.X, tempCell.Y, tempCell.Z) + local tempCell = + terrain:WorldToCell(stampData.CurrentParts.CFrame.p) + HighScalabilityLine.Start = terrain:CellCenterToWorld( + tempCell.X, + tempCell.Y, + tempCell.Z + ) return end end @@ -1509,12 +1740,14 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp for _, script in pairs(scripts) do if not script.Disabled then script.Disabled = true - stampData.DisabledScripts[#stampData.DisabledScripts + 1] = script + stampData.DisabledScripts[#stampData.DisabledScripts + 1] = + script end end for _, part in pairs(parts) do stampData.TransparencyTable[part] = part.Transparency - part.Transparency = gStaticTrans + (1 - gStaticTrans) * part.Transparency + part.Transparency = gStaticTrans + + (1 - gStaticTrans) * part.Transparency stampData.MaterialTable[part] = part.Material part.Material = Enum.Material.Plastic stampData.CanCollideTable[part] = part.CanCollide @@ -1539,16 +1772,30 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp and part:IsA "BasePart" and part.Transparency > gDesiredTrans do - local newTrans = 1 - (((currTime - begTime) / transFadeInTime) * (gStaticTrans - gDesiredTrans)) - if stampData["TransparencyTable"] and stampData.TransparencyTable[part] then - part.Transparency = newTrans + (1 - newTrans) * stampData.TransparencyTable[part] + local newTrans = 1 + - ( + ((currTime - begTime) / transFadeInTime) + * (gStaticTrans - gDesiredTrans) + ) + if + stampData["TransparencyTable"] + and stampData.TransparencyTable[part] + then + part.Transparency = newTrans + + (1 - newTrans) + * stampData.TransparencyTable[part] end wait(0.03) currTime = tick() end if part and part:IsA "BasePart" then - if stampData["TransparencyTable"] and stampData.TransparencyTable[part] then - part.Transparency = gDesiredTrans + (1 - gDesiredTrans) * stampData.TransparencyTable[part] + if + stampData["TransparencyTable"] + and stampData.TransparencyTable[part] + then + part.Transparency = gDesiredTrans + + (1 - gDesiredTrans) + * stampData.TransparencyTable[part] end end end) @@ -1556,7 +1803,8 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp for _, decal in pairs(decals) do stampData.DecalTransparencyTable[decal] = decal.Transparency - decal.Transparency = gDesiredTrans + (1 - gDesiredTrans) * decal.Transparency + decal.Transparency = gDesiredTrans + + (1 - gDesiredTrans) * decal.Transparency end -- disable all seats @@ -1571,11 +1819,18 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp gInitial90DegreeRotations = 0 else -- pre-rotate if necessary local ry = gInitial90DegreeRotations * math.pi / 2 - if stampData.CurrentParts:IsA "Model" or stampData.CurrentParts:IsA "Tool" then + if + stampData.CurrentParts:IsA "Model" + or stampData.CurrentParts:IsA "Tool" + then --stampData.CurrentParts:Rotate(0, ry, 0) modelRotate(stampData.CurrentParts, ry) else - stampData.CurrentParts.CFrame = CFrame.fromEulerAnglesXYZ(0, ry, 0) * stampData.CurrentParts.CFrame + stampData.CurrentParts.CFrame = CFrame.fromEulerAnglesXYZ( + 0, + ry, + 0 + ) * stampData.CurrentParts.CFrame end end @@ -1583,7 +1838,8 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp -- rotations we expect since then [either that or we need to store the just-stamped clusterMaterial.Value.Z somewhere]. This should fix the terrain rotation -- issue (fingers crossed) [HotThoth] - local clusterMaterial = stampData.CurrentParts:FindFirstChild("ClusterMaterial", true) + local clusterMaterial = + stampData.CurrentParts:FindFirstChild("ClusterMaterial", true) if clusterMaterial and clusterMaterial:IsA "Vector3Value" then clusterMaterial.Value = Vector3.new( clusterMaterial.Value.X, @@ -1593,9 +1849,11 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp end -- After rotating, update the position - local configFound, targetCFrame = findConfigAtMouseTarget(Mouse, stampData) + local configFound, targetCFrame = + findConfigAtMouseTarget(Mouse, stampData) if configFound then - stampData.CurrentParts = positionPartsAtCFrame3(targetCFrame, stampData.CurrentParts) + stampData.CurrentParts = + positionPartsAtCFrame3(targetCFrame, stampData.CurrentParts) end -- to show joints during the mouse move @@ -1604,13 +1862,25 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp return clone, parts end - local function checkTerrainBlockCollisions(cellPos, checkHighScalabilityStamp) + local function checkTerrainBlockCollisions( + cellPos, + checkHighScalabilityStamp + ) local cellCenterToWorld = game.Workspace.Terrain.CellCenterToWorld - local cellCenter = cellCenterToWorld(game.Workspace.Terrain, cellPos.X, cellPos.Y, cellPos.Z) + local cellCenter = cellCenterToWorld( + game.Workspace.Terrain, + cellPos.X, + cellPos.Y, + cellPos.Z + ) local cellBlockingParts = game.Workspace:FindPartsInRegion3( Region3.new( - cellCenter - Vector3.new(2, 2, 2) + insertBoundingBoxOverlapVector, - cellCenter + Vector3.new(2, 2, 2) - insertBoundingBoxOverlapVector + cellCenter + - Vector3.new(2, 2, 2) + + insertBoundingBoxOverlapVector, + cellCenter + + Vector3.new(2, 2, 2) + - insertBoundingBoxOverlapVector ), stampData.CurrentParts, 100 @@ -1634,18 +1904,31 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp cellBlockingParts[b].Parent and not alreadyPushedUp[cellBlockingParts[b].Parent] and cellBlockingParts[b].Parent:FindFirstChild "Humanoid" - and cellBlockingParts[b].Parent:FindFirstChild("Humanoid"):IsA "Humanoid" + and cellBlockingParts[b].Parent + :FindFirstChild("Humanoid") + :IsA "Humanoid" then ----------------------------------------------------------------------------------- - local blockingPersonTorso = cellBlockingParts[b].Parent:FindFirstChild "Torso" + local blockingPersonTorso = + cellBlockingParts[b].Parent:FindFirstChild "Torso" alreadyPushedUp[cellBlockingParts[b].Parent] = true if blockingPersonTorso then -- if so, let's push the person upwards so they pop on top of the stamped model/part (but only if there's space above them) local newY = cellCenter.Y + 5 - if spaceAboveCharacter(blockingPersonTorso, newY, stampData) then + if + spaceAboveCharacter( + blockingPersonTorso, + newY, + stampData + ) + then blockingPersonTorso.CFrame = blockingPersonTorso.CFrame - + Vector3.new(0, newY - blockingPersonTorso.CFrame.p.Y, 0) + + Vector3.new( + 0, + newY - blockingPersonTorso.CFrame.p.Y, + 0 + ) else -- if no space, we just skip this one skipThisCell = true @@ -1662,14 +1945,27 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp if checkHighScalabilityStamp then -- check to see if cell is in region, if not we'll skip set if allowedStampRegion then - local cellPos = cellCenterToWorld(game.Workspace.Terrain, cellPos.X, cellPos.Y, cellPos.Z) + local cellPos = cellCenterToWorld( + game.Workspace.Terrain, + cellPos.X, + cellPos.Y, + cellPos.Z + ) if - (cellPos.X + 2 > allowedStampRegion.CFrame.p.X + allowedStampRegion.Size.X / 2) + ( + cellPos.X + 2 + > allowedStampRegion.CFrame.p.X + + allowedStampRegion.Size.X / 2 + ) or (cellPos.X - 2 < allowedStampRegion.CFrame.p.X - allowedStampRegion.Size.X / 2) or (cellPos.Y + 2 > allowedStampRegion.CFrame.p.Y + allowedStampRegion.Size.Y / 2) or (cellPos.Y - 2 < allowedStampRegion.CFrame.p.Y - allowedStampRegion.Size.Y / 2) or (cellPos.Z + 2 > allowedStampRegion.CFrame.p.Z + allowedStampRegion.Size.Z / 2) - or (cellPos.Z - 2 < allowedStampRegion.CFrame.p.Z - allowedStampRegion.Size.Z / 2) + or ( + cellPos.Z - 2 + < allowedStampRegion.CFrame.p.Z + - allowedStampRegion.Size.Z / 2 + ) then canSetCell = false end @@ -1700,7 +1996,8 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp end if stampData.CurrentParts:FindFirstChild("ClusterMaterial", true) then - clusterMaterial = stampData.CurrentParts:FindFirstChild("ClusterMaterial", true) + clusterMaterial = + stampData.CurrentParts:FindFirstChild("ClusterMaterial", true) if clusterMaterial:IsA "Vector3Value" then clusterType = clusterMaterial.Value.Y clusterOrientation = clusterMaterial.Value.Z @@ -1713,17 +2010,29 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp if HighScalabilityLine.Adorn.Parent and HighScalabilityLine.Start - and ((HighScalabilityLine.Dimensions > 1) or (line and line.magnitude > 0)) + and ( + (HighScalabilityLine.Dimensions > 1) + or (line and line.magnitude > 0) + ) then - local startCell = game.Workspace.Terrain:WorldToCell(HighScalabilityLine.Start) + local startCell = + game.Workspace.Terrain:WorldToCell(HighScalabilityLine.Start) local xInc = { 0, 0, 0 } local yInc = { 0, 0, 0 } local zInc = { 0, 0, 0 } local incrementVect = { nil, nil, nil } - local stepVect = { Vector3.new(0, 0, 0), Vector3.new(0, 0, 0), Vector3.new(0, 0, 0) } + local stepVect = { + Vector3.new(0, 0, 0), + Vector3.new(0, 0, 0), + Vector3.new(0, 0, 0), + } - local worldAxes = { Vector3.new(1, 0, 0), Vector3.new(0, 1, 0), Vector3.new(0, 0, 1) } + local worldAxes = { + Vector3.new(1, 0, 0), + Vector3.new(0, 1, 0), + Vector3.new(0, 0, 1), + } local lines = {} if HighScalabilityLine.Dimensions > 1 then @@ -1772,8 +2081,13 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp lines[3] = Vector3.new(0, 0, 0) end - local waterForceTag = stampData.CurrentParts:FindFirstChild("WaterForceTag", true) - local waterForceDirectionTag = stampData.CurrentParts:FindFirstChild("WaterForceDirectionTag", true) + local waterForceTag = + stampData.CurrentParts:FindFirstChild("WaterForceTag", true) + local waterForceDirectionTag = + stampData.CurrentParts:FindFirstChild( + "WaterForceDirectionTag", + true + ) while stepVect[3].magnitude * 4 <= lines[3].magnitude do local outerStepVectIndex = 1 @@ -1783,8 +2097,12 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp local innerStepVectIndex = 1 while innerStepVectIndex < 4 do stepVect[1] = Vector3.new(0, 0, 0) - while stepVect[1].magnitude * 4 <= lines[1].magnitude do - local stepVectSum = stepVect[1] + stepVect[2] + stepVect[3] + while + stepVect[1].magnitude * 4 <= lines[1].magnitude + do + local stepVectSum = stepVect[1] + + stepVect[2] + + stepVect[3] local cellPos = Vector3int16.new( startCell.X + stepVectSum.X, startCell.Y + stepVectSum.Y, @@ -1800,7 +2118,10 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp then -- check if overlaps player or part local okToStampTerrainBlock = - checkTerrainBlockCollisions(cellPos, checkHighScalabilityStamp) + checkTerrainBlockCollisions( + cellPos, + checkHighScalabilityStamp + ) if okToStampTerrainBlock then if waterForceTag then @@ -1827,8 +2148,16 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp if autoWedgeClusterParts then game.Workspace.Terrain:AutowedgeCells( Region3int16.new( - Vector3int16.new(cellPos.x - 1, cellPos.y - 1, cellPos.z - 1), - Vector3int16.new(cellPos.x + 1, cellPos.y + 1, cellPos.z + 1) + Vector3int16.new( + cellPos.x - 1, + cellPos.y - 1, + cellPos.z - 1 + ), + Vector3int16.new( + cellPos.x + 1, + cellPos.y + 1, + cellPos.z + 1 + ) ) ) end @@ -1839,33 +2168,48 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp if incrementVect[2] then while innerStepVectIndex < 4 - and worldAxes[innerStepVectIndex]:Dot(incrementVect[2]) == 0 + and worldAxes[innerStepVectIndex]:Dot( + incrementVect[2] + ) + == 0 do innerStepVectIndex = innerStepVectIndex + 1 end if innerStepVectIndex < 4 then stepVect[2] = stepVect[2] + worldAxes[innerStepVectIndex] - * worldAxes[innerStepVectIndex]:Dot(incrementVect[2]) + * worldAxes[innerStepVectIndex]:Dot( + incrementVect[2] + ) end innerStepVectIndex = innerStepVectIndex + 1 else stepVect[2] = Vector3.new(1, 0, 0) innerStepVectIndex = 4 -- skip all remaining loops end - if stepVect[2].magnitude * 4 > lines[2].magnitude then + if + stepVect[2].magnitude * 4 > lines[2].magnitude + then innerStepVectIndex = 4 end end end if incrementVect[3] then - while outerStepVectIndex < 4 and worldAxes[outerStepVectIndex]:Dot(incrementVect[3]) == 0 do + while + outerStepVectIndex < 4 + and worldAxes[outerStepVectIndex]:Dot( + incrementVect[3] + ) + == 0 + do outerStepVectIndex = outerStepVectIndex + 1 end if outerStepVectIndex < 4 then stepVect[3] = stepVect[3] + worldAxes[outerStepVectIndex] - * worldAxes[outerStepVectIndex]:Dot(incrementVect[3]) + * worldAxes[outerStepVectIndex]:Dot( + incrementVect[3] + ) end outerStepVectIndex = outerStepVectIndex + 1 else -- skip all remaining loops @@ -1887,7 +2231,8 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp if cellSet then stampData.CurrentParts.Parent = nil pcall(function() - game:GetService("ChangeHistoryService"):SetWaypoint "StamperMulti" + game:GetService("ChangeHistoryService") + :SetWaypoint "StamperMulti" end) end @@ -1900,7 +2245,11 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp return false end if not Mouse:IsA "Mouse" then - error("Error: RbxStamper.DoStamperMouseUp: Mouse is of type", Mouse.className, "should be of type Mouse") + error( + "Error: RbxStamper.DoStamperMouseUp: Mouse is of type", + Mouse.className, + "should be of type Mouse" + ) return false end @@ -1913,9 +2262,9 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp return false end - local checkHighScalabilityStamp = nil + local checkHighScalabilityStamp if stampInModel then - local canStamp = nil + local canStamp local isHSLPart = isMegaClusterPart() if @@ -1928,7 +2277,8 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp canStamp = true checkHighScalabilityStamp = true else - canStamp, checkHighScalabilityStamp = t.CanEditRegion(stampData.CurrentParts, allowedStampRegion) + canStamp, checkHighScalabilityStamp = + t.CanEditRegion(stampData.CurrentParts, allowedStampRegion) end if not canStamp then @@ -1946,7 +2296,8 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp end -- recheck if we can stamp, as we just moved part - canStamp, checkHighScalabilityStamp = t.CanEditRegion(stampData.CurrentParts, allowedStampRegion) + canStamp, checkHighScalabilityStamp = + t.CanEditRegion(stampData.CurrentParts, allowedStampRegion) if not canStamp then if stampFailedFunc then stampFailedFunc() @@ -1956,7 +2307,8 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp -- Prevent part from being stamped on top of a player - local minBB, maxBB = getBoundingBoxInWorldCoordinates(stampData.CurrentParts) + local minBB, maxBB = + getBoundingBoxInWorldCoordinates(stampData.CurrentParts) -- HotThoth's note: Now that above CurrentParts positioning has been commented out, to be truly correct, we would need to use the -- value of configFound from the previous onStamperMouseMove call which moved the CurrentParts @@ -1964,13 +2316,21 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp configFound, targetCFrame = findConfigAtMouseTarget(Mouse, stampData) if configFound and not HighScalabilityLine.Adorn.Parent then - if clusterPartsInRegion(minBB + insertBoundingBoxOverlapVector, maxBB - insertBoundingBoxOverlapVector) then + if + clusterPartsInRegion( + minBB + insertBoundingBoxOverlapVector, + maxBB - insertBoundingBoxOverlapVector + ) + then flashRedBox() return false end local blockingParts = game.Workspace:FindPartsInRegion3( - Region3.new(minBB + insertBoundingBoxOverlapVector, maxBB - insertBoundingBoxOverlapVector), + Region3.new( + minBB + insertBoundingBoxOverlapVector, + maxBB - insertBoundingBoxOverlapVector + ), stampData.CurrentParts, 100 ) @@ -1989,18 +2349,31 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp blockingParts[b].Parent and not alreadyPushedUp[blockingParts[b].Parent] and blockingParts[b].Parent:FindFirstChild "Humanoid" - and blockingParts[b].Parent:FindFirstChild("Humanoid"):IsA "Humanoid" + and blockingParts[b].Parent + :FindFirstChild("Humanoid") + :IsA "Humanoid" then --------------------------------------------------------------------------- - local blockingPersonTorso = blockingParts[b].Parent:FindFirstChild "Torso" + local blockingPersonTorso = + blockingParts[b].Parent:FindFirstChild "Torso" alreadyPushedUp[blockingParts[b].Parent] = true if blockingPersonTorso then -- if so, let's push the person upwards so they pop on top of the stamped model/part (but only if there's space above them) local newY = maxBB.Y + 3 - if spaceAboveCharacter(blockingPersonTorso, newY, stampData) then + if + spaceAboveCharacter( + blockingPersonTorso, + newY, + stampData + ) + then blockingPersonTorso.CFrame = blockingPersonTorso.CFrame - + Vector3.new(0, newY - blockingPersonTorso.CFrame.p.Y, 0) + + Vector3.new( + 0, + newY - blockingPersonTorso.CFrame.p.Y, + 0 + ) else -- if no space, we just error flashRedBox() @@ -2010,7 +2383,12 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp --------------------------------------------------------------------------- end end - elseif (not configFound) and not (HighScalabilityLine.Start and HighScalabilityLine.Adorn.Parent) then -- if no config then only stamp if it's a real HSL! + elseif + not configFound + and not ( + HighScalabilityLine.Start and HighScalabilityLine.Adorn.Parent + ) + then -- if no config then only stamp if it's a real HSL! resetHighScalabilityLine() return false end @@ -2029,8 +2407,15 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp end -- if we drew a line of mega parts, stamp them out - if HighScalabilityLine.Start and HighScalabilityLine.Adorn.Parent and isMegaClusterPart() then - if ResolveMegaClusterStamp(checkHighScalabilityStamp) or checkHighScalabilityStamp then + if + HighScalabilityLine.Start + and HighScalabilityLine.Adorn.Parent + and isMegaClusterPart() + then + if + ResolveMegaClusterStamp(checkHighScalabilityStamp) + or checkHighScalabilityStamp + then -- kill the ghost part stampData.CurrentParts.Parent = nil return true @@ -2050,7 +2435,9 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp local cellPos if stampData.CurrentParts:IsA "Model" then - cellPos = cluster:WorldToCell(stampData.CurrentParts:GetModelCFrame().p) + cellPos = cluster:WorldToCell( + stampData.CurrentParts:GetModelCFrame().p + ) else cellPos = cluster:WorldToCell(stampData.CurrentParts.CFrame.p) end @@ -2059,9 +2446,17 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp local cMin = game.Workspace.Terrain.MaxExtents.Min if checkTerrainBlockCollisions(cellPos, false) then - local clusterValues = stampData.CurrentParts:FindFirstChild("ClusterMaterial", true) - local waterForceTag = stampData.CurrentParts:FindFirstChild("WaterForceTag", true) - local waterForceDirectionTag = stampData.CurrentParts:FindFirstChild("WaterForceDirectionTag", true) + local clusterValues = stampData.CurrentParts:FindFirstChild( + "ClusterMaterial", + true + ) + local waterForceTag = + stampData.CurrentParts:FindFirstChild("WaterForceTag", true) + local waterForceDirectionTag = + stampData.CurrentParts:FindFirstChild( + "WaterForceDirectionTag", + true + ) if cellPos.X >= cMin.X @@ -2098,7 +2493,14 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp clusterValues.Value.Z ) else - cluster:SetCell(cellPos.X, cellPos.Y, cellPos.Z, clusterValues.Value, 0, 0) + cluster:SetCell( + cellPos.X, + cellPos.Y, + cellPos.Z, + clusterValues.Value, + 0, + 0 + ) end local autoWedgeClusterParts = false @@ -2110,8 +2512,16 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp if autoWedgeClusterParts then game.Workspace.Terrain:AutowedgeCells( Region3int16.new( - Vector3int16.new(cellPos.x - 1, cellPos.y - 1, cellPos.z - 1), - Vector3int16.new(cellPos.x + 1, cellPos.y + 1, cellPos.z + 1) + Vector3int16.new( + cellPos.x - 1, + cellPos.y - 1, + cellPos.z - 1 + ), + Vector3int16.new( + cellPos.x + 1, + cellPos.y + 1, + cellPos.z + 1 + ) ) ) end @@ -2121,7 +2531,8 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp -- Mark for undo. It has to happen here or the selection display will come back also. pcall(function() - game:GetService("ChangeHistoryService"):SetWaypoint "StamperSingle" + game:GetService("ChangeHistoryService") + :SetWaypoint "StamperSingle" end) return true end @@ -2142,12 +2553,19 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp end -- Post process: after positioning the part or model, restore transparency, material, anchored and collide states and create joints - if stampData.CurrentParts:IsA "Model" or stampData.CurrentParts:IsA "Tool" then + if + stampData.CurrentParts:IsA "Model" + or stampData.CurrentParts:IsA "Tool" + then if stampData.CurrentParts:IsA "Model" then -- Tyler's magical hack-code for allowing/preserving clones of both Surface and Manual Welds... just don't ask X< local manualWeldTable = {} local manualWeldParentTable = {} - saveTheWelds(stampData.CurrentParts, manualWeldTable, manualWeldParentTable) + saveTheWelds( + stampData.CurrentParts, + manualWeldTable, + manualWeldParentTable + ) stampData.CurrentParts:BreakJoints() stampData.CurrentParts:MakeJoints() restoreTheWelds(manualWeldTable, manualWeldParentTable) @@ -2155,7 +2573,8 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp -- if it's a model, we also want to fill in the playerID and playerName tags, if it has those (e.g. for the friend-only door) playerIdTag = stampData.CurrentParts:FindFirstChild "PlayerIdTag" - playerNameTag = stampData.CurrentParts:FindFirstChild "PlayerNameTag" + playerNameTag = + stampData.CurrentParts:FindFirstChild "PlayerNameTag" if playerIdTag ~= nil then tempPlayerValue = getPlayer() if tempPlayerValue ~= nil then @@ -2163,7 +2582,10 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp end end if playerNameTag ~= nil then - if game:FindFirstChild "Players" and game.Players["LocalPlayer"] then + if + game:FindFirstChild "Players" + and game.Players["LocalPlayer"] + then tempPlayerValue = game.Players.LocalPlayer if tempPlayerValue ~= nil then playerNameTag.Value = tempPlayerValue.Name @@ -2177,7 +2599,9 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp stringTag.Name = "RobloxModel" stringTag.Parent = stampData.CurrentParts - if stampData.CurrentParts:FindFirstChild "RobloxStamper" == nil then + if + stampData.CurrentParts:FindFirstChild "RobloxStamper" == nil + then local stringTag2 = Instance.new "BoolValue" stringTag2.Name = "RobloxStamper" stringTag2.Parent = stampData.CurrentParts @@ -2289,21 +2713,30 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp end local function prepareUnjoinableSurfaces(modelCFrame, parts, whichSurface) - local AXIS_VECTORS = { Vector3.new(1, 0, 0), Vector3.new(0, 1, 0), Vector3.new(0, 0, 1) } -- maybe last one is negative? TODO: check this! + local AXIS_VECTORS = + { Vector3.new(1, 0, 0), Vector3.new(0, 1, 0), Vector3.new(0, 0, 1) } -- maybe last one is negative? TODO: check this! local isPositive = 1 if whichSurface < 0 then isPositive = isPositive * -1 whichSurface = whichSurface * -1 end - local surfaceNormal = isPositive * modelCFrame:vectorToWorldSpace(AXIS_VECTORS[whichSurface]) + local surfaceNormal = isPositive + * modelCFrame:vectorToWorldSpace(AXIS_VECTORS[whichSurface]) for i = 1, #parts do local currPart = parts[i] -- now just need to find which surface of currPart most closely match surfaceNormal and then set that to Unjoinable - local surfaceNormalInLocalCoords = currPart.CFrame:vectorToObjectSpace(surfaceNormal) - if math.abs(surfaceNormalInLocalCoords.X) > math.abs(surfaceNormalInLocalCoords.Y) then - if math.abs(surfaceNormalInLocalCoords.X) > math.abs(surfaceNormalInLocalCoords.Z) then + local surfaceNormalInLocalCoords = + currPart.CFrame:vectorToObjectSpace(surfaceNormal) + if + math.abs(surfaceNormalInLocalCoords.X) + > math.abs(surfaceNormalInLocalCoords.Y) + then + if + math.abs(surfaceNormalInLocalCoords.X) + > math.abs(surfaceNormalInLocalCoords.Z) + then if surfaceNormalInLocalCoords.X > 0 then currPart.RightSurface = "Unjoinable" else @@ -2317,7 +2750,10 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp end end else - if math.abs(surfaceNormalInLocalCoords.Y) > math.abs(surfaceNormalInLocalCoords.Z) then + if + math.abs(surfaceNormalInLocalCoords.Y) + > math.abs(surfaceNormalInLocalCoords.Z) + then if surfaceNormalInLocalCoords.Y > 0 then currPart.TopSurface = "Unjoinable" else @@ -2347,9 +2783,17 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp for unjoinableSurface in string.gmatch(unjoinableTag.Value, "[^,]*") do if tonumber(unjoinableSurface) then if clone:IsA "Model" then - prepareUnjoinableSurfaces(clone:GetModelCFrame(), parts, tonumber(unjoinableSurface)) + prepareUnjoinableSurfaces( + clone:GetModelCFrame(), + parts, + tonumber(unjoinableSurface) + ) else - prepareUnjoinableSurfaces(clone.CFrame, parts, tonumber(unjoinableSurface)) + prepareUnjoinableSurfaces( + clone.CFrame, + parts, + tonumber(unjoinableSurface) + ) end end end @@ -2377,7 +2821,10 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp mouseTarget = Mouse.Target end) - if mouseTarget and mouseTarget.Parent:FindFirstChild "RobloxModel" == nil then + if + mouseTarget + and mouseTarget.Parent:FindFirstChild "RobloxModel" == nil + then game.JointsService:SetJoinAfterMoveTarget(mouseTarget) else game.JointsService:SetJoinAfterMoveTarget(nil) @@ -2436,7 +2883,10 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp local function resetStamperState(newModelToStamp) -- if we have a new model, swap it out if newModelToStamp then - if not newModelToStamp:IsA "Model" and not newModelToStamp:IsA "BasePart" then + if + not newModelToStamp:IsA "Model" + and not newModelToStamp:IsA "BasePart" + then error "resetStamperState: newModelToStamp (first arg) is not nil, but not a model or part!" end modelToStamp = newModelToStamp @@ -2455,19 +2905,21 @@ t.SetupStamperDragger = function(modelToStamp, Mouse, StampInModel, AllowedStamp control.Stamped = stamped -- BoolValue that fires when user stamps control.Paused = false - control.LoadNewModel = - function(newStampModel) -- allows us to specify a new stamper model to be used with this stamper - if newStampModel and not newStampModel:IsA "Model" and not newStampModel:IsA "BasePart" then - error "Control.LoadNewModel: newStampModel (first arg) is not a Model or Part!" - return nil - end - resetStamperState(newStampModel) + control.LoadNewModel = function(newStampModel) -- allows us to specify a new stamper model to be used with this stamper + if + newStampModel + and not newStampModel:IsA "Model" + and not newStampModel:IsA "BasePart" + then + error "Control.LoadNewModel: newStampModel (first arg) is not a Model or Part!" + return nil end + resetStamperState(newStampModel) + end - control.ReloadModel = - function() -- will automatically set stamper to get a new model of current model and start stamping with new model - resetStamperState() - end + control.ReloadModel = function() -- will automatically set stamper to get a new model of current model and start stamping with new model + resetStamperState() + end control.Pause = function() -- temporarily stops stamping, use resume to start up again if not control.Paused then @@ -2533,10 +2985,16 @@ end t.Help = function(funcNameOrFunc) --input argument can be a string or a function. Should return a description (of arguments and expected side effects) - if funcNameOrFunc == "GetStampModel" or funcNameOrFunc == t.GetStampModel then + if + funcNameOrFunc == "GetStampModel" + or funcNameOrFunc == t.GetStampModel + then return "Function GetStampModel. Arguments: assetId, useAssetVersionId. assetId is the asset to load in, define useAssetVersionId as true if assetId is a version id instead of a relative assetId. Side effect: returns a model of the assetId, or a string with error message if something fails" end - if funcNameOrFunc == "SetupStamperDragger" or funcNameOrFunc == t.SetupStamperDragger then + if + funcNameOrFunc == "SetupStamperDragger" + or funcNameOrFunc == t.SetupStamperDragger + then return "Function SetupStamperDragger. Side Effect: Creates 4x4 stamping mechanism for building out parts quickly. Arguments: ModelToStamp, Mouse, LegalStampCheckFunction. ModelToStamp should be a Model or Part, preferrably loaded from RbxStamper.GetStampModel and should have extents that are multiples of 4. Mouse should be a mouse object (obtained from things such as Tool.OnEquipped), used to drag parts around 'stamp' them out. LegalStampCheckFunction is optional, used as a callback with a table argument (table is full of instances about to be stamped). Function should return either true or false, false stopping the stamp action." end end diff --git a/lua/89449008.lua b/lua/89449008.lua index fc35871..95a352f 100644 --- a/lua/89449008.lua +++ b/lua/89449008.lua @@ -1,3 +1,4 @@ +print "[Mercury]: Loaded corescript 89449008" -- A couple of necessary functions local function waitForChild(instance, name) assert(instance) @@ -48,9 +49,9 @@ local browsingMenu = false local mouseEnterCons = {} local mouseClickCons = {} -local characterChildAddedCon = nil -local characterChildRemovedCon = nil -local backpackAddCon = nil +local characterChildAddedCon +local characterChildRemovedCon +local backpackAddCon local playerBackpack = waitForChild(player, "Backpack") @@ -68,16 +69,19 @@ local gearButton = waitForChild(grid, "GearButton") local swapSlot = waitForChild(script.Parent, "SwapSlot") -local backpackManager = waitForChild(script.Parent, "CoreScripts/BackpackScripts/BackpackManager") +local backpackManager = + waitForChild(script.Parent, "CoreScripts/BackpackScripts/BackpackManager") local backpackOpenEvent = waitForChild(backpackManager, "BackpackOpenEvent") local backpackCloseEvent = waitForChild(backpackManager, "BackpackCloseEvent") local tabClickedEvent = waitForChild(backpackManager, "TabClickedEvent") local resizeEvent = waitForChild(backpackManager, "ResizeEvent") -local searchRequestedEvent = waitForChild(backpackManager, "SearchRequestedEvent") +local searchRequestedEvent = + waitForChild(backpackManager, "SearchRequestedEvent") local tellBackpackReadyFunc = waitForChild(backpackManager, "BackpackReady") -- creating scroll bar early as to make sure items get placed correctly -local scrollFrame, scrollUp, scrollDown, recalculateScroll = RbxGui.CreateScrollingFrame(nil, "grid", Vector2.new(6, 6)) +local scrollFrame, scrollUp, scrollDown, recalculateScroll = + RbxGui.CreateScrollingFrame(nil, "grid", Vector2.new(6, 6)) scrollFrame.Position = UDim2.new(0, 0, 0, 30) scrollFrame.Size = UDim2.new(1, 0, 1, -30) @@ -97,7 +101,8 @@ scrollDown.Position = UDim2.new(0, 0, 1, -17) scrollUp.Parent = scroller scrollDown.Parent = scroller -local scrollFrameLoadout, scrollUpLoadout, scrollDownLoadout, recalculateScrollLoadout = RbxGui.CreateScrollingFrame() +local scrollFrameLoadout, scrollUpLoadout, scrollDownLoadout, recalculateScrollLoadout = + RbxGui.CreateScrollingFrame() scrollFrameLoadout.Position = UDim2.new(0, 0, 0, 0) scrollFrameLoadout.Size = UDim2.new(1, 0, 1, 0) @@ -171,7 +176,8 @@ function resize() waitForChild(gearPreview, "GearImage") gearPreview.GearImage.Size = UDim2.new(0, size, 0, size) - gearPreview.GearImage.Position = UDim2.new(0, gearPreview.AbsoluteSize.X / 2 - size / 2, 0.75, -size) + gearPreview.GearImage.Position = + UDim2.new(0, gearPreview.AbsoluteSize.X / 2 - size / 2, 0.75, -size) resizeGrid() end @@ -203,9 +209,9 @@ function addToGrid(child) end end end) - local ancestryCon = nil + local ancestryCon ancestryCon = child.AncestryChanged:connect(function(_, _) - local thisObject = nil + local thisObject for _, v in pairs(backpackItems) do if v == child then thisObject = v @@ -215,7 +221,10 @@ function addToGrid(child) waitForProperty(player, "Character") waitForChild(player, "Backpack") - if child.Parent ~= player.Backpack and child.Parent ~= player.Character then + if + child.Parent ~= player.Backpack + and child.Parent ~= player.Character + then if ancestryCon then ancestryCon:disconnect() end @@ -264,7 +273,7 @@ function previewGear(button) end function findEmptySlot() - local smallestNum = nil + local smallestNum local loadout = currentLoadout:GetChildren() for i = 1, #loadout do if loadout[i]:IsA "Frame" and #loadout[i]:GetChildren() <= 0 then @@ -286,16 +295,22 @@ end function checkForSwap(button, x, y) local loadoutChildren = currentLoadout:GetChildren() for i = 1, #loadoutChildren do - if loadoutChildren[i]:IsA "Frame" and string.find(loadoutChildren[i].Name, "Slot") then + if + loadoutChildren[i]:IsA "Frame" + and string.find(loadoutChildren[i].Name, "Slot") + then if x >= loadoutChildren[i].AbsolutePosition.x - and x <= (loadoutChildren[i].AbsolutePosition.x + loadoutChildren[i].AbsoluteSize.x) + and x + <= (loadoutChildren[i].AbsolutePosition.x + loadoutChildren[i].AbsoluteSize.x) then if y >= loadoutChildren[i].AbsolutePosition.y - and y <= (loadoutChildren[i].AbsolutePosition.y + loadoutChildren[i].AbsoluteSize.y) + and y + <= (loadoutChildren[i].AbsolutePosition.y + loadoutChildren[i].AbsoluteSize.y) then - local slot = tonumber(string.sub(loadoutChildren[i].Name, 5)) + local slot = + tonumber(string.sub(loadoutChildren[i].Name, 5)) swapGearSlot(slot, button) return true end @@ -328,7 +343,7 @@ function resizeGrid() unequipMenu.Parent = buttonClone end - local beginPos = nil + local beginPos buttonClone.DragBegin:connect(function(value) waitForChild(buttonClone, "Background") buttonClone["Background"].ZIndex = 10 @@ -358,22 +373,29 @@ function resizeGrid() end end) local clickTime = tick() - mouseEnterCons[buttonClone] = buttonClone.MouseEnter:connect(function() - previewGear(buttonClone) - end) - mouseClickCons[buttonClone] = buttonClone.MouseButton1Click:connect(function() - local newClickTime = tick() - if buttonClone.Active and (newClickTime - clickTime) < 0.5 then - local slot = findEmptySlot() - if slot then - buttonClone.ZIndex = 1 - swapGearSlot(slot, buttonClone) - end - else - buttonClick(buttonClone) + mouseEnterCons[buttonClone] = buttonClone.MouseEnter:connect( + function() + previewGear(buttonClone) end - clickTime = newClickTime - end) + ) + mouseClickCons[buttonClone] = buttonClone.MouseButton1Click:connect( + function() + local newClickTime = tick() + if + buttonClone.Active + and (newClickTime - clickTime) < 0.5 + then + local slot = findEmptySlot() + if slot then + buttonClone.ZIndex = 1 + swapGearSlot(slot, buttonClone) + end + else + buttonClick(buttonClone) + end + clickTime = newClickTime + end + ) end end end @@ -405,7 +427,10 @@ function inLoadout(gear) if children[i]:IsA "Frame" then local button = children[i]:GetChildren() if #button > 0 then - if button[1].GearReference.Value and button[1].GearReference.Value == gear then + if + button[1].GearReference.Value + and button[1].GearReference.Value == gear + then return true end end @@ -417,7 +442,7 @@ end function updateGridActive() for _, v in pairs(backpackItems) do if buttons[v] then - local gear = nil + local gear local gearRef = buttons[v]:FindFirstChild "GearReference" if gearRef then @@ -435,9 +460,12 @@ end function centerGear(loadoutChildren) local gearButtons = {} - local lastSlotAdd = nil + local lastSlotAdd for i = 1, #loadoutChildren do - if loadoutChildren[i]:IsA "Frame" and #loadoutChildren[i]:GetChildren() > 0 then + if + loadoutChildren[i]:IsA "Frame" + and #loadoutChildren[i]:GetChildren() > 0 + then if loadoutChildren[i].Name == "Slot0" then lastSlotAdd = loadoutChildren[i] else @@ -502,8 +530,13 @@ function loadoutCheck(child, selectState) end for _, v in pairs(backpackItems) do if buttons[v] then - if child:FindFirstChild "GearReference" and buttons[v]:FindFirstChild "GearReference" then - if buttons[v].GearReference.Value == child.GearReference.Value then + if + child:FindFirstChild "GearReference" + and buttons[v]:FindFirstChild "GearReference" + then + if + buttons[v].GearReference.Value == child.GearReference.Value + then buttons[v].Active = selectState break end @@ -569,7 +602,10 @@ local UnequipGearMenuClick = function(element, menu) for i = 1, #loadoutChildren do if loadoutChildren[i]:IsA "Frame" then local button = loadoutChildren[i]:GetChildren() - if button[1] and button[1].GearReference.Value == gearToUnequip then + if + button[1] + and button[1].GearReference.Value == gearToUnequip + then slot = button[1].SlotNumber.Text break end @@ -583,9 +619,11 @@ function setupCharacterConnections() if backpackAddCon then backpackAddCon:disconnect() end - backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded:connect(function(child) - addToGrid(child) - end) + backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded:connect( + function(child) + addToGrid(child) + end + ) -- make sure we get all the children local backpackChildren = game.Players.LocalPlayer.Backpack:GetChildren() @@ -596,17 +634,21 @@ function setupCharacterConnections() if characterChildAddedCon then characterChildAddedCon:disconnect() end - characterChildAddedCon = game.Players.LocalPlayer.Character.ChildAdded:connect(function(child) - addToGrid(child) - updateGridActive() - end) + characterChildAddedCon = game.Players.LocalPlayer.Character.ChildAdded:connect( + function(child) + addToGrid(child) + updateGridActive() + end + ) if characterChildRemovedCon then characterChildRemovedCon:disconnect() end - characterChildRemovedCon = game.Players.LocalPlayer.Character.ChildRemoved:connect(function(_) - updateGridActive() - end) + characterChildRemovedCon = game.Players.LocalPlayer.Character.ChildRemoved:connect( + function(_) + updateGridActive() + end + ) wait() centerGear(currentLoadout:GetChildren()) @@ -826,7 +868,10 @@ function getGearContextMenu() end function coreGuiChanged(coreGuiType, enabled) - if coreGuiType == Enum.CoreGuiType.Backpack or coreGuiType == Enum.CoreGuiType.All then + if + coreGuiType == Enum.CoreGuiType.Backpack + or coreGuiType == Enum.CoreGuiType.All + then if not enabled then backpack.Gear.Visible = false end @@ -860,12 +905,18 @@ currentLoadout.ChildRemoved:connect(function(child) end) currentLoadout.DescendantAdded:connect(function(descendant) - if not backpack.Visible and (descendant:IsA "ImageButton" or descendant:IsA "TextButton") then + if + not backpack.Visible + and (descendant:IsA "ImageButton" or descendant:IsA "TextButton") + then centerGear(currentLoadout:GetChildren()) end end) currentLoadout.DescendantRemoving:connect(function(descendant) - if not backpack.Visible and (descendant:IsA "ImageButton" or descendant:IsA "TextButton") then + if + not backpack.Visible + and (descendant:IsA "ImageButton" or descendant:IsA "TextButton") + then wait() centerGear(currentLoadout:GetChildren()) end @@ -892,9 +943,11 @@ player.ChildAdded:connect(function(child) if backpackAddCon then backpackAddCon:disconnect() end - backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded:connect(function(child) - addToGrid(child) - end) + backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded:connect( + function(child) + addToGrid(child) + end + ) end end) @@ -906,7 +959,10 @@ end) local loadoutChildren = currentLoadout:GetChildren() for i = 1, #loadoutChildren do - if loadoutChildren[i]:IsA "Frame" and string.find(loadoutChildren[i].Name, "Slot") then + if + loadoutChildren[i]:IsA "Frame" + and string.find(loadoutChildren[i].Name, "Slot") + then loadoutChildren[i].ChildRemoved:connect(function() updateGridActive() end) @@ -918,7 +974,10 @@ end ------------------------- End Lifelong Connections ----------------------- pcall(function() - coreGuiChanged(Enum.CoreGuiType.Backpack, Game.StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.Backpack)) + coreGuiChanged( + Enum.CoreGuiType.Backpack, + Game.StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.Backpack) + ) Game.StarterGui.CoreGuiChangedSignal:connect(coreGuiChanged) end) @@ -939,9 +998,11 @@ if characterChildAddedCon == nil and game.Players.LocalPlayer["Character"] then setupCharacterConnections() end if not backpackAddCon then - backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded:connect(function(child) - addToGrid(child) - end) + backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded:connect( + function(child) + addToGrid(child) + end + ) end backpackOpenEvent.Event:connect(backpackOpenHandler) diff --git a/lua/89449093.lua b/lua/89449093.lua index e241e7f..171feaf 100644 --- a/lua/89449093.lua +++ b/lua/89449093.lua @@ -1,3 +1,4 @@ +print "[Mercury]: Loaded corescript 89449093" -- This script manages context switches in the backpack (Gear to Wardrobe, etc.) and player state changes. Also manages global functions across different tabs (currently only search) if game.CoreGui.Version < 7 then return @@ -45,7 +46,8 @@ if game.CoreGui.Version >= 8 then wardrobeButton = backpack.Tabs.WardrobeButton end waitForChild(backpack.Parent, "ControlFrame") -local backpackButton = waitForChild(backpack.Parent.ControlFrame, "BackpackButton") +local backpackButton = + waitForChild(backpack.Parent.ControlFrame, "BackpackButton") local currentTab = "gear" local searchFrame = waitForChild(backpack, "SearchFrame") @@ -64,7 +66,7 @@ local backpackIsOpen = false local active = true local disabledByDeveloper = false -local humanoidDiedCon = nil +local humanoidDiedCon local guiTweenSpeed = 0.25 -- how quickly we open/close the backpack @@ -97,7 +99,10 @@ function createPublicFunction(funcName, invokeFunc) assert(funcName, "funcName is nil") assert(tostring(funcName), "funcName is not a string") assert(invokeFunc, "invokeFunc is nil") - assert(type(invokeFunc) == "function", "invokeFunc should be of type 'function'") + assert( + type(invokeFunc) == "function", + "invokeFunc should be of type 'function'" + ) local newFunction = Instance.new "BindableFunction" newFunction.Name = tostring(funcName) @@ -128,7 +133,9 @@ function initHumanoidDiedConnections() end waitForProperty(game.Players.LocalPlayer, "Character") waitForChild(game.Players.LocalPlayer.Character, "Humanoid") - humanoidDiedCon = game.Players.LocalPlayer.Character.Humanoid.Died:connect(deactivateBackpack) + humanoidDiedCon = game.Players.LocalPlayer.Character.Humanoid.Died:connect( + deactivateBackpack + ) end function activateBackpack() @@ -171,18 +178,28 @@ local hideBackpack = function() end function showBackpack() - game.GuiService:AddCenterDialog(backpack, Enum.CenterDialogType.PlayerInitiatedDialog, function() - backpack.Visible = true - backpackButton.Selected = true - end, function() - backpack.Visible = false - backpackButton.Selected = false - end) + game.GuiService:AddCenterDialog( + backpack, + Enum.CenterDialogType.PlayerInitiatedDialog, + function() + backpack.Visible = true + backpackButton.Selected = true + end, + function() + backpack.Visible = false + backpackButton.Selected = false + end + ) backpack.Visible = true backpackButton.Selected = true backpack:TweenSizeAndPosition( backpackSize, - UDim2.new(0.5, -backpackSize.X.Offset / 2, 1, -backpackSize.Y.Offset - 88), + UDim2.new( + 0.5, + -backpackSize.X.Offset / 2, + 1, + -backpackSize.Y.Offset - 88 + ), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, guiTweenSpeed, @@ -194,8 +211,9 @@ function showBackpack() backpackOpenEvent:Fire(currentTab) canToggle = true readyForNextEvent = true - backpackButton.Image = "http://www.roblox.com/asset/?id=97644093" - backpackButton.Position = UDim2.new(0.5, -60, 1, -backpackSize.Y.Offset - 103) + backpackButton.Image = "http://banland.xyz/asset/?id=97644093" + backpackButton.Position = + UDim2.new(0.5, -60, 1, -backpackSize.Y.Offset - 103) end) end @@ -218,7 +236,7 @@ function toggleBackpack() backpackIsOpen = not backpackIsOpen if backpackIsOpen then - loadoutBackground.Image = "http://www.roblox.com/asset/?id=97623721" + loadoutBackground.Image = "http://banland.xyz/asset/?id=97623721" loadoutBackground.Position = UDim2.new(-0.03, 0, -0.17, 0) loadoutBackground.Size = UDim2.new(1.05, 0, 1.25, 0) loadoutBackground.ZIndex = 2.0 @@ -228,8 +246,8 @@ function toggleBackpack() backpackButton.Position = UDim2.new(0.5, -60, 1, -44) loadoutBackground.Visible = false backpackButton.Selected = false - backpackButton.Image = "http://www.roblox.com/asset/?id=97617958" - loadoutBackground.Image = "http://www.roblox.com/asset/?id=96536002" + backpackButton.Image = "http://banland.xyz/asset/?id=97617958" + loadoutBackground.Image = "http://banland.xyz/asset/?id=96536002" loadoutBackground.Position = UDim2.new(-0.1, 0, -0.1, 0) loadoutBackground.Size = UDim2.new(1.2, 0, 1.2, 0) hideBackpack() @@ -368,7 +386,10 @@ local backpackReady = function() end function coreGuiChanged(coreGuiType, enabled) - if coreGuiType == Enum.CoreGuiType.Backpack or coreGuiType == Enum.CoreGuiType.All then + if + coreGuiType == Enum.CoreGuiType.Backpack + or coreGuiType == Enum.CoreGuiType.All + then active = enabled disabledByDeveloper = not enabled @@ -401,7 +422,10 @@ createPublicFunction("BackpackReady", backpackReady) ------------------------ Connections/Script Main ------------------------------------------- pcall(function() - coreGuiChanged(Enum.CoreGuiType.Backpack, Game.StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.Backpack)) + coreGuiChanged( + Enum.CoreGuiType.Backpack, + Game.StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.Backpack) + ) Game.StarterGui.CoreGuiChangedSignal:connect(coreGuiChanged) end) diff --git a/lua/97188756.lua b/lua/97188756.lua index aee1491..90194a4 100644 --- a/lua/97188756.lua +++ b/lua/97188756.lua @@ -1,3 +1,4 @@ +print "[Mercury]: Loaded corescript 97188756" --[[ //FileName: ChatScript.LUA //Written by: Sorcus @@ -95,7 +96,10 @@ do return function(t) local e = { [EnumName] = enumName } for i, name in pairs(t) do - local item = setmetatable({ Name = name, Value = i, Enum = e, [EnumName] = enumName }, item_mt) + local item = setmetatable( + { Name = name, Value = i, Enum = e, [EnumName] = enumName }, + item_mt + ) e[i] = item e[name] = item e[item] = item @@ -184,7 +188,12 @@ local Chat = { ["Use the Chat menu to talk to me."] = { "/sc 0", true }, ["I can only see menu chats."] = { "/sc 1", true }, ["Hello"] = { - ["Hi"] = { "/sc 2_0", true, ["Hi there!"] = true, ["Hi everyone"] = true }, + ["Hi"] = { + "/sc 2_0", + true, + ["Hi there!"] = true, + ["Hi everyone"] = true, + }, ["Howdy"] = { "/sc 2_1", true, ["Howdy partner!"] = true }, ["Greetings"] = { "/sc 2_2", @@ -277,7 +286,13 @@ local Chat = { ["Goodluck!"] = true, ["Ta-ta for now!"] = true, }, - ["Peace"] = { "/sc 3_6", true, ["Peace out!"] = true, ["Peace dudes!"] = true, ["Rest in pieces!"] = true }, + ["Peace"] = { + "/sc 3_6", + true, + ["Peace out!"] = true, + ["Peace dudes!"] = true, + ["Rest in pieces!"] = true, + }, ["Silly"] = { "/sc 3_7", true, @@ -319,7 +334,13 @@ local Chat = { ["No, thank you"] = true, ["Thanx"] = true, }, - ["No problem"] = { "/sc 4_4", true, ["Don't worry"] = true, ["That's ok"] = true, ["np"] = true }, + ["No problem"] = { + "/sc 4_4", + true, + ["Don't worry"] = true, + ["That's ok"] = true, + ["np"] = true, + }, ["You are ..."] = { "/sc 4_5", true, @@ -462,7 +483,12 @@ local Chat = { ["Animals"] = { "/sc 6_3", true, - ["Cats"] = { ["Lion"] = true, ["Tiger"] = true, ["Leopard"] = true, ["Cheetah"] = true }, + ["Cats"] = { + ["Lion"] = true, + ["Tiger"] = true, + ["Leopard"] = true, + ["Cheetah"] = true, + }, ["Dogs"] = { ["Wolves"] = true, ["Beagle"] = true, @@ -474,8 +500,17 @@ local Chat = { ["Terrier"] = true, ["Retriever"] = true, }, - ["Horses"] = { ["Ponies"] = true, ["Stallions"] = true, ["Pwnyz"] = true }, - ["Reptiles"] = { ["Dinosaurs"] = true, ["Lizards"] = true, ["Snakes"] = true, ["Turtles!"] = true }, + ["Horses"] = { + ["Ponies"] = true, + ["Stallions"] = true, + ["Pwnyz"] = true, + }, + ["Reptiles"] = { + ["Dinosaurs"] = true, + ["Lizards"] = true, + ["Snakes"] = true, + ["Turtles!"] = true, + }, ["Hamster"] = true, ["Monkey"] = true, ["Bears"] = true, @@ -545,7 +580,11 @@ local Chat = { ["Volleyball"] = true, ["Tennis"] = true, ["Sports team practice"] = true, - ["Watersports"] = { ["Surfing"] = true, ["Swimming"] = true, ["Water Polo"] = true }, + ["Watersports"] = { + ["Surfing"] = true, + ["Swimming"] = true, + ["Water Polo"] = true, + }, ["Winter sports"] = { ["Skiing"] = true, ["Snowboarding"] = true, @@ -599,7 +638,10 @@ local Chat = { ["Coding"] = true, ["Hacking"] = true, }, - ["The Internet"] = { ["lol. teh internets!"] = true, ["Watching vids"] = true }, + ["The Internet"] = { + ["lol. teh internets!"] = true, + ["Watching vids"] = true, + }, ["Dance"] = true, ["Gymnastics"] = true, ["Listening to music"] = true, @@ -759,7 +801,10 @@ local Chat = { }, ["Boy"] = { "/sc 6_12", true }, ["Girl"] = { "/sc 6_13", true }, - ["I don't want to say boy or girl. Don't ask."] = { "/sc 6_14", true }, + ["I don't want to say boy or girl. Don't ask."] = { + "/sc 6_14", + true, + }, [1] = "/sc 6", }, ["Game"] = { @@ -905,9 +950,13 @@ function Chat:EnableScrolling(toggle) Camera.CameraType = "Scriptable" -- Get relative position of camera and keep to it Spawn(function() - local currentRelativePos = Camera.CoordinateFrame.p - torso.Position + local currentRelativePos = Camera.CoordinateFrame.p + - torso.Position while Chat.MouseOnFrame do - Camera.CoordinateFrame = CFrame.new(torso.Position + currentRelativePos, head.Position) + Camera.CoordinateFrame = CFrame.new( + torso.Position + currentRelativePos, + head.Position + ) wait(0.015) end end) @@ -962,23 +1011,30 @@ function Chat:UpdateQueue(field, diff) for i = #self.MessageQueue, 1, -1 do if self.MessageQueue[i] then for _, label in pairs(self.MessageQueue[i]) do - if label and type(label) ~= "table" and type(label) ~= "number" then + if + label + and type(label) ~= "table" + and type(label) ~= "number" + then if label:IsA "TextLabel" or label:IsA "TextButton" then if diff then - label.Position = label.Position - UDim2.new(0, 0, diff, 0) + label.Position = label.Position + - UDim2.new(0, 0, diff, 0) else if field == self.MessageQueue[i] then label.Position = UDim2.new( self.Configuration.XScale, 0, - label.Position.Y.Scale - field["Message"].Size.Y.Scale, + label.Position.Y.Scale + - field["Message"].Size.Y.Scale, 0 ) -- Just to show up popping effect for the latest message in chat Spawn(function() wait(0.05) while label.TextTransparency >= 0 do - label.TextTransparency = label.TextTransparency - 0.2 + label.TextTransparency = label.TextTransparency + - 0.2 wait(0.03) end if label == field["Message"] then @@ -991,7 +1047,8 @@ function Chat:UpdateQueue(field, diff) label.Position = UDim2.new( self.Configuration.XScale, 0, - label.Position.Y.Scale - field["Message"].Size.Y.Scale, + label.Position.Y.Scale + - field["Message"].Size.Y.Scale, 0 ) end @@ -1045,7 +1102,12 @@ function Chat:ComputeSpaceString(pLabel) local nString = " " if not self.TempSpaceLabel then self.TempSpaceLabel = Gui.Create "TextButton" { - Size = UDim2.new(0, pLabel.AbsoluteSize.X, 0, pLabel.AbsoluteSize.Y), + Size = UDim2.new( + 0, + pLabel.AbsoluteSize.X, + 0, + pLabel.AbsoluteSize.Y + ), FontSize = self.Configuration.FontSize, Parent = self.RenderFrame, BackgroundTransparency = 1, @@ -1239,7 +1301,8 @@ function Chat:CreateMessage(cPlayer, message) -- This will give beautiful multilines as well local heightField = mLabel.TextBounds.Y - mLabel.Size = UDim2.new(1, 0, heightField / self.RenderFrame.AbsoluteSize.Y, 0) + mLabel.Size = + UDim2.new(1, 0, heightField / self.RenderFrame.AbsoluteSize.Y, 0) pLabel.Size = mLabel.Size local queueField = {} @@ -1314,7 +1377,8 @@ function Chat:CreateSafeChatOptions(list, rootButton) count = count + 1 if type(list[msg]) == "table" then - text_List[rootButton][chatText] = Chat:CreateSafeChatOptions(list[msg], chatText) + text_List[rootButton][chatText] = + Chat:CreateSafeChatOptions(list[msg], chatText) -- else -- --table.insert(text_List[chatText], true) end @@ -1354,13 +1418,14 @@ function Chat:CreateSafeChatGui() Size = UDim2.new(0, 44, 0, 31), Position = UDim2.new(0, 1, 0.35, 0), BackgroundTransparency = 1, - Image = "http://www.roblox.com/asset/?id=97080365", + Image = "http://banland.xyz/asset/?id=97080365", }, } self.SafeChatButton = self.SafeChatFrame.SafeChatButton -- safe chat button is the root of this tree - self.SafeChatTree[self.SafeChatButton] = Chat:CreateSafeChatOptions(self.SafeChat_List, self.SafeChatButton) + self.SafeChatTree[self.SafeChatButton] = + Chat:CreateSafeChatOptions(self.SafeChat_List, self.SafeChatButton) self.SafeChatButton.MouseButton1Click:connect(function() Chat:ToggleSafeChatMenu(self.SafeChatButton) @@ -1400,7 +1465,7 @@ function Chat:CreateTouchButton() Size = UDim2.new(1, 0, 1, 0), Position = UDim2.new(0, 0, 0, 0), BackgroundTransparency = 1, - Image = "http://www.roblox.com/asset/?id=97078724", + Image = "http://banland.xyz/asset/?id=97078724", }, } self.TapToChatLabel = self.ChatTouchFrame.ChatLabel @@ -1505,7 +1570,7 @@ function Chat:CreateGui() Gui.Create "ImageLabel" { Name = "Background", - Image = "http://www.roblox.com/asset/?id=97120937", --96551212'; + Image = "http://banland.xyz/asset/?id=97120937", --96551212'; Size = UDim2.new(1.3, 0, 1.64, 0), Position = UDim2.new(0, 0, 0, 0), BackgroundTransparency = 1, @@ -1680,9 +1745,16 @@ function Chat:PlayerChatted(...) if PlayersService.ClassicChat then if - not (string.sub(message, 1, 3) == "/e " or string.sub(message, 1, 7) == "/emote ") + not ( + string.sub(message, 1, 3) == "/e " + or string.sub(message, 1, 7) == "/emote " + ) and (forceChatGUI or Player.ChatMode == Enum.ChatMode.TextAndMenu) - or (Player.ChatMode == Enum.ChatMode.Menu and string.sub(message, 1, 3) == "/sc") + or (Player.ChatMode == Enum.ChatMode.Menu and string.sub( + message, + 1, + 3 + ) == "/sc") or (Chat:FindMessageInSafeChat(message, self.SafeChat_List)) then Chat:UpdateChat(player, message) @@ -1701,7 +1773,8 @@ function Chat:CullThread() field["SpawnTime"] and field["Player"] and field["Message"] - and tick() - field["SpawnTime"] > self.Configuration.LifeTime + and tick() - field["SpawnTime"] + > self.Configuration.LifeTime then field["Player"].Visible = false field["Message"].Visible = false @@ -1724,7 +1797,10 @@ function Chat:LockAllFields(gui) end function Chat:CoreGuiChanged(coreGuiType, enabled) - if coreGuiType == Enum.CoreGuiType.Chat or coreGuiType == Enum.CoreGuiType.All then + if + coreGuiType == Enum.CoreGuiType.Chat + or coreGuiType == Enum.CoreGuiType.All + then if self.Frame then self.Frame.Visible = enabled end @@ -1746,10 +1822,15 @@ function Chat:Initialize() Chat:CreateGui() pcall(function() - Chat:CoreGuiChanged(Enum.CoreGuiType.Chat, Game.StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.Chat)) - Game.StarterGui.CoreGuiChangedSignal:connect(function(coreGuiType, enabled) - Chat:CoreGuiChanged(coreGuiType, enabled) - end) + Chat:CoreGuiChanged( + Enum.CoreGuiType.Chat, + Game.StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.Chat) + ) + Game.StarterGui.CoreGuiChangedSignal:connect( + function(coreGuiType, enabled) + Chat:CoreGuiChanged(coreGuiType, enabled) + end + ) end) self.EventListener = PlayersService.PlayerChatted:connect(function(...) diff --git a/lua/host.lua b/lua/host.lua index 0c1d6ee..7808ae2 100644 --- a/lua/host.lua +++ b/lua/host.lua @@ -1,11 +1,19 @@ print "[Mercury]: Loaded Host corescript" +-- Start Game Script Arguments local placeId, sleeptime, access, url, killID, deathID, timeout, injectScriptAssetID, servicesUrl, libraryRegistrationScriptAssetID + +-- StartGame -- pcall(function() - return game:GetService("ScriptContext"):AddStarterScript(injectScriptAssetID) + game:GetService("ScriptContext"):AddStarterScript(injectScriptAssetID) end) game:GetService("RunService"):Run() -local waitForChild -waitForChild = function(parent, childName) + +-- REQUIRES: StartGanmeSharedArgs.txt +-- REQUIRES: MonitorGameStatus.txt + +------------------- UTILITY FUNCTIONS -------------------------- + +function waitForChild(parent, childName) while true do local child = parent:findFirstChild(childName) if child then @@ -14,184 +22,265 @@ waitForChild = function(parent, childName) parent.ChildAdded:wait() end end -local getKillerOfHumanoidIfStillInGame -getKillerOfHumanoidIfStillInGame = function(humanoid) + +-- returns the player object that killed this humanoid +-- returns nil if the killer is no longer in the game +function getKillerOfHumanoidIfStillInGame(humanoid) + -- check for kill tag on humanoid - may be more than one - todo: deal with this local tag = humanoid:findFirstChild "creator" - if tag and tag.Value.Parent then - return tag.Value + + -- find player with name on tag + if tag then + local killer = tag.Value + if killer.Parent then -- killer still in game + return killer + end end + + return nil end -local onDied -onDied = function(victim, humanoid) - local killer, victorId = getKillerOfHumanoidIfStillInGame(humanoid), 0 + +-- send kill and death stats when a player dies +function onDied(victim, humanoid) + local killer = getKillerOfHumanoidIfStillInGame(humanoid) + local victorId = 0 if killer then victorId = killer.userId - print("STAT: kill by " .. tostring(victorId) .. " of " .. tostring(victim.userId)) - game:HttpGet(tostring(url) .. "/Game/Knockouts.ashx?UserID=" .. tostring(victorId) .. "&" .. tostring(access)) + print("STAT: kill by " .. victorId .. " of " .. victim.userId) + game:HttpGet( + url .. "/Game/Knockouts.ashx?UserID=" .. victorId .. "&" .. access + ) end - print("STAT: death of " .. tostring(victim.userId) .. " by " .. tostring(victorId)) - return game:HttpGet( - tostring(url) .. "/Game/Wipeouts.ashx?UserID=" .. tostring(victim.userId) .. "&" .. tostring(access) + print("STAT: death of " .. victim.userId .. " by " .. victorId) + game:HttpGet( + url .. "/Game/Wipeouts.ashx?UserID=" .. victim.userId .. "&" .. access ) end + +-----------------------------------END UTILITY FUNCTIONS ------------------------- + +-----------------------------------"CUSTOM" SHARED CODE---------------------------------- + pcall(function() settings().Network.UseInstancePacketCache = true end) pcall(function() settings().Network.UsePhysicsPacketCache = true end) +--pcall(function() settings()["Task Scheduler"].PriorityMethod = Enum.PriorityMethod.FIFO end) pcall(function() - settings()["Task Scheduler"].PriorityMethod = Enum.PriorityMethod.AccumulatedError + settings()["Task Scheduler"].PriorityMethod = + Enum.PriorityMethod.AccumulatedError end) + +--settings().Network.PhysicsSend = 1 -- 1==RoundRobin settings().Network.PhysicsSend = Enum.PhysicsSendMethod.ErrorComputation2 settings().Network.ExperimentalPhysicsEnabled = true settings().Network.WaitingForCharacterLogRate = 100 pcall(function() - return settings().Diagnostics:LegacyScriptMode() + settings().Diagnostics:LegacyScriptMode() end) + +-----------------------------------START GAME SHARED SCRIPT------------------------------ + url = "_BASE_URL" + local scriptContext = game:GetService "ScriptContext" pcall(function() - return scriptContext:AddStarterScript(libraryRegistrationScriptAssetID) + scriptContext:AddStarterScript(libraryRegistrationScriptAssetID) end) scriptContext.ScriptsDisabled = true + +-- game:SetPlaceID(nil, false) game:GetService("ChangeHistoryService"):SetEnabled(false) + +-- establish this peer as the Server local ns = game:GetService "NetworkServer" + if url ~= nil then pcall(function() - return game:GetService("Players"):SetAbuseReportUrl(tostring(url) .. "/Report/Games.ashx") + game:GetService("Players"):SetAbuseReportUrl( + url .. "/Report/Games.ashx" + ) end) pcall(function() - return game:GetService("ScriptInformationProvider"):SetAssetUrl(tostring(url) .. "/Asset/") + game:GetService("ScriptInformationProvider") + :SetAssetUrl(url .. "/Asset/") end) pcall(function() - return game:GetService("ContentProvider"):SetBaseUrl(tostring(url) .. "/") + game:GetService("ContentProvider"):SetBaseUrl(url .. "/") end) + -- pcall(function() game:GetService("Players"):SetChatFilterUrl(url .. "/Game/ChatFilter.ashx") end) + + -- game:GetService("BadgeService"):SetPlaceId(placeId) if access ~= nil then - do - local _with_0 = game:GetService "BadgeService" - _with_0:SetAwardBadgeUrl( - tostring(url) .. "/Game/Badge/AwardBadge.ashx?UserID=%d&BadgeID=%d&PlaceID=%d&" .. tostring(access) - ) - _with_0:SetHasBadgeUrl( - tostring(url) .. "/Game/Badge/HasBadge.ashx?UserID=%d&BadgeID=%d&" .. tostring(access) - ) - _with_0:SetIsBadgeDisabledUrl( - tostring(url) .. "/Game/Badge/IsBadgeDisabled.ashx?BadgeID=%d&PlaceID=%d&" .. tostring(access) - ) - end - do - local _with_0 = game:GetService "FriendService" - _with_0:SetMakeFriendUrl( - tostring(servicesUrl) .. "/Friend/CreateFriend?firstUserId=%d&secondUserId=%d&" .. tostring(access) - ) - _with_0:SetBreakFriendUrl( - tostring(servicesUrl) .. "/Friend/BreakFriend?firstUserId=%d&secondUserId=%d&" .. tostring(access) - ) - _with_0:SetGetFriendsUrl(tostring(servicesUrl) .. "/Friend/AreFriends?userId=%d&" .. tostring(access)) - end + game:GetService("BadgeService"):SetAwardBadgeUrl( + url + .. "/Game/Badge/AwardBadge.ashx?UserID=%d&BadgeID=%d&PlaceID=%d&" + .. access + ) + game:GetService("BadgeService"):SetHasBadgeUrl( + url .. "/Game/Badge/HasBadge.ashx?UserID=%d&BadgeID=%d&" .. access + ) + game:GetService("BadgeService"):SetIsBadgeDisabledUrl( + url + .. "/Game/Badge/IsBadgeDisabled.ashx?BadgeID=%d&PlaceID=%d&" + .. access + ) + + game:GetService("FriendService"):SetMakeFriendUrl( + servicesUrl + .. "/Friend/CreateFriend?firstUserId=%d&secondUserId=%d&" + .. access + ) + game:GetService("FriendService"):SetBreakFriendUrl( + servicesUrl + .. "/Friend/BreakFriend?firstUserId=%d&secondUserId=%d&" + .. access + ) + game:GetService("FriendService"):SetGetFriendsUrl( + servicesUrl .. "/Friend/AreFriends?userId=%d&" .. access + ) end game:GetService("BadgeService"):SetIsBadgeLegalUrl "" - do - local _with_0 = game:GetService "InsertService" - _with_0:SetBaseSetsUrl(tostring(url) .. "/game/tools/insertasset?nsets=10&type=base") - _with_0:SetUserSetsUrl(tostring(url) .. "/game/tools/insertasset?nsets=20&type=user&userid=%d") - _with_0:SetCollectionUrl(tostring(url) .. "/game/tools/insertasset?sid=%d") - _with_0:SetAssetUrl(tostring(url) .. "/Asset/?id=%d") - _with_0:SetAssetVersionUrl(tostring(url) .. "/Asset/?assetversionid=%d") - end + game:GetService("InsertService") + :SetBaseSetsUrl( + url .. "/Game/Tools/InsertAsset.ashx?nsets=10&type=base" + ) + game:GetService("InsertService"):SetUserSetsUrl( + url .. "/Game/Tools/InsertAsset.ashx?nsets=20&type=user&userid=%d" + ) + game:GetService("InsertService") + :SetCollectionUrl(url .. "/Game/Tools/InsertAsset.ashx?sid=%d") + game:GetService("InsertService"):SetAssetUrl(url .. "/Asset/?id=%d") + game:GetService("InsertService") + :SetAssetVersionUrl(url .. "/Asset/?assetversionid=%d") + pcall(function() - return loadfile(tostring(url) .. "/Game/LoadPlaceInfo.ashx?PlaceId=" .. tostring(placeId))() + loadfile(url .. "/Game/LoadPlaceInfo.ashx?PlaceId=" .. placeId)() end) + pcall(function() if access then - return loadfile( - tostring(url) + loadfile( + url .. "/Game/PlaceSpecificScript.ashx?PlaceId=" - .. tostring(placeId) + .. placeId .. "&" - .. tostring(access) + .. access )() end end) end + pcall(function() - return game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(true) + game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(true) end) settings().Diagnostics.LuaRamLimit = 0 -if (placeId ~= nil) and (killID ~= nil) and (deathID ~= nil) and (url ~= nil) then - local createDeathMonitor - createDeathMonitor = function(player) +--settings().Network:SetThroughputSensitivity(0.08, 0.01) +--settings().Network.SendRate = 35 +--settings().Network.PhysicsSend = 0 -- 1==RoundRobin + +--shared["__time"] = 0 +--game:GetService("RunService").Stepped:connect(function (time) shared["__time"] = time end) + +if placeId ~= nil and killID ~= nil and deathID ~= nil and url ~= nil then + -- listen for the death of a Player + function createDeathMonitor(player) + -- we don't need to clean up old monitors or connections since the Character will be destroyed soon if player.Character then local humanoid = waitForChild(player.Character, "Humanoid") - return humanoid.Died:connect(function() - return onDied(player, humanoid) + humanoid.Died:connect(function() + onDied(player, humanoid) end) end end + + -- listen to all Players' Characters game:GetService("Players").ChildAdded:connect(function(player) createDeathMonitor(player) - return player.Changed:connect(function(property) + player.Changed:connect(function(property) if property == "Character" then - return createDeathMonitor(player) + createDeathMonitor(player) end end) end) end + game:GetService("Players").PlayerAdded:connect(function(player) - print("Player " .. tostring(player.userId) .. " added") + print("Player " .. player.userId .. " added") + if url and access and placeId and player and player.userId then game:HttpGet( - tostring(url) + url .. "/Game/ClientPresence.ashx?action=connect&" - .. tostring(access) + .. access .. "&PlaceID=" - .. tostring(placeId) + .. placeId .. "&UserID=" - .. tostring(player.userId) + .. player.userId ) - return game:HttpGet( - tostring(url) + game:HttpGet( + url .. "/Game/PlaceVisit.ashx?UserID=" - .. tostring(player.userId) + .. player.userId .. "&AssociatedPlaceID=" - .. tostring(placeId) + .. placeId .. "&" - .. tostring(access) + .. access ) end end) + game:GetService("Players").PlayerRemoving:connect(function(player) - print("Player " .. tostring(player.userId) .. " leaving") + print("Player " .. player.userId .. " leaving") + if url and access and placeId and player and player.userId then - return game:HttpGet( - tostring(url) + game:HttpGet( + url .. "/Game/ClientPresence.ashx?action=disconnect&" - .. tostring(access) + .. access .. "&PlaceID=" - .. tostring(placeId) + .. placeId .. "&UserID=" - .. tostring(player.userId) + .. player.userId ) end end) -if (placeId ~= nil) and (url ~= nil) then + +if placeId ~= nil and url ~= nil then + -- yield so that file load happens in the heartbeat thread wait() - game:Load(tostring(url) .. "/asset/?id=" .. tostring(placeId)) + + -- load the game + game:Load(url .. "/asset/?id=" .. placeId) end + if _MAP_LOCATION_EXISTS then + -- yield so that file load happens in the heartbeat thread wait() + + -- load the game game:Load "_MAP_LOCATION" end + +-- Now start the connection ns:Start(_SERVER_PORT, sleeptime) + game:GetService("Visit"):SetPing("_SERVER_PRESENCE_URL", 30) + if timeout then scriptContext:SetTimeout(timeout) end scriptContext.ScriptsDisabled = false + +--delay(1, function() +-- loadfile(url .. "/analytics/GamePerfMonitor.ashx")(game.JobId, placeId) +--end) + local reset = ";mc" -return game.Players.PlayerAdded:connect(function(player) - return player.Chatted:connect(function(msg) +game.Players.PlayerAdded:connect(function(player) + player.Chatted:connect(function(msg) if msg == reset then if player.Character then player.Character.Humanoid.Health = 0 diff --git a/lua/join.lua b/lua/join.lua index 8b29920..762b93f 100644 --- a/lua/join.lua +++ b/lua/join.lua @@ -1,9 +1,25 @@ -print "[Mercury]: Loaded Join corescript" -- MultiplayerSharedScript.lua inserted here ------ Prepended to Join.lua -- +print "[Mercury]: Loaded Join corescript" +local InsertService = game:GetService "InsertService" +local ChangeHistoryService = game:GetService "ChangeHistoryService" +local ContentProvider = game:GetService "ContentProvider" +local SocialService = game:GetService "SocialService" +local GamePassService = game:GetService "GamePassService" +local MarketplaceService = game:GetService "MarketplaceService" +-- local UserInputService = game:GetService "UserInputService" +local Players = game:GetService "Players" +local Client = game:GetService "NetworkClient" +local Visit = game:GetService "Visit" + +-- MultiplayerSharedScript.lua inserted here ------ Prepended to Join.lua -- pcall(function() - return game:SetPlaceID(_PLACE_ID, false) + game:SetPlaceID(_PLACE_ID, false) end) -local isTouchDevice = Game:GetService("UserInputService").TouchEnabled + +-- if we are on a touch device, no blocking http calls allowed! This can cause a crash on iOS +-- In general we need a long term strategy to remove blocking http calls from all platforms +-- local isTouchDevice = UserInputService.TouchEnabled + settings()["Game Options"].CollisionSoundEnabled = true pcall(function() settings().Rendering.EnableFRM = true @@ -12,215 +28,268 @@ pcall(function() settings().Physics.Is30FpsThrottleEnabled = false end) pcall(function() - settings()["Task Scheduler"].PriorityMethod = Enum.PriorityMethod.AccumulatedError + settings()["Task Scheduler"].PriorityMethod = + Enum.PriorityMethod.AccumulatedError end) pcall(function() - settings().Physics.PhysicsEnvironmentalThrottle = Enum.EnviromentalPhysicsThrottle.DefaultAuto + settings().Physics.PhysicsEnvironmentalThrottle = + Enum.EnviromentalPhysicsThrottle.DefaultAuto end) + +-- arguments --------------------------------------- local threadSleepTime = ... + if threadSleepTime == nil then threadSleepTime = 15 end + local test = _IS_STUDIO_JOIN + print "! Joining game '_PLACE_ID' place _PLACE_ID at _SERVER_ADDRESS" -game:GetService("ChangeHistoryService"):SetEnabled(false) -game:GetService("ContentProvider"):SetThreadPool(16) -do - local _with_0 = game:GetService "InsertService" - _with_0:SetBaseSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=10&type=base" - _with_0:SetUserSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=20&type=user&userid=%d" - _with_0:SetCollectionUrl "http://banland.xyz/game/tools/insertasset?sid=%d" - _with_0:SetAssetUrl "http://banland.xyz/Asset/?id=%d" - _with_0:SetAssetVersionUrl "http://banland.xyz/asset/?assetversionid=%d" -end -do - local _with_0 = game:GetService "SocialService" - pcall(function() - return _with_0:SetFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsFriendsWith&playerid=%d&userid=%d" - end) - pcall(function() - return _with_0:SetBestFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsBestFriendsWith&playerid=%d&userid=%d" - end) - pcall(function() - return _with_0:SetGroupUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=%d&groupid=%d" - end) - pcall(function() - return _with_0:SetGroupRankUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=%d&groupid=%d" - end) - pcall(function() - return _with_0:SetGroupRoleUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRole&playerid=%d&groupid=%d" - end) -end + +ChangeHistoryService:SetEnabled(false) +ContentProvider:SetThreadPool(16) +InsertService:SetBaseSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=10&type=base" +InsertService:SetUserSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=20&type=user&userid=%d" +InsertService:SetCollectionUrl "http://banland.xyz/game/tools/insertasset?sid=%d" +InsertService:SetAssetUrl "http://banland.xyz/Asset/?id=%d" +InsertService:SetAssetVersionUrl "http://banland.xyz/Asset/?assetversionid=%d" + pcall(function() - return game:GetService("GamePassService") - :SetPlayerHasPassUrl "http://banland.xyz/Game/GamePass/GamePassHandler.ashx?Action=HasPass&UserID=%d&PassID=%d" + SocialService:SetFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsFriendsWith&playerid=%d&userid=%d" end) pcall(function() - return game:GetService("MarketplaceService") - :SetProductInfoUrl "https://banland.xyz/marketplace/productinfo?assetId=%d" + SocialService:SetBestFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsBestFriendsWith&playerid=%d&userid=%d" end) pcall(function() - return game:GetService("MarketplaceService") - :SetPlayerOwnsAssetUrl "https://banland.xyz/ownership/hasasset?userId=%d&assetId=%d" + SocialService:SetGroupUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=%d&groupid=%d" end) pcall(function() - return game:SetCreatorID(_CREATOR_ID, Enum.CreatorType.User) + SocialService:SetGroupRankUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=%d&groupid=%d" end) pcall(function() - return game:GetService("Players"):SetChatStyle(Enum.ChatStyle.ClassicAndBubble) + SocialService:SetGroupRoleUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRole&playerid=%d&groupid=%d" end) +pcall(function() + GamePassService:SetPlayerHasPassUrl "http://banland.xyz/Game/GamePass/GamePassHandler.ashx?Action=HasPass&UserID=%d&PassID=%d" +end) +pcall(function() + MarketplaceService:SetProductInfoUrl "https://banland.xyz/marketplace/productinfo?assetId=%d" +end) +pcall(function() + MarketplaceService:SetPlayerOwnsAssetUrl "https://banland.xyz/ownership/hasasset?userId=%d&assetId=%d" +end) +pcall(function() + game:SetCreatorID(_CREATOR_ID, Enum.CreatorType.User) +end) + +-- Bubble chat. This is all-encapsulated to allow us to turn it off with a config setting +pcall(function() + Players:SetChatStyle(Enum.ChatStyle.ClassicAndBubble) +end) + local waitingForCharacter = false pcall(function() if settings().Network.MtuOverride == 0 then settings().Network.MtuOverride = 1400 end end) -client = game:GetService "NetworkClient" -visit = game:GetService "Visit" -setMessage = function(message) - return game:SetMessage((function() - do - return message - end - end)()) + +-- functions --------------------------------------- +function setMessage(message) + -- todo: animated "..." + game:SetMessage(message) end -showErrorWindow = function(message, _, _) - return game:SetMessage(message) + +function showErrorWindow(message, _, _) + game:SetMessage(message) end -reportError = function(err, message) - print("***ERROR*** " .. tostring(err)) + +function reportError(err, message) + print("***ERROR*** " .. err) if not test then - visit:SetUploadUrl "" + Visit:SetUploadUrl "" end - client:disconnect() + Client:Disconnect() wait(4) - return showErrorWindow("Error: " .. tostring(err), message, "Other") + showErrorWindow("Error: " .. err, message, "Other") end -onDisconnection = function(_, lostConnection) + +-- called when the client connection closes +function onDisconnection(_, lostConnection) if lostConnection then - return showErrorWindow("You have lost the connection to the game", "LostConnection", "LostConnection") + showErrorWindow( + "You have lost the connection to the game", + "LostConnection", + "LostConnection" + ) else - return showErrorWindow("This game has shut down", "Kick", "Kick") + showErrorWindow("This game has shut down", "Kick", "Kick") end end -requestCharacter = function(replicator) + +function requestCharacter(replicator) + -- prepare code for when the Character appears local connection connection = player.Changed:connect(function(property) if property == "Character" then game:ClearMessage() waitingForCharacter = false - return connection:disconnect() + connection:disconnect() end end) + setMessage "Requesting character" + local success, err = pcall(function() replicator:RequestCharacter() setMessage "Waiting for character" waitingForCharacter = true end) + if not success then reportError(err, "W4C") return end end -onConnectionAccepted = function(url, replicator) - local connectResolved, waitingForMarker = true, true + +-- called when the client connection is established +function onConnectionAccepted(url, replicator) + connectResolved = true + + local waitingForMarker = true + local success, err = pcall(function() if not test then - visit:SetPing("_PING_URL", 30) - end - do - game:SetMessageBrickCount() + Visit:SetPing("_PING_URL", 30) end + game:SetMessageBrickCount() + replicator.Disconnection:connect(onDisconnection) + + -- Wait for a marker to return before creating the Player local marker = replicator:SendMarker() - return marker.Received:connect(function() + + marker.Received:connect(function() waitingForMarker = false - return requestCharacter(replicator) + requestCharacter(replicator) end) end) + if not success then reportError(err, "ConnectionAccepted") return end + + -- TODO: report marker progress + while waitingForMarker do workspace:ZoomToExtents() wait(0.5) end end -onConnectionFailed = function(_, err) - return showErrorWindow( - "Failed to connect to the Game. (ID=" .. tostring(err) .. ")", - "ID" .. tostring(err), + +-- called when the client connection fails +function onConnectionFailed(_, error) + showErrorWindow( + "Failed to connect to the Game. (ID=" .. error .. ")", + "ID" .. error, "Other" ) end -onConnectionRejected = function() + +-- called when the client connection is rejected +function onConnectionRejected() connectionFailed:disconnect() - return showErrorWindow("This game is not available. Please try another", "WrongVersion", "WrongVersion") + showErrorWindow( + "This game is not available. Please try another", + "WrongVersion", + "WrongVersion" + ) end + local idled = false -onPlayerIdled = function(time) +function onPlayerIdled(time) if time > 20 * 60 then - showErrorWindow(string.format("You were disconnected for being idle %d minutes", time / 60), "Idle", "Idle") - client:disconnect() + showErrorWindow( + string.format( + "You were disconnected for being idle %d minutes", + time / 60 + ), + "Idle", + "Idle" + ) + Client:disconnect() if not idled then idled = true end end end + +-- main ------------------------------------------------------------ + pcall(function() - return settings().Diagnostics:LegacyScriptMode() + settings().Diagnostics:LegacyScriptMode() end) local success, err = pcall(function() game:SetRemoteBuildMode(true) + setMessage "Connecting to Server" - client.ConnectionAccepted:connect(onConnectionAccepted) - client.ConnectionRejected:connect(onConnectionRejected) - connectionFailed = client.ConnectionFailed:connect(onConnectionFailed) - client.Ticket = "" + Client.ConnectionAccepted:connect(onConnectionAccepted) + Client.ConnectionRejected:connect(onConnectionRejected) + connectionFailed = Client.ConnectionFailed:connect(onConnectionFailed) + Client.Ticket = "" + playerConnectSucces, player = pcall(function() - return client:PlayerConnect(_USER_ID, "_SERVER_ADDRESS", _SERVER_PORT, 0, threadSleepTime) + return Client:PlayerConnect( + _USER_ID, + "_SERVER_ADDRESS", + _SERVER_PORT, + 0, + threadSleepTime + ) end) if not playerConnectSucces then - player = game:GetService("Players"):CreateLocalPlayer(_USER_ID) - client:Connect("_SERVER_ADDRESS", _SERVER_PORT, 0, threadSleepTime) - end - if not test then - delay(300, function() end) - end - do - local _with_0 = player - _with_0:SetSuperSafeChat(false) - pcall(function() - return _with_0:SetUnder13(false) - end) - pcall(function() - return _with_0:SetMembershipType(Enum.MembershipType._MEMBERSHIP_TYPE) - end) - pcall(function() - return _with_0:SetAccountAge(1) - end) + --Old player connection scheme + player = Players:CreateLocalPlayer(_USER_ID) + Client:Connect("_SERVER_ADDRESS", _SERVER_PORT, 0, threadSleepTime) end + + player:SetSuperSafeChat(false) + pcall(function() + player:SetUnder13(false) + end) + pcall(function() + player:SetMembershipType(Enum.MembershipType._MEMBERSHIP_TYPE) + end) + pcall(function() + player:SetAccountAge(1) + end) player.Idled:connect(onPlayerIdled) + pcall(function() player.Name = [========[_USER_NAME]========] end) player.CharacterAppearance = "_CHAR_APPEARANCE" if not test then - return visit:SetUploadUrl "" + Visit:SetUploadUrl "" end end) + if not success then reportError(err, "CreatePlayer") end + if not test then + -- TODO: Async get? loadfile ""("", -1, 0) end + pcall(function() - return game:SetScreenshotInfo "" + game:SetScreenshotInfo "" end) -return pcall(function() - return game:SetVideoInfo 'GamesROBLOX, video, free game, online virtual world' +pcall(function() + game:SetVideoInfo 'GamesMercury, video, free game, online virtual world' end) +-- use single quotes here because the video info string may have unescaped double quotes diff --git a/lua/studio.lua b/lua/studio.lua index d4d531c..9a42e39 100644 --- a/lua/studio.lua +++ b/lua/studio.lua @@ -1,60 +1,63 @@ print "[Mercury]: Loaded Studio corescript" -do - local _with_0 = game:GetService "InsertService" - pcall(function() - return _with_0:SetFreeModelUrl "http://banland.xyz/game/tools/insertasset?type=fm&q=%s&pg=%d&rs=%d" - end) - pcall(function() - return _with_0:SetFreeDecalUrl "http://banland.xyz/game/tools/insertasset?type=fd&q=%s&pg=%d&rs=%d" - end) - game:GetService("ScriptInformationProvider"):SetAssetUrl "http://banland.xyz/Asset/" - _with_0:SetBaseSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=10&type=base" - _with_0:SetUserSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=20&type=user&userid=%d" - _with_0:SetCollectionUrl "http://banland.xyz/game/tools/insertasset?sid=%d" - _with_0:SetAssetUrl "http://banland.xyz/Asset/?id=%d" - _with_0:SetAssetVersionUrl "http://banland.xyz/asset/?assetversionid=%d" - _with_0:SetTrustLevel(0) -end -do - local _with_0 = game:GetService "SocialService" - pcall(function() - return _with_0:SetFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsFriendsWith&playerid=%d&userid=%d" - end) - pcall(function() - return _with_0:SetBestFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsBestFriendsWith&playerid=%d&userid=%d" - end) - pcall(function() - return _with_0:SetGroupUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=%d&groupid=%d" - end) - pcall(function() - return _with_0:SetGroupRankUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=%d&groupid=%d" - end) - pcall(function() - return _with_0:SetGroupRoleUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRole&playerid=%d&groupid=%d" - end) -end +local MarketplaceService = game:GetService "MarketplaceService" +local InsertService = game:GetService "InsertService" +local SocialService = game:GetService "SocialService" +local GamePassService = game:GetService "GamePassService" +local ScriptInformationProvider = game:GetService "ScriptInformationProvider" +local ScriptContext = game:GetService "ScriptContext" +-- Setup studio cmd bar & load core scripts pcall(function() - return game:GetService("GamePassService") - :SetPlayerHasPassUrl "http://banland.xyz/Game/GamePass/GamePassHandler.ashx?Action=HasPass&UserID=%d&PassID=%d" + InsertService:SetFreeModelUrl "http://banland.xyz/game/tools/insertasset?type=fm&q=%s&pg=%d&rs=%d" end) -do - local _with_0 = game:GetService "MarketplaceService" - pcall(function() - return _with_0:SetProductInfoUrl "https://banland.xyz/marketplace/productinfo?assetId=%d" - end) - pcall(function() - return _with_0:SetDevProductInfoUrl "https://banland.xyz/marketplace/productDetails?productId=%d" - end) - pcall(function() - return _with_0:SetPlayerOwnsAssetUrl "https://banland.xyz/ownership/hasasset?userId=%d&assetId=%d" - end) -end +pcall(function() + InsertService:SetFreeDecalUrl "http://banland.xyz/game/tools/insertasset?type=fd&q=%s&pg=%d&rs=%d" +end) + +ScriptInformationProvider:SetAssetUrl "http://banland.xyz/Asset/" +InsertService:SetBaseSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=10&type=base" +InsertService:SetUserSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=20&type=user&userid=%d" +InsertService:SetCollectionUrl "http://banland.xyz/game/tools/insertasset?sid=%d" +InsertService:SetAssetUrl "http://banland.xyz/Asset/?id=%d" +InsertService:SetAssetVersionUrl "http://banland.xyz/Asset/?assetversionid=%d" +InsertService:SetTrustLevel(0) + +pcall(function() + SocialService:SetFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsFriendsWith&playerid=%d&userid=%d" +end) +pcall(function() + SocialService:SetBestFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsBestFriendsWith&playerid=%d&userid=%d" +end) +pcall(function() + SocialService:SetGroupUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=%d&groupid=%d" +end) +pcall(function() + SocialService:SetGroupRankUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=%d&groupid=%d" +end) +pcall(function() + SocialService:SetGroupRoleUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRole&playerid=%d&groupid=%d" +end) +pcall(function() + GamePassService:SetPlayerHasPassUrl "http://banland.xyz/Game/GamePass/GamePassHandler.ashx?Action=HasPass&UserID=%d&PassID=%d" +end) +pcall(function() + MarketplaceService:SetProductInfoUrl "https://banland.xyz/marketplace/productinfo?assetId=%d" +end) +pcall(function() + MarketplaceService:SetDevProductInfoUrl "https://banland.xyz/marketplace/productDetails?productId=%d" +end) +pcall(function() + MarketplaceService:SetPlayerOwnsAssetUrl "https://banland.xyz/ownership/hasasset?userId=%d&assetId=%d" +end) + local result, _ = pcall(function() - return game:GetService("ScriptContext"):AddStarterScript(37801172) + ScriptContext:AddStarterScript(37801172) end) if not result then - return pcall(function() - return game:GetService("ScriptContext") - :AddCoreScript(37801172, game:GetService("ScriptContext", "StarterScript")) + pcall(function() + ScriptContext:AddCoreScript( + 37801172, + game:GetService "ScriptContext", + "StarterScript" + ) end) end diff --git a/lua/visit.lua b/lua/visit.lua index 996a6df..803ebf5 100644 --- a/lua/visit.lua +++ b/lua/visit.lua @@ -1,127 +1,147 @@ print "[Mercury]: Loaded Visit corescript" +local ChangeHistoryService = game:GetService "ChangeHistoryService" +local InsertService = game:GetService "InsertService" +local Players = game:GetService "Players" +local RunService = game:GetService "RunService" +local ScriptInformationProvider = game:GetService "ScriptInformationProvider" +local SocialService = game:GetService "SocialService" +local CoreGui = game:GetService "CoreGui" +local ContentProvider = game:GetService "ContentProvider" +local GamePassService = game:GetService "GamePassService" +local Visit = game:GetService "Visit" +local ScriptContext = game:GetService "ScriptContext" + +-- Prepended to Edit.lua and Visit.lua and Studio.lua and PlaySolo.lua-- + do pcall(function() return game:SetPlaceID(_PLACE_ID) end) end -local visit, message = game:GetService "Visit", Instance.new "Message" +local message = Instance.new "Message" + message.Parent = workspace message.archivable = false -game:GetService("ScriptInformationProvider"):SetAssetUrl "http://banland.xyz/Asset/" -game:GetService("ContentProvider"):SetThreadPool(16) + +ScriptInformationProvider:SetAssetUrl "http://banland.xyz/Asset/" +ContentProvider:SetThreadPool(16) pcall(function() - return game:GetService("InsertService") - :SetFreeModelUrl "http://banland.xyz/game/tools/insertasset?type=fm&q=%s&pg=%d&rs=%d" -end) + InsertService:SetFreeModelUrl "http://banland.xyz/game/tools/insertasset?type=fm&q=%s&pg=%d&rs=%d" +end) -- Used for free model search (insert tool) pcall(function() - return game:GetService("InsertService") - :SetFreeDecalUrl "http://banland.xyz/game/tools/insertasset?type=fd&q=%s&pg=%d&rs=%d" -end) + InsertService:SetFreeDecalUrl "http://banland.xyz/game/tools/insertasset?type=fd&q=%s&pg=%d&rs=%d" +end) -- Used for free decal search (insert tool) + settings().Diagnostics:LegacyScriptMode() -do - local _with_0 = game:GetService "InsertService" - _with_0:SetBaseSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=10&type=base" - _with_0:SetUserSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=20&type=user&userid=%d" - _with_0:SetCollectionUrl "http://banland.xyz/game/tools/insertasset?sid=%d" - _with_0:SetAssetUrl "http://banland.xyz/Asset/?id=%d" - _with_0:SetAssetVersionUrl "http://banland.xyz/asset/?assetversionid=%d" -end -do - local _with_0 = game:GetService "SocialService" - pcall(function() - return _with_0:SetFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsFriendsWith&playerid=%d&userid=%d" - end) - pcall(function() - return _with_0:SetBestFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsBestFriendsWith&playerid=%d&userid=%d" - end) - pcall(function() - return _with_0:SetGroupUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=%d&groupid=%d" - end) - pcall(function() - return _with_0:SetGroupRankUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=%d&groupid=%d" - end) - pcall(function() - return _with_0:SetGroupRoleUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRole&playerid=%d&groupid=%d" - end) -end + +InsertService:SetBaseSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=10&type=base" +InsertService:SetUserSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=20&type=user&userid=%d" +InsertService:SetCollectionUrl "http://banland.xyz/game/tools/insertasset?sid=%d" +InsertService:SetAssetUrl "http://banland.xyz/Asset/?id=%d" +InsertService:SetAssetVersionUrl "http://banland.xyz/Asset/?assetversionid=%d" + pcall(function() - return game:GetService("GamePassService") - :SetPlayerHasPassUrl "http://banland.xyz/Game/GamePass/GamePassHandler.ashx?Action=HasPass&UserID=%d&PassID=%d" + SocialService:SetFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsFriendsWith&playerid=%d&userid=%d" end) pcall(function() - return game:SetCreatorID(0, Enum.CreatorType.User) + SocialService:SetBestFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsBestFriendsWith&playerid=%d&userid=%d" end) pcall(function() - return game:SetScreenshotInfo "" + SocialService:SetGroupUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=%d&groupid=%d" end) pcall(function() - return game:SetVideoInfo "" + SocialService:SetGroupRankUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=%d&groupid=%d" end) +pcall(function() + SocialService:SetGroupRoleUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRole&playerid=%d&groupid=%d" +end) +pcall(function() + GamePassService:SetPlayerHasPassUrl "http://banland.xyz/Game/GamePass/GamePassHandler.ashx?Action=HasPass&UserID=%d&PassID=%d" +end) +pcall(function() + game:SetCreatorID(0, Enum.CreatorType.User) +end) + +pcall(function() + game:SetScreenshotInfo "" +end) +pcall(function() + game:SetVideoInfo "" +end) + pcall(function() settings().Rendering.EnableFRM = true end) pcall(function() - settings()["Task Scheduler"].PriorityMethod = Enum.PriorityMethod.AccumulatedError + settings()["Task Scheduler"].PriorityMethod = + Enum.PriorityMethod.AccumulatedError end) -game:GetService("ChangeHistoryService"):SetEnabled(false) + +ChangeHistoryService:SetEnabled(false) pcall(function() - return game:GetService("Players") - :SetBuildUserPermissionsUrl "http://banland.xyz/Game/BuildActionPermissionCheck.ashx?assetId=0&userId=%d&isSolo=true" + Players:SetBuildUserPermissionsUrl "http://banland.xyz/Game/BuildActionPermissionCheck.ashx?assetId=0&userId=%d&isSolo=true" end) + workspace:SetPhysicsThrottleEnabled(true) -local addedBuildTools, screenGui, doVisit = false, game:GetService("CoreGui"):FindFirstChild "RobloxGui", nil -doVisit = function() + +local addedBuildTools = false +local screenGui = CoreGui:FindFirstChild "RobloxGui" + +function doVisit() message.Text = "Loading Game" - do - pcall(function() - return visit:SetUploadUrl "" - end) - end + + pcall(function() + Visit:SetUploadUrl "" + end) message.Text = "Running" - game:GetService("RunService"):Run() + RunService:Run() + message.Text = "Creating Player" - do - player = game:GetService("Players"):CreateLocalPlayer(0) - end + + player = game:GetService("Players"):CreateLocalPlayer(0) player.CharacterAppearance = "" local propExists, canAutoLoadChar = false, false propExists = pcall(function() canAutoLoadChar = game.Players.CharacterAutoLoads end) + if (propExists and canAutoLoadChar) or not propExists then player:LoadCharacter() end + message.Text = "Setting GUI" player:SetSuperSafeChat(true) pcall(function() - return player:SetMembershipType(Enum.MembershipType.None) + player:SetMembershipType(Enum.MembershipType.None) end) pcall(function() - return player:SetAccountAge(0) + player:SetAccountAge(0) end) end -local success, err = pcall(doVisit) + +success, err = pcall(doVisit) + if not addedBuildTools then - do - local _with_0 = Instance.new "StringValue" - _with_0.Name = "PlayerName" - _with_0.Value = player.Name - _with_0.RobloxLocked = true - _with_0.Parent = screenGui - end + local playerName = Instance.new "StringValue" + playerName.Name = "PlayerName" + playerName.Value = player.Name + playerName.RobloxLocked = true + playerName.Parent = screenGui + pcall(function() - return game:GetService("ScriptContext"):AddCoreScript(59431535, screenGui, "BuildToolsScript") + ScriptContext:AddCoreScript(59431535, screenGui, "BuildToolsScript") end) addedBuildTools = true end + if success then message.Parent = nil else print(err) wait(5) - message.Text = "Error on visit: " .. tostring(err) + message.Text = "Error on visit: " .. err end diff --git a/stylua.toml b/stylua.toml index 6342351..91aa655 100644 --- a/stylua.toml +++ b/stylua.toml @@ -1,4 +1,4 @@ -column_width = 120 +column_width = 80 line_endings = "Unix" indent_type = "Tabs" indent_width = 4