Fuck with the CoreScripts despite task telling me very clearly not to fuck with the corescripts
This commit is contained in:
parent
26dfa13ee3
commit
bb1eb0faa6
466
107893730.lua
466
107893730.lua
|
|
@ -4,13 +4,13 @@
|
||||||
while not Game do
|
while not Game do
|
||||||
wait(0.1)
|
wait(0.1)
|
||||||
end
|
end
|
||||||
while not game:GetService("MarketplaceService") do
|
while not game:GetService "MarketplaceService" do
|
||||||
wait(0.1)
|
wait(0.1)
|
||||||
end
|
end
|
||||||
while not game:FindFirstChild("CoreGui") do
|
while not game:FindFirstChild "CoreGui" do
|
||||||
wait(0.1)
|
wait(0.1)
|
||||||
end
|
end
|
||||||
while not game.CoreGui:FindFirstChild("RobloxGui") do
|
while not game.CoreGui:FindFirstChild "RobloxGui" do
|
||||||
wait(0.1)
|
wait(0.1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -41,18 +41,30 @@ local smallScreenThreshold = 450
|
||||||
-- user facing images
|
-- user facing images
|
||||||
local assetUrls = {}
|
local assetUrls = {}
|
||||||
local assetUrl = "http://www.roblox.com/Asset/?id="
|
local assetUrl = "http://www.roblox.com/Asset/?id="
|
||||||
local errorImageUrl = assetUrl .. "42557901" table.insert(assetUrls, errorImageUrl)
|
local errorImageUrl = assetUrl .. "42557901"
|
||||||
local buyImageUrl = assetUrl .. "104651457" table.insert(assetUrls,buyImageUrl)
|
table.insert(assetUrls, errorImageUrl)
|
||||||
local buyImageDownUrl = assetUrl .. "104651515" table.insert(assetUrls, buyImageDownUrl)
|
local buyImageUrl = assetUrl .. "104651457"
|
||||||
local buyImageDisabledUrl = assetUrl .. "104651532" table.insert(assetUrls, buyImageDisabledUrl)
|
table.insert(assetUrls, buyImageUrl)
|
||||||
local cancelButtonImageUrl = assetUrl .. "104651592" table.insert(assetUrls, cancelButtonImageUrl)
|
local buyImageDownUrl = assetUrl .. "104651515"
|
||||||
local cancelButtonDownUrl = assetUrl .. "104651639" table.insert(assetUrls, cancelButtonDownUrl)
|
table.insert(assetUrls, buyImageDownUrl)
|
||||||
local okButtonUrl = assetUrl .. "104651665" table.insert(assetUrls, okButtonUrl)
|
local buyImageDisabledUrl = assetUrl .. "104651532"
|
||||||
local okButtonPressedrl = assetUrl .."104651707" table.insert(assetUrls, okButtonPressedrl)
|
table.insert(assetUrls, buyImageDisabledUrl)
|
||||||
local freeButtonImageUrl = assetUrl .. "104651733" table.insert(assetUrls, freeButtonImageUrl)
|
local cancelButtonImageUrl = assetUrl .. "104651592"
|
||||||
local freeButtonImageDownUrl = assetUrl .. "104651761" table.insert(assetUrls, freeButtonImageDownUrl)
|
table.insert(assetUrls, cancelButtonImageUrl)
|
||||||
local tixIcon = assetUrl .. "102481431" table.insert(assetUrls,tixIcon)
|
local cancelButtonDownUrl = assetUrl .. "104651639"
|
||||||
local robuxIcon = assetUrl .. "102481419" table.insert(assetUrls,robuxIcon)
|
table.insert(assetUrls, cancelButtonDownUrl)
|
||||||
|
local okButtonUrl = assetUrl .. "104651665"
|
||||||
|
table.insert(assetUrls, okButtonUrl)
|
||||||
|
local okButtonPressedrl = assetUrl .. "104651707"
|
||||||
|
table.insert(assetUrls, okButtonPressedrl)
|
||||||
|
local freeButtonImageUrl = assetUrl .. "104651733"
|
||||||
|
table.insert(assetUrls, freeButtonImageUrl)
|
||||||
|
local freeButtonImageDownUrl = assetUrl .. "104651761"
|
||||||
|
table.insert(assetUrls, freeButtonImageDownUrl)
|
||||||
|
local tixIcon = assetUrl .. "102481431"
|
||||||
|
table.insert(assetUrls, tixIcon)
|
||||||
|
local robuxIcon = assetUrl .. "102481419"
|
||||||
|
table.insert(assetUrls, robuxIcon)
|
||||||
|
|
||||||
-- user facing string
|
-- user facing string
|
||||||
local buyHeaderText = "Buy"
|
local buyHeaderText = "Buy"
|
||||||
|
|
@ -63,16 +75,14 @@ local errorPurchasesDisabledText = "in-game purchases are disabled"
|
||||||
local errorPurchasesUnknownText = "Roblox is performing maintenance"
|
local errorPurchasesUnknownText = "Roblox is performing maintenance"
|
||||||
|
|
||||||
local purchaseSucceededText = "Your purchase of itemName succeeded!"
|
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 purchaseFailedText =
|
||||||
local itemPurchaseText = "Would you like to buy the assetType 'itemName' for currencyType currencyAmount?"
|
"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 productPurchaseText = "Would you like to buy 'itemName' for currencyType currencyAmount?"
|
||||||
local freeItemPurchaseText = "Would you like to take the assetType 'itemName' for FREE?"
|
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 freeItemBalanceText = "Your balance of Robux or Tix will not be affected by this transaction."
|
||||||
|
|
||||||
local buildsClubUpsellText = "You don't have the appropriate membership to buy this item. Please click here to upgrade your builders club"
|
|
||||||
-------------------------------- End Global Variables ----------------------------------------
|
-------------------------------- End Global Variables ----------------------------------------
|
||||||
|
|
||||||
|
|
||||||
----------------------------- Util Functions ---------------------------------------------
|
----------------------------- Util Functions ---------------------------------------------
|
||||||
function getSecureApiBaseUrl()
|
function getSecureApiBaseUrl()
|
||||||
local secureApiUrl = baseUrl
|
local secureApiUrl = baseUrl
|
||||||
|
|
@ -83,7 +93,7 @@ end
|
||||||
|
|
||||||
function getRbxUtility()
|
function getRbxUtility()
|
||||||
if not RbxUtility then
|
if not RbxUtility then
|
||||||
RbxUtility = LoadLibrary("RbxUtility")
|
RbxUtility = LoadLibrary "RbxUtility"
|
||||||
end
|
end
|
||||||
return RbxUtility
|
return RbxUtility
|
||||||
end
|
end
|
||||||
|
|
@ -95,7 +105,6 @@ function preloadAssets()
|
||||||
end
|
end
|
||||||
----------------------------- End Util Functions ---------------------------------------------
|
----------------------------- End Util Functions ---------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
-------------------------------- Accept/Decline Functions --------------------------------------
|
-------------------------------- Accept/Decline Functions --------------------------------------
|
||||||
function removeCurrentPurchaseInfo()
|
function removeCurrentPurchaseInfo()
|
||||||
currentAssetId = nil
|
currentAssetId = nil
|
||||||
|
|
@ -110,19 +119,27 @@ function removeCurrentPurchaseInfo()
|
||||||
end
|
end
|
||||||
|
|
||||||
function closePurchasePrompt()
|
function closePurchasePrompt()
|
||||||
purchaseDialog:TweenPosition(hidePosition, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, tweenTime, true, function()
|
purchaseDialog:TweenPosition(
|
||||||
|
hidePosition,
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quad,
|
||||||
|
tweenTime,
|
||||||
|
true,
|
||||||
|
function()
|
||||||
game.GuiService:RemoveCenterDialog(purchaseDialog)
|
game.GuiService:RemoveCenterDialog(purchaseDialog)
|
||||||
hidePurchasing()
|
hidePurchasing()
|
||||||
purchaseDialog.Visible = false
|
purchaseDialog.Visible = false
|
||||||
currentlyPrompting = false
|
currentlyPrompting = false
|
||||||
end)
|
end
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function userPurchaseActionsEnded(isSuccess)
|
function userPurchaseActionsEnded(isSuccess)
|
||||||
checkingPlayerFunds = false
|
checkingPlayerFunds = false
|
||||||
|
|
||||||
if isSuccess then -- show the user we bought the item successfully, when they close this dialog we will call signalPromptEnded
|
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"]))
|
local newPurchasedSucceededText =
|
||||||
|
string.gsub(purchaseSucceededText, "itemName", tostring(currentProductInfo["Name"]))
|
||||||
purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = newPurchasedSucceededText
|
purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = newPurchasedSucceededText
|
||||||
setButtonsVisible(purchaseDialog.BodyFrame.OkPurchasedButton)
|
setButtonsVisible(purchaseDialog.BodyFrame.OkPurchasedButton)
|
||||||
hidePurchasing()
|
hidePurchasing()
|
||||||
|
|
@ -134,9 +151,11 @@ end
|
||||||
function signalPromptEnded(isSuccess)
|
function signalPromptEnded(isSuccess)
|
||||||
closePurchasePrompt()
|
closePurchasePrompt()
|
||||||
if purchasingConsumable then
|
if purchasingConsumable then
|
||||||
game:GetService("MarketplaceService"):SignalPromptProductPurchaseFinished(game.Players.LocalPlayer.userId, currentProductId, isSuccess)
|
game:GetService("MarketplaceService")
|
||||||
|
:SignalPromptProductPurchaseFinished(game.Players.LocalPlayer.userId, currentProductId, isSuccess)
|
||||||
else
|
else
|
||||||
game:GetService("MarketplaceService"):SignalPromptPurchaseFinished(game.Players.LocalPlayer, currentAssetId, isSuccess)
|
game:GetService("MarketplaceService")
|
||||||
|
:SignalPromptPurchaseFinished(game.Players.LocalPlayer, currentAssetId, isSuccess)
|
||||||
end
|
end
|
||||||
removeCurrentPurchaseInfo()
|
removeCurrentPurchaseInfo()
|
||||||
end
|
end
|
||||||
|
|
@ -152,11 +171,13 @@ function updatePurchasePromptData(toggleColoredText)
|
||||||
|
|
||||||
if isFreeItem() then
|
if isFreeItem() then
|
||||||
newItemDescription = string.gsub(freeItemPurchaseText, "itemName", tostring(currentProductInfo["Name"]))
|
newItemDescription = string.gsub(freeItemPurchaseText, "itemName", tostring(currentProductInfo["Name"]))
|
||||||
newItemDescription = string.gsub( newItemDescription,"assetType", tostring(assetTypeToString(currentProductInfo["AssetTypeId"])) )
|
newItemDescription =
|
||||||
|
string.gsub(newItemDescription, "assetType", tostring(assetTypeToString(currentProductInfo["AssetTypeId"])))
|
||||||
setHeaderText(takeHeaderText)
|
setHeaderText(takeHeaderText)
|
||||||
else -- otherwise item costs something, so different prompt
|
else -- otherwise item costs something, so different prompt
|
||||||
newItemDescription = string.gsub(productPurchaseText, "itemName", tostring(currentProductInfo["Name"]))
|
newItemDescription = string.gsub(productPurchaseText, "itemName", tostring(currentProductInfo["Name"]))
|
||||||
newItemDescription = string.gsub( newItemDescription,"currencyType", tostring(currencyTypeToString(currentCurrencyType)) )
|
newItemDescription =
|
||||||
|
string.gsub(newItemDescription, "currencyType", tostring(currencyTypeToString(currentCurrencyType)))
|
||||||
newItemDescription = string.gsub(newItemDescription, "currencyAmount", tostring(currentCurrencyAmount))
|
newItemDescription = string.gsub(newItemDescription, "currencyAmount", tostring(currentCurrencyAmount))
|
||||||
setHeaderText(buyHeaderText)
|
setHeaderText(buyHeaderText)
|
||||||
end
|
end
|
||||||
|
|
@ -164,9 +185,15 @@ function updatePurchasePromptData(toggleColoredText)
|
||||||
purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = newItemDescription
|
purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = newItemDescription
|
||||||
|
|
||||||
if purchasingConsumable then
|
if purchasingConsumable then
|
||||||
purchaseDialog.BodyFrame.ItemPreview.Image = baseUrl .. "thumbs/asset.ashx?assetid=" .. tostring(currentProductInfo["IconImageAssetId"]) .. '&x=100&y=100&format=png'
|
purchaseDialog.BodyFrame.ItemPreview.Image = baseUrl
|
||||||
|
.. "thumbs/asset.ashx?assetid="
|
||||||
|
.. tostring(currentProductInfo["IconImageAssetId"])
|
||||||
|
.. "&x=100&y=100&format=png"
|
||||||
else
|
else
|
||||||
purchaseDialog.BodyFrame.ItemPreview.Image = baseUrl .. "thumbs/asset.ashx?assetid=" .. tostring(currentAssetId) .. '&x=100&y=100&format=png'
|
purchaseDialog.BodyFrame.ItemPreview.Image = baseUrl
|
||||||
|
.. "thumbs/asset.ashx?assetid="
|
||||||
|
.. tostring(currentAssetId)
|
||||||
|
.. "&x=100&y=100&format=png"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -183,7 +210,11 @@ function doPlayerFundsCheck(checkIndefinitely)
|
||||||
end
|
end
|
||||||
if canPurchase and not insufficientFunds then
|
if canPurchase and not insufficientFunds then
|
||||||
-- we can buy item! set our buttons up and we will exit this loop
|
-- we can buy item! set our buttons up and we will exit this loop
|
||||||
setButtonsVisible(purchaseDialog.BodyFrame.BuyButton,purchaseDialog.BodyFrame.CancelButton, purchaseDialog.BodyFrame.AfterBalanceButton)
|
setButtonsVisible(
|
||||||
|
purchaseDialog.BodyFrame.BuyButton,
|
||||||
|
purchaseDialog.BodyFrame.CancelButton,
|
||||||
|
purchaseDialog.BodyFrame.AfterBalanceButton
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -198,32 +229,58 @@ function showPurchasePrompt()
|
||||||
purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = descText
|
purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = descText
|
||||||
purchaseDialog.BodyFrame.AfterBalanceButton.Visible = false
|
purchaseDialog.BodyFrame.AfterBalanceButton.Visible = false
|
||||||
end
|
end
|
||||||
game.GuiService:AddCenterDialog(purchaseDialog, Enum.CenterDialogType.ModalDialog,
|
game.GuiService:AddCenterDialog(
|
||||||
|
purchaseDialog,
|
||||||
|
Enum.CenterDialogType.ModalDialog,
|
||||||
--ShowFunction
|
--ShowFunction
|
||||||
function()
|
function()
|
||||||
-- set the state for our buttons
|
-- set the state for our buttons
|
||||||
purchaseDialog.Visible = true
|
purchaseDialog.Visible = true
|
||||||
if isFreeItem() then
|
if isFreeItem() then
|
||||||
setButtonsVisible(purchaseDialog.BodyFrame.FreeButton, purchaseDialog.BodyFrame.CancelButton, purchaseDialog.BodyFrame.AfterBalanceButton)
|
setButtonsVisible(
|
||||||
|
purchaseDialog.BodyFrame.FreeButton,
|
||||||
|
purchaseDialog.BodyFrame.CancelButton,
|
||||||
|
purchaseDialog.BodyFrame.AfterBalanceButton
|
||||||
|
)
|
||||||
elseif notRightBC then
|
elseif notRightBC then
|
||||||
purchaseDialog.BodyFrame.AfterBalanceButton.Text = "You require an upgrade to your Builders Club membership to purchase this item. Click here to upgrade."
|
purchaseDialog.BodyFrame.AfterBalanceButton.Text =
|
||||||
|
"You require an upgrade to your Builders Club membership to purchase this item. Click here to upgrade."
|
||||||
if not openBCUpSellWindowConnection then
|
if not openBCUpSellWindowConnection then
|
||||||
openBCUpSellWindowConnection = purchaseDialog.BodyFrame.AfterBalanceButton.MouseButton1Click:connect(function()
|
openBCUpSellWindowConnection = purchaseDialog.BodyFrame.AfterBalanceButton.MouseButton1Click:connect(
|
||||||
if purchaseDialog.BodyFrame.AfterBalanceButton.Text == "You require an upgrade to your Builders Club membership to purchase this item. Click here to upgrade." then
|
function()
|
||||||
|
if
|
||||||
|
purchaseDialog.BodyFrame.AfterBalanceButton.Text
|
||||||
|
== "You require an upgrade to your Builders Club membership to purchase this item. Click here to upgrade."
|
||||||
|
then
|
||||||
openBCUpSellWindow()
|
openBCUpSellWindow()
|
||||||
end
|
end
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
setButtonsVisible(purchaseDialog.BodyFrame.BuyDisabledButton, purchaseDialog.BodyFrame.CancelButton, purchaseDialog.BodyFrame.AfterBalanceButton)
|
)
|
||||||
|
end
|
||||||
|
setButtonsVisible(
|
||||||
|
purchaseDialog.BodyFrame.BuyDisabledButton,
|
||||||
|
purchaseDialog.BodyFrame.CancelButton,
|
||||||
|
purchaseDialog.BodyFrame.AfterBalanceButton
|
||||||
|
)
|
||||||
elseif insufficientFunds then
|
elseif insufficientFunds then
|
||||||
setButtonsVisible(purchaseDialog.BodyFrame.BuyDisabledButton, purchaseDialog.BodyFrame.CancelButton, purchaseDialog.BodyFrame.AfterBalanceButton)
|
setButtonsVisible(
|
||||||
|
purchaseDialog.BodyFrame.BuyDisabledButton,
|
||||||
|
purchaseDialog.BodyFrame.CancelButton,
|
||||||
|
purchaseDialog.BodyFrame.AfterBalanceButton
|
||||||
|
)
|
||||||
elseif override then
|
elseif override then
|
||||||
setButtonsVisible(purchaseDialog.BodyFrame.BuyDisabledButton, purchaseDialog.BodyFrame.CancelButton) -- , purchaseDialog.BodyFrame.AfterBalanceButton)
|
setButtonsVisible(purchaseDialog.BodyFrame.BuyDisabledButton, purchaseDialog.BodyFrame.CancelButton) -- , purchaseDialog.BodyFrame.AfterBalanceButton)
|
||||||
else
|
else
|
||||||
setButtonsVisible(purchaseDialog.BodyFrame.BuyButton, purchaseDialog.BodyFrame.CancelButton) -- , purchaseDialog.BodyFrame.AfterBalanceButton)
|
setButtonsVisible(purchaseDialog.BodyFrame.BuyButton, purchaseDialog.BodyFrame.CancelButton) -- , purchaseDialog.BodyFrame.AfterBalanceButton)
|
||||||
end
|
end
|
||||||
|
|
||||||
purchaseDialog:TweenPosition(showPosition, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, tweenTime, true)
|
purchaseDialog:TweenPosition(
|
||||||
|
showPosition,
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quad,
|
||||||
|
tweenTime,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
|
||||||
if canPurchase and insufficientFunds and not enableBrowserWindowClosedEvent then
|
if canPurchase and insufficientFunds and not enableBrowserWindowClosedEvent then
|
||||||
checkingPlayerFunds = true
|
checkingPlayerFunds = true
|
||||||
|
|
@ -233,7 +290,8 @@ function showPurchasePrompt()
|
||||||
--HideFunction
|
--HideFunction
|
||||||
function()
|
function()
|
||||||
purchaseDialog.Visible = false
|
purchaseDialog.Visible = false
|
||||||
end)
|
end
|
||||||
|
)
|
||||||
else -- we failed in prompting a purchase, do a decline
|
else -- we failed in prompting a purchase, do a decline
|
||||||
doDeclinePurchase()
|
doDeclinePurchase()
|
||||||
end
|
end
|
||||||
|
|
@ -242,15 +300,17 @@ end
|
||||||
-- given an asset id, this function will grab that asset from the website, and return the first "Tool" object found inside it
|
-- given an asset id, this function will grab that asset from the website, and return the first "Tool" object found inside it
|
||||||
function getToolAssetID(assetID)
|
function getToolAssetID(assetID)
|
||||||
local newTool = game:GetService("InsertService"):LoadAsset(assetID)
|
local newTool = game:GetService("InsertService"):LoadAsset(assetID)
|
||||||
if not newTool then return nil end
|
if not newTool then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
if newTool:IsA("Tool") then
|
if newTool:IsA "Tool" then
|
||||||
return newTool
|
return newTool
|
||||||
end
|
end
|
||||||
|
|
||||||
local toolChildren = newTool:GetChildren()
|
local toolChildren = newTool:GetChildren()
|
||||||
for i = 1, #toolChildren do
|
for i = 1, #toolChildren do
|
||||||
if toolChildren[i]:IsA("Tool") then
|
if toolChildren[i]:IsA "Tool" then
|
||||||
return toolChildren[i]
|
return toolChildren[i]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -261,11 +321,14 @@ end
|
||||||
-- let them know their account was not charged, and that they do not own the item yet.
|
-- let them know their account was not charged, and that they do not own the item yet.
|
||||||
function purchaseFailed(inGamePurchasesDisabled)
|
function purchaseFailed(inGamePurchasesDisabled)
|
||||||
local name = "Item"
|
local name = "Item"
|
||||||
if currentProductInfo then name = currentProductInfo["Name"] end
|
if currentProductInfo then
|
||||||
|
name = currentProductInfo["Name"]
|
||||||
|
end
|
||||||
|
|
||||||
local newPurchasedFailedText = string.gsub(purchaseFailedText, "itemName", tostring(name))
|
local newPurchasedFailedText = string.gsub(purchaseFailedText, "itemName", tostring(name))
|
||||||
if inGamePurchasesDisabled then
|
if inGamePurchasesDisabled then
|
||||||
newPurchasedFailedText = string.gsub( newPurchasedFailedText,"errorReason", tostring(errorPurchasesDisabledText) )
|
newPurchasedFailedText =
|
||||||
|
string.gsub(newPurchasedFailedText, "errorReason", tostring(errorPurchasesDisabledText))
|
||||||
else
|
else
|
||||||
newPurchasedFailedText = string.gsub(newPurchasedFailedText, "errorReason", tostring(errorPurchasesUnknownText))
|
newPurchasedFailedText = string.gsub(newPurchasedFailedText, "errorReason", tostring(errorPurchasesUnknownText))
|
||||||
end
|
end
|
||||||
|
|
@ -292,15 +355,26 @@ function doAcceptPurchase(currencyPreferredByUser)
|
||||||
|
|
||||||
-- consumables need to use a different url
|
-- consumables need to use a different url
|
||||||
if purchasingConsumable then
|
if purchasingConsumable then
|
||||||
url = getSecureApiBaseUrl() .. "marketplace/submitpurchase?productId=" .. tostring(currentProductId) ..
|
url = getSecureApiBaseUrl()
|
||||||
"¤cyTypeId=" .. tostring(currencyEnumToInt(currentCurrencyType)) ..
|
.. "marketplace/submitpurchase?productId="
|
||||||
"&expectedUnitPrice=" .. tostring(currentCurrencyAmount) ..
|
.. tostring(currentProductId)
|
||||||
"&placeId=" .. tostring(Game.PlaceId)
|
.. "¤cyTypeId="
|
||||||
|
.. tostring(currencyEnumToInt(currentCurrencyType))
|
||||||
|
.. "&expectedUnitPrice="
|
||||||
|
.. tostring(currentCurrencyAmount)
|
||||||
|
.. "&placeId="
|
||||||
|
.. tostring(Game.PlaceId)
|
||||||
else
|
else
|
||||||
url = getSecureApiBaseUrl() .. "marketplace/purchase?productId=" .. tostring(currentProductId) ..
|
url = getSecureApiBaseUrl()
|
||||||
"¤cyTypeId=" .. tostring(currencyEnumToInt(currentCurrencyType)) ..
|
.. "marketplace/purchase?productId="
|
||||||
"&purchasePrice=" .. tostring(currentCurrencyAmount) ..
|
.. tostring(currentProductId)
|
||||||
"&locationType=Game" .. "&locationId=" .. Game.PlaceId
|
.. "¤cyTypeId="
|
||||||
|
.. tostring(currencyEnumToInt(currentCurrencyType))
|
||||||
|
.. "&purchasePrice="
|
||||||
|
.. tostring(currentCurrencyAmount)
|
||||||
|
.. "&locationType=Game"
|
||||||
|
.. "&locationId="
|
||||||
|
.. Game.PlaceId
|
||||||
end
|
end
|
||||||
|
|
||||||
local success, reason = ypcall(function()
|
local success, reason = ypcall(function()
|
||||||
|
|
@ -315,7 +389,7 @@ function doAcceptPurchase(currencyPreferredByUser)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- check to make sure purchase actually happened on the web end
|
-- check to make sure purchase actually happened on the web end
|
||||||
if response == "none" or response == nil or response == '' then
|
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()
|
purchaseFailed()
|
||||||
return
|
return
|
||||||
|
|
@ -352,7 +426,12 @@ function doAcceptPurchase(currencyPreferredByUser)
|
||||||
purchaseFailed()
|
purchaseFailed()
|
||||||
return
|
return
|
||||||
end
|
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
|
else
|
||||||
userPurchaseActionsEnded(success)
|
userPurchaseActionsEnded(success)
|
||||||
end
|
end
|
||||||
|
|
@ -364,7 +443,6 @@ function doDeclinePurchase()
|
||||||
end
|
end
|
||||||
-------------------------------- End Accept/Decline Functions --------------------------------------
|
-------------------------------- End Accept/Decline Functions --------------------------------------
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------- Currency Functions ---------------------------------------------
|
---------------------------------------------- Currency Functions ---------------------------------------------
|
||||||
-- enums have no implicit conversion to numbers in lua, has to have a function to do this
|
-- enums have no implicit conversion to numbers in lua, has to have a function to do this
|
||||||
function currencyEnumToInt(currencyEnum)
|
function currencyEnumToInt(currencyEnum)
|
||||||
|
|
@ -377,37 +455,68 @@ end
|
||||||
|
|
||||||
-- oi, this is ugly
|
-- oi, this is ugly
|
||||||
function assetTypeToString(assetType)
|
function assetTypeToString(assetType)
|
||||||
if assetType == 1 then return "Image"
|
if assetType == 1 then
|
||||||
elseif assetType == 2 then return "T-Shirt"
|
return "Image"
|
||||||
elseif assetType == 3 then return "Audio"
|
elseif assetType == 2 then
|
||||||
elseif assetType == 4 then return "Mesh"
|
return "T-Shirt"
|
||||||
elseif assetType == 5 then return "Lua"
|
elseif assetType == 3 then
|
||||||
elseif assetType == 6 then return "HTML"
|
return "Audio"
|
||||||
elseif assetType == 7 then return "Text"
|
elseif assetType == 4 then
|
||||||
elseif assetType == 8 then return "Hat"
|
return "Mesh"
|
||||||
elseif assetType == 9 then return "Place"
|
elseif assetType == 5 then
|
||||||
elseif assetType == 10 then return "Model"
|
return "Lua"
|
||||||
elseif assetType == 11 then return "Shirt"
|
elseif assetType == 6 then
|
||||||
elseif assetType == 12 then return "Pants"
|
return "HTML"
|
||||||
elseif assetType == 13 then return "Decal"
|
elseif assetType == 7 then
|
||||||
elseif assetType == 16 then return "Avatar"
|
return "Text"
|
||||||
elseif assetType == 17 then return "Head"
|
elseif assetType == 8 then
|
||||||
elseif assetType == 18 then return "Face"
|
return "Hat"
|
||||||
elseif assetType == 19 then return "Gear"
|
elseif assetType == 9 then
|
||||||
elseif assetType == 21 then return "Badge"
|
return "Place"
|
||||||
elseif assetType == 22 then return "Group Emblem"
|
elseif assetType == 10 then
|
||||||
elseif assetType == 24 then return "Animation"
|
return "Model"
|
||||||
elseif assetType == 25 then return "Arms"
|
elseif assetType == 11 then
|
||||||
elseif assetType == 26 then return "Legs"
|
return "Shirt"
|
||||||
elseif assetType == 27 then return "Torso"
|
elseif assetType == 12 then
|
||||||
elseif assetType == 28 then return "Right Arm"
|
return "Pants"
|
||||||
elseif assetType == 29 then return "Left Arm"
|
elseif assetType == 13 then
|
||||||
elseif assetType == 30 then return "Left Leg"
|
return "Decal"
|
||||||
elseif assetType == 31 then return "Right Leg"
|
elseif assetType == 16 then
|
||||||
elseif assetType == 32 then return "Package"
|
return "Avatar"
|
||||||
elseif assetType == 33 then return "YouTube Video"
|
elseif assetType == 17 then
|
||||||
elseif assetType == 34 then return "Game Pass"
|
return "Head"
|
||||||
elseif assetType == 0 then return "Product"
|
elseif assetType == 18 then
|
||||||
|
return "Face"
|
||||||
|
elseif assetType == 19 then
|
||||||
|
return "Gear"
|
||||||
|
elseif assetType == 21 then
|
||||||
|
return "Badge"
|
||||||
|
elseif assetType == 22 then
|
||||||
|
return "Group Emblem"
|
||||||
|
elseif assetType == 24 then
|
||||||
|
return "Animation"
|
||||||
|
elseif assetType == 25 then
|
||||||
|
return "Arms"
|
||||||
|
elseif assetType == 26 then
|
||||||
|
return "Legs"
|
||||||
|
elseif assetType == 27 then
|
||||||
|
return "Torso"
|
||||||
|
elseif assetType == 28 then
|
||||||
|
return "Right Arm"
|
||||||
|
elseif assetType == 29 then
|
||||||
|
return "Left Arm"
|
||||||
|
elseif assetType == 30 then
|
||||||
|
return "Left Leg"
|
||||||
|
elseif assetType == 31 then
|
||||||
|
return "Right Leg"
|
||||||
|
elseif assetType == 32 then
|
||||||
|
return "Package"
|
||||||
|
elseif assetType == 33 then
|
||||||
|
return "YouTube Video"
|
||||||
|
elseif assetType == 34 then
|
||||||
|
return "Game Pass"
|
||||||
|
elseif assetType == 0 then
|
||||||
|
return "Product"
|
||||||
end
|
end
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
@ -453,13 +562,15 @@ end
|
||||||
-- will get the player's balance of robux and tix, return in a table
|
-- will get the player's balance of robux and tix, return in a table
|
||||||
function getPlayerBalance()
|
function getPlayerBalance()
|
||||||
local playerBalance = nil
|
local playerBalance = nil
|
||||||
local success, errorCode = ypcall(function() playerBalance = game:HttpGetAsync(getSecureApiBaseUrl() .. "currency/balance") end)
|
local success, errorCode = ypcall(function()
|
||||||
|
playerBalance = game:HttpGetAsync(getSecureApiBaseUrl() .. "currency/balance")
|
||||||
|
end)
|
||||||
if not success then
|
if not success then
|
||||||
print("Get player balance failed because", errorCode)
|
print("Get player balance failed because", errorCode)
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if playerBalance == '' then
|
if playerBalance == "" then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -475,7 +586,7 @@ function openBuyCurrencyWindow()
|
||||||
end
|
end
|
||||||
|
|
||||||
function openBCUpSellWindow()
|
function openBCUpSellWindow()
|
||||||
Game:GetService('GuiService'):OpenBrowserWindow(baseUrl .. "Upgrades/BuildersClubMemberships.aspx")
|
Game:GetService("GuiService"):OpenBrowserWindow(baseUrl .. "Upgrades/BuildersClubMemberships.aspx")
|
||||||
end
|
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)
|
-- 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)
|
||||||
|
|
@ -507,32 +618,46 @@ function updateAfterBalanceText(playerBalance, notRightBc)
|
||||||
if not notRightBc then
|
if not notRightBc then
|
||||||
if afterBalanceNumber < 0 and keyWord == "robux" then
|
if afterBalanceNumber < 0 and keyWord == "robux" then
|
||||||
if openBuyCurrencyWindowConnection == nil then
|
if openBuyCurrencyWindowConnection == nil then
|
||||||
openBuyCurrencyWindowConnection = purchaseDialog.BodyFrame.AfterBalanceButton.MouseButton1Click:connect(openBuyCurrencyWindow)
|
openBuyCurrencyWindowConnection =
|
||||||
|
purchaseDialog.BodyFrame.AfterBalanceButton.MouseButton1Click:connect(openBuyCurrencyWindow)
|
||||||
end
|
end
|
||||||
purchaseDialog.BodyFrame.AfterBalanceButton.Text = "You need " .. currencyTypeToString(currentCurrencyType) .. " " .. tostring(-afterBalanceNumber) .. " more to buy this, click here to purchase more."
|
purchaseDialog.BodyFrame.AfterBalanceButton.Text = "You need "
|
||||||
|
.. currencyTypeToString(currentCurrencyType)
|
||||||
|
.. " "
|
||||||
|
.. tostring(-afterBalanceNumber)
|
||||||
|
.. " more to buy this, click here to purchase more."
|
||||||
return true, true
|
return true, true
|
||||||
elseif afterBalanceNumber < 0 and keyWord == "tickets" then
|
elseif afterBalanceNumber < 0 and keyWord == "tickets" then
|
||||||
purchaseDialog.BodyFrame.AfterBalanceButton.Text = "You need " .. tostring(-afterBalanceNumber) .. " " .. currencyTypeToString(currentCurrencyType) .. " more to buy this item."
|
purchaseDialog.BodyFrame.AfterBalanceButton.Text = "You need "
|
||||||
|
.. tostring(-afterBalanceNumber)
|
||||||
|
.. " "
|
||||||
|
.. currencyTypeToString(currentCurrencyType)
|
||||||
|
.. " more to buy this item."
|
||||||
return true, true -- user can't buy more tickets, so we say fail the transaction (maybe instead we can prompt them to trade currency???)
|
return true, true -- user can't buy more tickets, so we say fail the transaction (maybe instead we can prompt them to trade currency???)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- this ensures that we only have one connection to openBuyCurrencyWindow at a time (otherwise might open multiple browser windows)
|
-- this ensures that we only have one connection to openBuyCurrencyWindow at a time (otherwise might open multiple browser windows)
|
||||||
if(openBuyCurrencyWindowConnection) then
|
if openBuyCurrencyWindowConnection then
|
||||||
openBuyCurrencyWindowConnection:disconnect()
|
openBuyCurrencyWindowConnection:disconnect()
|
||||||
openBuyCurrencyWindowConnection = nil
|
openBuyCurrencyWindowConnection = nil
|
||||||
end
|
end
|
||||||
purchaseDialog.BodyFrame.AfterBalanceButton.Text = "Your balance after this transaction will be " .. currencyTypeToString(currentCurrencyType) .. " " .. tostring(afterBalanceNumber) .. "."
|
purchaseDialog.BodyFrame.AfterBalanceButton.Text = "Your balance after this transaction will be "
|
||||||
|
.. currencyTypeToString(currentCurrencyType)
|
||||||
|
.. " "
|
||||||
|
.. tostring(afterBalanceNumber)
|
||||||
|
.. "."
|
||||||
return true, false
|
return true, false
|
||||||
end
|
end
|
||||||
|
|
||||||
function isFreeItem()
|
function isFreeItem()
|
||||||
-- if both of these are true, then the item is free, just prompt user if they want to take one
|
-- if both of these are true, then the item is free, just prompt user if they want to take one
|
||||||
return currentProductInfo and currentProductInfo["IsForSale"] == true and currentProductInfo["IsPublicDomain"] == true
|
return currentProductInfo
|
||||||
|
and currentProductInfo["IsForSale"] == true
|
||||||
|
and currentProductInfo["IsPublicDomain"] == true
|
||||||
end
|
end
|
||||||
---------------------------------------------- End Currency Functions ---------------------------------------------
|
---------------------------------------------- End Currency Functions ---------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------- Data Functions -----------------------------------------------------
|
---------------------------------------------- Data Functions -----------------------------------------------------
|
||||||
|
|
||||||
-- more enum to int fun!
|
-- more enum to int fun!
|
||||||
|
|
@ -552,7 +677,6 @@ end
|
||||||
|
|
||||||
-- This functions checks to make sure the purchase is even possible, if not it returns false and we don't prompt user (some situations require user feedback when we won't prompt)
|
-- This functions checks to make sure the purchase is even possible, if not it returns false and we don't prompt user (some situations require user feedback when we won't prompt)
|
||||||
function canPurchaseItem()
|
function canPurchaseItem()
|
||||||
|
|
||||||
-- first we see if player already owns the asset/get the productinfo
|
-- first we see if player already owns the asset/get the productinfo
|
||||||
local playerOwnsAsset = false
|
local playerOwnsAsset = false
|
||||||
local notRightBc = false
|
local notRightBc = false
|
||||||
|
|
@ -562,7 +686,9 @@ function canPurchaseItem()
|
||||||
if purchasingConsumable then
|
if purchasingConsumable then
|
||||||
local currentProductInfoRaw = nil
|
local currentProductInfoRaw = nil
|
||||||
success = ypcall(function()
|
success = ypcall(function()
|
||||||
currentProductInfoRaw = Game:HttpGetAsync(getSecureApiBaseUrl() .. "marketplace/productDetails?productid=" .. tostring(currentProductId))
|
currentProductInfoRaw = Game:HttpGetAsync(
|
||||||
|
getSecureApiBaseUrl() .. "marketplace/productDetails?productid=" .. tostring(currentProductId)
|
||||||
|
)
|
||||||
end)
|
end)
|
||||||
if success then
|
if success then
|
||||||
currentProductInfo = getRbxUtility().DecodeJSON(currentProductInfoRaw)
|
currentProductInfo = getRbxUtility().DecodeJSON(currentProductInfoRaw)
|
||||||
|
|
@ -579,20 +705,23 @@ function canPurchaseItem()
|
||||||
end
|
end
|
||||||
|
|
||||||
if not purchasingConsumable then
|
if not purchasingConsumable then
|
||||||
|
|
||||||
if not currentAssetId then
|
if not currentAssetId then
|
||||||
print("current asset id is nil, this should always have a value")
|
print "current asset id is nil, this should always have a value"
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if currentAssetId <= 0 then
|
if currentAssetId <= 0 then
|
||||||
print("current asset id is negative, this should always be positive")
|
print "current asset id is negative, this should always be positive"
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
local success, errorCode = ypcall(function() playerOwnsAsset = game:HttpGetAsync(getSecureApiBaseUrl()
|
local success, errorCode = ypcall(function()
|
||||||
|
playerOwnsAsset = game:HttpGetAsync(
|
||||||
|
getSecureApiBaseUrl()
|
||||||
.. "ownership/hasAsset?userId="
|
.. "ownership/hasAsset?userId="
|
||||||
.. tostring(game.Players.LocalPlayer.userId)
|
.. tostring(game.Players.LocalPlayer.userId)
|
||||||
.. "&assetId=" .. tostring(currentAssetId))
|
.. "&assetId="
|
||||||
|
.. tostring(currentAssetId)
|
||||||
|
)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if not success then
|
if not success then
|
||||||
|
|
@ -625,7 +754,12 @@ function canPurchaseItem()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- now we start talking money, making sure we are going to be able to purchase this
|
-- now we start talking money, making sure we are going to be able to purchase this
|
||||||
if not setCurrencyAmountAndType(tonumber(currentProductInfo["PriceInRobux"]), tonumber(currentProductInfo["PriceInTickets"])) then
|
if
|
||||||
|
not setCurrencyAmountAndType(
|
||||||
|
tonumber(currentProductInfo["PriceInRobux"]),
|
||||||
|
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
|
return true, nil, nil, true, descText
|
||||||
end
|
end
|
||||||
|
|
@ -636,7 +770,10 @@ function canPurchaseItem()
|
||||||
return true, nil, nil, true, descText
|
return true, nil, nil, true, descText
|
||||||
end
|
end
|
||||||
|
|
||||||
if tonumber(currentProductInfo["MinimumMembershipLevel"]) > membershipTypeToNumber(game.Players.LocalPlayer.MembershipType) then
|
if
|
||||||
|
tonumber(currentProductInfo["MinimumMembershipLevel"])
|
||||||
|
> membershipTypeToNumber(game.Players.LocalPlayer.MembershipType)
|
||||||
|
then
|
||||||
notRightBc = true
|
notRightBc = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -654,14 +791,20 @@ function canPurchaseItem()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if (currentProductInfo["IsLimited"] == true or currentProductInfo["IsLimitedUnique"] == true) and
|
if
|
||||||
(currentProductInfo["Remaining"] == "" or currentProductInfo["Remaining"] == 0 or currentProductInfo["Remaining"] == nil) then
|
(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
|
return true, nil, nil, true, descText
|
||||||
end
|
end
|
||||||
|
|
||||||
if not updatedBalance then
|
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
|
return true, nil, nil, true, descText
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -672,13 +815,13 @@ end
|
||||||
|
|
||||||
function computeSpaceString(pLabel)
|
function computeSpaceString(pLabel)
|
||||||
local nString = " "
|
local nString = " "
|
||||||
local tempSpaceLabel = Instance.new('TextButton')
|
local tempSpaceLabel = Instance.new "TextButton"
|
||||||
tempSpaceLabel.Size = UDim2.new(0, pLabel.AbsoluteSize.X, 0, pLabel.AbsoluteSize.Y);
|
tempSpaceLabel.Size = UDim2.new(0, pLabel.AbsoluteSize.X, 0, pLabel.AbsoluteSize.Y)
|
||||||
tempSpaceLabel.FontSize = pLabel.FontSize;
|
tempSpaceLabel.FontSize = pLabel.FontSize
|
||||||
tempSpaceLabel.Parent = pLabel.Parent;
|
tempSpaceLabel.Parent = pLabel.Parent
|
||||||
tempSpaceLabel.BackgroundTransparency = 1.0;
|
tempSpaceLabel.BackgroundTransparency = 1
|
||||||
tempSpaceLabel.Text = nString;
|
tempSpaceLabel.Text = nString
|
||||||
tempSpaceLabel.Name = 'SpaceButton'
|
tempSpaceLabel.Name = "SpaceButton"
|
||||||
|
|
||||||
while tempSpaceLabel.TextBounds.X < pLabel.TextBounds.X do
|
while tempSpaceLabel.TextBounds.X < pLabel.TextBounds.X do
|
||||||
nString = nString .. " "
|
nString = nString .. " "
|
||||||
|
|
@ -691,7 +834,6 @@ end
|
||||||
|
|
||||||
---------------------------------------------- End Data Functions -----------------------------------------------------
|
---------------------------------------------- End Data Functions -----------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------- Gui Functions ----------------------------------------------
|
---------------------------------------------- Gui Functions ----------------------------------------------
|
||||||
function startSpinner()
|
function startSpinner()
|
||||||
spinning = true
|
spinning = true
|
||||||
|
|
@ -722,11 +864,11 @@ end
|
||||||
-- convenience method to say exactly what buttons should be visible (all others are not!)
|
-- convenience method to say exactly what buttons should be visible (all others are not!)
|
||||||
function setButtonsVisible(...)
|
function setButtonsVisible(...)
|
||||||
local args = { ... }
|
local args = { ... }
|
||||||
local argCount = select('#', ...)
|
local argCount = select("#", ...)
|
||||||
|
|
||||||
local bodyFrameChildren = purchaseDialog.BodyFrame:GetChildren()
|
local bodyFrameChildren = purchaseDialog.BodyFrame:GetChildren()
|
||||||
for i = 1, #bodyFrameChildren do
|
for i = 1, #bodyFrameChildren do
|
||||||
if bodyFrameChildren[i]:IsA("GuiButton") then
|
if bodyFrameChildren[i]:IsA "GuiButton" then
|
||||||
bodyFrameChildren[i].Visible = false
|
bodyFrameChildren[i].Visible = false
|
||||||
for j = 1, argCount do
|
for j = 1, argCount do
|
||||||
if bodyFrameChildren[i] == args[j] then
|
if bodyFrameChildren[i] == args[j] then
|
||||||
|
|
@ -740,7 +882,7 @@ end
|
||||||
|
|
||||||
-- used for the "Purchasing..." frame
|
-- used for the "Purchasing..." frame
|
||||||
function createSpinner(size, position, parent)
|
function createSpinner(size, position, parent)
|
||||||
local spinnerFrame = Instance.new("Frame")
|
local spinnerFrame = Instance.new "Frame"
|
||||||
spinnerFrame.Name = "Spinner"
|
spinnerFrame.Name = "Spinner"
|
||||||
spinnerFrame.Size = size
|
spinnerFrame.Size = size
|
||||||
spinnerFrame.Position = position
|
spinnerFrame.Position = position
|
||||||
|
|
@ -751,10 +893,15 @@ function createSpinner(size,position,parent)
|
||||||
spinnerIcons = {}
|
spinnerIcons = {}
|
||||||
local spinnerNum = 1
|
local spinnerNum = 1
|
||||||
while spinnerNum <= 8 do
|
while spinnerNum <= 8 do
|
||||||
local spinnerImage = Instance.new("ImageLabel")
|
local spinnerImage = Instance.new "ImageLabel"
|
||||||
spinnerImage.Name = "Spinner" .. spinnerNum
|
spinnerImage.Name = "Spinner" .. spinnerNum
|
||||||
spinnerImage.Size = UDim2.new(0, 16, 0, 16)
|
spinnerImage.Size = UDim2.new(0, 16, 0, 16)
|
||||||
spinnerImage.Position = UDim2.new(.5+.3*math.cos(math.rad(45*spinnerNum)), -8, .5+.3*math.sin(math.rad(45*spinnerNum)), -8)
|
spinnerImage.Position = UDim2.new(
|
||||||
|
0.5 + 0.3 * math.cos(math.rad(45 * spinnerNum)),
|
||||||
|
-8,
|
||||||
|
0.5 + 0.3 * math.sin(math.rad(45 * spinnerNum)),
|
||||||
|
-8
|
||||||
|
)
|
||||||
spinnerImage.BackgroundTransparency = 1
|
spinnerImage.BackgroundTransparency = 1
|
||||||
spinnerImage.ZIndex = 10
|
spinnerImage.ZIndex = 10
|
||||||
spinnerImage.Image = "http://www.roblox.com/Asset/?id=45880710"
|
spinnerImage.Image = "http://www.roblox.com/Asset/?id=45880710"
|
||||||
|
|
@ -767,7 +914,7 @@ end
|
||||||
|
|
||||||
-- all the gui init. Would be nice if this didn't have to be a script
|
-- all the gui init. Would be nice if this didn't have to be a script
|
||||||
function createPurchasePromptGui()
|
function createPurchasePromptGui()
|
||||||
purchaseDialog = Instance.new("Frame")
|
purchaseDialog = Instance.new "Frame"
|
||||||
purchaseDialog.Name = "PurchaseFrame"
|
purchaseDialog.Name = "PurchaseFrame"
|
||||||
purchaseDialog.Size = UDim2.new(0, 660, 0, 400)
|
purchaseDialog.Size = UDim2.new(0, 660, 0, 400)
|
||||||
purchaseDialog.Position = hidePosition
|
purchaseDialog.Position = hidePosition
|
||||||
|
|
@ -776,7 +923,7 @@ function createPurchasePromptGui()
|
||||||
purchaseDialog.BorderColor3 = Color3.new(204 / 255, 204 / 255, 204 / 255)
|
purchaseDialog.BorderColor3 = Color3.new(204 / 255, 204 / 255, 204 / 255)
|
||||||
purchaseDialog.Parent = game.CoreGui.RobloxGui
|
purchaseDialog.Parent = game.CoreGui.RobloxGui
|
||||||
|
|
||||||
local bodyFrame = Instance.new("Frame")
|
local bodyFrame = Instance.new "Frame"
|
||||||
bodyFrame.Name = "BodyFrame"
|
bodyFrame.Name = "BodyFrame"
|
||||||
bodyFrame.Size = UDim2.new(1, 0, 1, -60)
|
bodyFrame.Size = UDim2.new(1, 0, 1, -60)
|
||||||
bodyFrame.Position = UDim2.new(0, 0, 0, 60)
|
bodyFrame.Position = UDim2.new(0, 0, 0, 60)
|
||||||
|
|
@ -800,7 +947,7 @@ function createPurchasePromptGui()
|
||||||
|
|
||||||
local distanceBetweenButtons = 90
|
local distanceBetweenButtons = 90
|
||||||
|
|
||||||
local cancelButton = createImageButton("CancelButton")
|
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.BackgroundTransparency = 1
|
||||||
cancelButton.BorderSizePixel = 0
|
cancelButton.BorderSizePixel = 0
|
||||||
|
|
@ -819,7 +966,7 @@ function createPurchasePromptGui()
|
||||||
end)
|
end)
|
||||||
cancelButton.MouseButton1Click:connect(doDeclinePurchase)
|
cancelButton.MouseButton1Click:connect(doDeclinePurchase)
|
||||||
|
|
||||||
local buyButton = createImageButton("BuyButton")
|
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.BackgroundTransparency = 1
|
||||||
buyButton.BorderSizePixel = 0
|
buyButton.BorderSizePixel = 0
|
||||||
|
|
@ -895,7 +1042,9 @@ function createPurchasePromptGui()
|
||||||
end)
|
end)
|
||||||
okPurchasedButton.Parent = bodyFrame
|
okPurchasedButton.Parent = bodyFrame
|
||||||
|
|
||||||
okButton.MouseButton1Click:connect(function () userPurchaseActionsEnded(false) end)
|
okButton.MouseButton1Click:connect(function()
|
||||||
|
userPurchaseActionsEnded(false)
|
||||||
|
end)
|
||||||
okPurchasedButton.MouseButton1Click:connect(function()
|
okPurchasedButton.MouseButton1Click:connect(function()
|
||||||
if purchasingConsumable then
|
if purchasingConsumable then
|
||||||
userPurchaseProductActionsEnded(true)
|
userPurchaseProductActionsEnded(true)
|
||||||
|
|
@ -903,10 +1052,14 @@ function createPurchasePromptGui()
|
||||||
signalPromptEnded(true)
|
signalPromptEnded(true)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
buyButton.MouseButton1Click:connect(function() doAcceptPurchase(Enum.CurrencyType.Robux) end)
|
buyButton.MouseButton1Click:connect(function()
|
||||||
freeButton.MouseButton1Click:connect(function() doAcceptPurchase(false) end)
|
doAcceptPurchase(Enum.CurrencyType.Robux)
|
||||||
|
end)
|
||||||
|
freeButton.MouseButton1Click:connect(function()
|
||||||
|
doAcceptPurchase(false)
|
||||||
|
end)
|
||||||
|
|
||||||
local itemPreview = Instance.new("ImageLabel")
|
local itemPreview = Instance.new "ImageLabel"
|
||||||
itemPreview.Name = "ItemPreview"
|
itemPreview.Name = "ItemPreview"
|
||||||
itemPreview.BackgroundColor3 = Color3.new(32 / 255, 32 / 255, 32 / 255)
|
itemPreview.BackgroundColor3 = Color3.new(32 / 255, 32 / 255, 32 / 255)
|
||||||
itemPreview.BorderColor3 = Color3.new(141 / 255, 141 / 255, 141 / 255)
|
itemPreview.BorderColor3 = Color3.new(141 / 255, 141 / 255, 141 / 255)
|
||||||
|
|
@ -915,13 +1068,23 @@ function createPurchasePromptGui()
|
||||||
itemPreview.ZIndex = 9
|
itemPreview.ZIndex = 9
|
||||||
itemPreview.Parent = bodyFrame
|
itemPreview.Parent = bodyFrame
|
||||||
|
|
||||||
local itemDescription = createTextObject("ItemDescription", "Would you like to buy the 'itemName' for currencyType currencyAmount?","TextLabel",Enum.FontSize.Size24)
|
local itemDescription = createTextObject(
|
||||||
|
"ItemDescription",
|
||||||
|
"Would you like to buy the 'itemName' for currencyType currencyAmount?",
|
||||||
|
"TextLabel",
|
||||||
|
Enum.FontSize.Size24
|
||||||
|
)
|
||||||
itemDescription.Position = UDim2.new(1, 20, 0, 0)
|
itemDescription.Position = UDim2.new(1, 20, 0, 0)
|
||||||
itemDescription.Size = UDim2.new(0, 410, 1, 0)
|
itemDescription.Size = UDim2.new(0, 410, 1, 0)
|
||||||
itemDescription.ZIndex = 8
|
itemDescription.ZIndex = 8
|
||||||
itemDescription.Parent = itemPreview
|
itemDescription.Parent = itemPreview
|
||||||
|
|
||||||
local afterBalanceButton = createTextObject("AfterBalanceButton","Place holder text ip sum lorem dodo ashs","TextButton",Enum.FontSize.Size24)
|
local afterBalanceButton = createTextObject(
|
||||||
|
"AfterBalanceButton",
|
||||||
|
"Place holder text ip sum lorem dodo ashs",
|
||||||
|
"TextButton",
|
||||||
|
Enum.FontSize.Size24
|
||||||
|
)
|
||||||
afterBalanceButton.AutoButtonColor = false
|
afterBalanceButton.AutoButtonColor = false
|
||||||
afterBalanceButton.TextColor3 = Color3.new(222 / 255, 59 / 255, 30 / 255)
|
afterBalanceButton.TextColor3 = Color3.new(222 / 255, 59 / 255, 30 / 255)
|
||||||
afterBalanceButton.Position = UDim2.new(0, 5, 1, -55)
|
afterBalanceButton.Position = UDim2.new(0, 5, 1, -55)
|
||||||
|
|
@ -929,7 +1092,7 @@ function createPurchasePromptGui()
|
||||||
afterBalanceButton.ZIndex = 8
|
afterBalanceButton.ZIndex = 8
|
||||||
afterBalanceButton.Parent = bodyFrame
|
afterBalanceButton.Parent = bodyFrame
|
||||||
|
|
||||||
local purchasingFrame = Instance.new("Frame")
|
local purchasingFrame = Instance.new "Frame"
|
||||||
purchasingFrame.Name = "PurchasingFrame"
|
purchasingFrame.Name = "PurchasingFrame"
|
||||||
purchasingFrame.Size = UDim2.new(1, 0, 1, 0)
|
purchasingFrame.Size = UDim2.new(1, 0, 1, 0)
|
||||||
purchasingFrame.BackgroundColor3 = Color3.new(0, 0, 0)
|
purchasingFrame.BackgroundColor3 = Color3.new(0, 0, 0)
|
||||||
|
|
@ -975,7 +1138,7 @@ function createTextObject(name, text, type, size)
|
||||||
end
|
end
|
||||||
|
|
||||||
function createImageButton(name)
|
function createImageButton(name)
|
||||||
local imageButton = Instance.new("ImageButton")
|
local imageButton = Instance.new "ImageButton"
|
||||||
imageButton.Size = UDim2.new(0, 153, 0, 46)
|
imageButton.Size = UDim2.new(0, 153, 0, 46)
|
||||||
imageButton.Name = name
|
imageButton.Name = name
|
||||||
return imageButton
|
return imageButton
|
||||||
|
|
@ -1029,7 +1192,9 @@ function doPurchasePrompt(player, assetId, equipIfPurchased, currencyType, produ
|
||||||
end
|
end
|
||||||
|
|
||||||
if player == game.Players.LocalPlayer then
|
if player == game.Players.LocalPlayer then
|
||||||
if currentlyPrompting then return end
|
if currentlyPrompting then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
currentlyPrompting = true
|
currentlyPrompting = true
|
||||||
|
|
||||||
|
|
@ -1055,13 +1220,18 @@ function userPurchaseProductActionsEnded(userIsClosingDialog)
|
||||||
isPurchased = true
|
isPurchased = true
|
||||||
end
|
end
|
||||||
|
|
||||||
Game:GetService("MarketplaceService"):SignalPromptProductPurchaseFinished(tonumber(currentServerResponseTable["playerId"]), tonumber(currentServerResponseTable["productId"]), isPurchased)
|
Game:GetService("MarketplaceService"):SignalPromptProductPurchaseFinished(
|
||||||
|
tonumber(currentServerResponseTable["playerId"]),
|
||||||
|
tonumber(currentServerResponseTable["productId"]),
|
||||||
|
isPurchased
|
||||||
|
)
|
||||||
else
|
else
|
||||||
print("Something went wrong, no currentServerResponseTable")
|
print "Something went wrong, no currentServerResponseTable"
|
||||||
end
|
end
|
||||||
removeCurrentPurchaseInfo()
|
removeCurrentPurchaseInfo()
|
||||||
else
|
else
|
||||||
local newPurchasedSucceededText = string.gsub( purchaseSucceededText,"itemName", tostring(currentProductInfo["Name"]))
|
local newPurchasedSucceededText =
|
||||||
|
string.gsub(purchaseSucceededText, "itemName", tostring(currentProductInfo["Name"]))
|
||||||
purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = newPurchasedSucceededText
|
purchaseDialog.BodyFrame.ItemPreview.ItemDescription.Text = newPurchasedSucceededText
|
||||||
setButtonsVisible(purchaseDialog.BodyFrame.OkPurchasedButton)
|
setButtonsVisible(purchaseDialog.BodyFrame.OkPurchasedButton)
|
||||||
hidePurchasing()
|
hidePurchasing()
|
||||||
|
|
@ -1070,12 +1240,15 @@ end
|
||||||
|
|
||||||
function doProcessServerPurchaseResponse(serverResponseTable)
|
function doProcessServerPurchaseResponse(serverResponseTable)
|
||||||
if not serverResponseTable then
|
if not serverResponseTable then
|
||||||
print("Server response table was nil, cancelling purchase")
|
print "Server response table was nil, cancelling purchase"
|
||||||
purchaseFailed()
|
purchaseFailed()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if serverResponseTable["playerId"] and tonumber(serverResponseTable["playerId"]) == game.Players.LocalPlayer.userId then
|
if
|
||||||
|
serverResponseTable["playerId"]
|
||||||
|
and tonumber(serverResponseTable["playerId"]) == game.Players.LocalPlayer.userId
|
||||||
|
then
|
||||||
currentServerResponseTable = serverResponseTable
|
currentServerResponseTable = serverResponseTable
|
||||||
userPurchaseProductActionsEnded(false)
|
userPurchaseProductActionsEnded(false)
|
||||||
end
|
end
|
||||||
|
|
@ -1083,15 +1256,16 @@ end
|
||||||
|
|
||||||
---------------------------------------------- End Gui Functions ----------------------------------------------
|
---------------------------------------------- End Gui Functions ----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------- Script Event start/initialization ----------------------------------------------
|
---------------------------------------------- Script Event start/initialization ----------------------------------------------
|
||||||
preloadAssets()
|
preloadAssets()
|
||||||
|
|
||||||
game:GetService("MarketplaceService").PromptProductPurchaseRequested:connect(function(player, productId, equipIfPurchased, currencyType)
|
game:GetService("MarketplaceService").PromptProductPurchaseRequested
|
||||||
|
:connect(function(player, productId, equipIfPurchased, currencyType)
|
||||||
doPurchasePrompt(player, nil, equipIfPurchased, currencyType, productId)
|
doPurchasePrompt(player, nil, equipIfPurchased, currencyType, productId)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Game:GetService("MarketplaceService").PromptPurchaseRequested:connect(function(player, assetId, equipIfPurchased, currencyType)
|
Game:GetService("MarketplaceService").PromptPurchaseRequested
|
||||||
|
:connect(function(player, assetId, equipIfPurchased, currencyType)
|
||||||
doPurchasePrompt(player, assetId, equipIfPurchased, currencyType, nil)
|
doPurchasePrompt(player, assetId, equipIfPurchased, currencyType, nil)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
@ -1100,7 +1274,9 @@ Game:GetService("MarketplaceService").ServerPurchaseVerification:connect(functio
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if enableBrowserWindowClosedEvent then
|
if enableBrowserWindowClosedEvent then
|
||||||
Game:GetService("GuiService").BrowserWindowClosed:connect(function() doPlayerFundsCheck(false) end)
|
Game:GetService("GuiService").BrowserWindowClosed:connect(function()
|
||||||
|
doPlayerFundsCheck(false)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
Game.CoreGui.RobloxGui.Changed:connect(function()
|
Game.CoreGui.RobloxGui.Changed:connect(function()
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
-- Essentially a user can bind a lua function to a key code, input type (mousebutton1 etc.) and this
|
-- Essentially a user can bind a lua function to a key code, input type (mousebutton1 etc.) and this
|
||||||
|
|
||||||
-- Variables
|
-- Variables
|
||||||
local contextActionService = Game:GetService("ContextActionService")
|
local contextActionService = Game:GetService "ContextActionService"
|
||||||
local isTouchDevice = Game:GetService("UserInputService").TouchEnabled
|
local isTouchDevice = Game:GetService("UserInputService").TouchEnabled
|
||||||
local functionTable = {}
|
local functionTable = {}
|
||||||
local buttonVector = {}
|
local buttonVector = {}
|
||||||
|
|
@ -23,7 +23,7 @@ local buttonPositionTable = {
|
||||||
[4] = UDim2.new(0, 85, 0, -25),
|
[4] = UDim2.new(0, 85, 0, -25),
|
||||||
[5] = UDim2.new(0, 185, 0, -25),
|
[5] = UDim2.new(0, 185, 0, -25),
|
||||||
[6] = UDim2.new(0, 185, 0, 260),
|
[6] = UDim2.new(0, 185, 0, 260),
|
||||||
[7] = UDim2.new(0,216,0,65)
|
[7] = UDim2.new(0, 216, 0, 65),
|
||||||
}
|
}
|
||||||
local maxButtons = #buttonPositionTable
|
local maxButtons = #buttonPositionTable
|
||||||
|
|
||||||
|
|
@ -41,10 +41,10 @@ end
|
||||||
|
|
||||||
function createContextActionGui()
|
function createContextActionGui()
|
||||||
if not buttonScreenGui and isTouchDevice then
|
if not buttonScreenGui and isTouchDevice then
|
||||||
buttonScreenGui = Instance.new("ScreenGui")
|
buttonScreenGui = Instance.new "ScreenGui"
|
||||||
buttonScreenGui.Name = "ContextActionGui"
|
buttonScreenGui.Name = "ContextActionGui"
|
||||||
|
|
||||||
buttonFrame = Instance.new("Frame")
|
buttonFrame = Instance.new "Frame"
|
||||||
buttonFrame.BackgroundTransparency = 1
|
buttonFrame.BackgroundTransparency = 1
|
||||||
buttonFrame.Size = UDim2.new(0.3, 0, 0.5, 0)
|
buttonFrame.Size = UDim2.new(0.3, 0, 0.5, 0)
|
||||||
buttonFrame.Position = UDim2.new(0.7, 0, 0.5, 0)
|
buttonFrame.Position = UDim2.new(0.7, 0, 0.5, 0)
|
||||||
|
|
@ -85,7 +85,10 @@ end
|
||||||
|
|
||||||
function contextButtonUp(button, inputObject, actionName)
|
function contextButtonUp(button, inputObject, actionName)
|
||||||
button.Image = ContextUpImage
|
button.Image = ContextUpImage
|
||||||
if inputObject.UserInputType == Enum.UserInputType.Touch and inputObject.UserInputState == Enum.UserInputState.End then
|
if
|
||||||
|
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
|
||||||
end
|
end
|
||||||
|
|
@ -94,9 +97,8 @@ function isSmallScreenDevice()
|
||||||
return Game:GetService("GuiService"):GetScreenResolution().y <= 320
|
return Game:GetService("GuiService"):GetScreenResolution().y <= 320
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function createNewButton(actionName, functionInfoTable)
|
function createNewButton(actionName, functionInfoTable)
|
||||||
local contextButton = Instance.new("ImageButton")
|
local contextButton = Instance.new "ImageButton"
|
||||||
contextButton.Name = "ContextActionButton"
|
contextButton.Name = "ContextActionButton"
|
||||||
contextButton.BackgroundTransparency = 1
|
contextButton.BackgroundTransparency = 1
|
||||||
contextButton.Size = UDim2.new(0, 90, 0, 90)
|
contextButton.Size = UDim2.new(0, 90, 0, 90)
|
||||||
|
|
@ -113,7 +115,9 @@ function createNewButton(actionName, functionInfoTable)
|
||||||
oldTouches[inputObject] = nil
|
oldTouches[inputObject] = nil
|
||||||
end)
|
end)
|
||||||
contextButton.InputBegan:connect(function(inputObject)
|
contextButton.InputBegan:connect(function(inputObject)
|
||||||
if oldTouches[inputObject] then return end
|
if oldTouches[inputObject] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if inputObject.UserInputState == Enum.UserInputState.Begin and currentButtonTouch == nil then
|
if inputObject.UserInputState == Enum.UserInputState.Begin and currentButtonTouch == nil then
|
||||||
currentButtonTouch = inputObject
|
currentButtonTouch = inputObject
|
||||||
|
|
@ -121,21 +125,29 @@ function createNewButton(actionName, functionInfoTable)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
contextButton.InputChanged:connect(function(inputObject)
|
contextButton.InputChanged:connect(function(inputObject)
|
||||||
if oldTouches[inputObject] then return end
|
if oldTouches[inputObject] then
|
||||||
if currentButtonTouch ~= inputObject then return end
|
return
|
||||||
|
end
|
||||||
|
if currentButtonTouch ~= inputObject then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
contextButtonMoved(contextButton, inputObject, actionName)
|
contextButtonMoved(contextButton, inputObject, actionName)
|
||||||
end)
|
end)
|
||||||
contextButton.InputEnded:connect(function(inputObject)
|
contextButton.InputEnded:connect(function(inputObject)
|
||||||
if oldTouches[inputObject] then return end
|
if oldTouches[inputObject] then
|
||||||
if currentButtonTouch ~= inputObject then return end
|
return
|
||||||
|
end
|
||||||
|
if currentButtonTouch ~= inputObject then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
currentButtonTouch = nil
|
currentButtonTouch = nil
|
||||||
oldTouches[inputObject] = true
|
oldTouches[inputObject] = true
|
||||||
contextButtonUp(contextButton, inputObject, actionName)
|
contextButtonUp(contextButton, inputObject, actionName)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local actionIcon = Instance.new("ImageLabel")
|
local actionIcon = Instance.new "ImageLabel"
|
||||||
actionIcon.Name = "ActionIcon"
|
actionIcon.Name = "ActionIcon"
|
||||||
actionIcon.Position = UDim2.new(0.175, 0, 0.175, 0)
|
actionIcon.Position = UDim2.new(0.175, 0, 0.175, 0)
|
||||||
actionIcon.Size = UDim2.new(0.65, 0, 0.65, 0)
|
actionIcon.Size = UDim2.new(0.65, 0, 0.65, 0)
|
||||||
|
|
@ -145,7 +157,7 @@ function createNewButton(actionName, functionInfoTable)
|
||||||
end
|
end
|
||||||
actionIcon.Parent = contextButton
|
actionIcon.Parent = contextButton
|
||||||
|
|
||||||
local actionTitle = Instance.new("TextLabel")
|
local actionTitle = Instance.new "TextLabel"
|
||||||
actionTitle.Name = "ActionTitle"
|
actionTitle.Name = "ActionTitle"
|
||||||
actionTitle.Size = UDim2.new(1, 0, 1, 0)
|
actionTitle.Size = UDim2.new(1, 0, 1, 0)
|
||||||
actionTitle.BackgroundTransparency = 1
|
actionTitle.BackgroundTransparency = 1
|
||||||
|
|
@ -194,7 +206,9 @@ function createButton( actionName, functionInfoTable )
|
||||||
end
|
end
|
||||||
|
|
||||||
function removeAction(actionName)
|
function removeAction(actionName)
|
||||||
if not functionTable[actionName] then return end
|
if not functionTable[actionName] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local actionButton = functionTable[actionName]["button"]
|
local actionButton = functionTable[actionName]["button"]
|
||||||
|
|
||||||
|
|
|
||||||
183
153556783.lua
183
153556783.lua
|
|
@ -6,21 +6,23 @@
|
||||||
while not Game do
|
while not Game do
|
||||||
wait()
|
wait()
|
||||||
end
|
end
|
||||||
while not Game:FindFirstChild("Players") do
|
while not Game:FindFirstChild "Players" do
|
||||||
wait()
|
wait()
|
||||||
end
|
end
|
||||||
while not Game.Players.LocalPlayer do
|
while not Game.Players.LocalPlayer do
|
||||||
wait()
|
wait()
|
||||||
end
|
end
|
||||||
while not Game:FindFirstChild("CoreGui") do
|
while not Game:FindFirstChild "CoreGui" do
|
||||||
wait()
|
wait()
|
||||||
end
|
end
|
||||||
while not Game.CoreGui:FindFirstChild("RobloxGui") do
|
while not Game.CoreGui:FindFirstChild "RobloxGui" do
|
||||||
wait()
|
wait()
|
||||||
end
|
end
|
||||||
|
|
||||||
local userInputService = Game:GetService("UserInputService")
|
local userInputService = Game:GetService "UserInputService"
|
||||||
local success = pcall(function() userInputService:IsLuaTouchControls() end)
|
local success = pcall(function()
|
||||||
|
userInputService:IsLuaTouchControls()
|
||||||
|
end)
|
||||||
if not success then
|
if not success then
|
||||||
script:Destroy()
|
script:Destroy()
|
||||||
end
|
end
|
||||||
|
|
@ -34,7 +36,6 @@ function isSmallScreenDevice()
|
||||||
end
|
end
|
||||||
|
|
||||||
local localPlayer = Game.Players.LocalPlayer
|
local localPlayer = Game.Players.LocalPlayer
|
||||||
local thumbstickInactiveAlpha = 0.3
|
|
||||||
local thumbstickSize = 120
|
local thumbstickSize = 120
|
||||||
if isSmallScreenDevice() then
|
if isSmallScreenDevice() then
|
||||||
thumbstickSize = 70
|
thumbstickSize = 70
|
||||||
|
|
@ -58,7 +59,6 @@ local CameraZoomSensitivity = 0.03
|
||||||
local PinchZoomDelay = 0.2
|
local PinchZoomDelay = 0.2
|
||||||
local cameraTouch = nil
|
local cameraTouch = nil
|
||||||
|
|
||||||
|
|
||||||
-- make sure all of our images are good to go
|
-- make sure all of our images are good to go
|
||||||
Game:GetService("ContentProvider"):Preload(touchControlsSheet)
|
Game:GetService("ContentProvider"):Preload(touchControlsSheet)
|
||||||
|
|
||||||
|
|
@ -73,7 +73,12 @@ function DistanceBetweenTwoPoints(point1, point2)
|
||||||
end
|
end
|
||||||
|
|
||||||
function transformFromCenterToTopLeft(pointToTranslate, guiObject)
|
function transformFromCenterToTopLeft(pointToTranslate, guiObject)
|
||||||
return UDim2.new(0,pointToTranslate.x - guiObject.AbsoluteSize.x/2,0,pointToTranslate.y - guiObject.AbsoluteSize.y/2)
|
return UDim2.new(
|
||||||
|
0,
|
||||||
|
pointToTranslate.x - guiObject.AbsoluteSize.x / 2,
|
||||||
|
0,
|
||||||
|
pointToTranslate.y - guiObject.AbsoluteSize.y / 2
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function rotatePointAboutLocation(pointToRotate, pointToRotateAbout, radians)
|
function rotatePointAboutLocation(pointToRotate, pointToRotateAbout, radians)
|
||||||
|
|
@ -100,12 +105,18 @@ function dotProduct(v1,v2)
|
||||||
end
|
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 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
|
-- thumbstick is moving outside our region, need to cap its distance
|
||||||
if centerDiff > (thumbstickSize / 2) then
|
if centerDiff > (thumbstickSize / 2) then
|
||||||
local thumbVector = Vector2.new(touchLocation.x - thumbstickOuterCenterPosition.x,touchLocation.y - thumbstickOuterCenterPosition.y);
|
local thumbVector = Vector2.new(
|
||||||
|
touchLocation.x - thumbstickOuterCenterPosition.x,
|
||||||
|
touchLocation.y - thumbstickOuterCenterPosition.y
|
||||||
|
)
|
||||||
local normal = thumbVector.unit
|
local normal = thumbVector.unit
|
||||||
if normal.x == math.nan or normal.x == math.inf then
|
if normal.x == math.nan or normal.x == math.inf then
|
||||||
normal = Vector2.new(0, normal.y)
|
normal = Vector2.new(0, normal.y)
|
||||||
|
|
@ -120,36 +131,59 @@ function stationaryThumbstickTouchMove(thumbstickFrame, thumbstickOuter, touchLo
|
||||||
thumbstickFrame.Position = transformFromCenterToTopLeft(touchLocation, thumbstickFrame)
|
thumbstickFrame.Position = transformFromCenterToTopLeft(touchLocation, thumbstickFrame)
|
||||||
end
|
end
|
||||||
|
|
||||||
return Vector2.new(thumbstickFrame.Position.X.Offset - thumbstickOuter.Position.X.Offset,thumbstickFrame.Position.Y.Offset - thumbstickOuter.Position.Y.Offset)
|
return Vector2.new(
|
||||||
|
thumbstickFrame.Position.X.Offset - thumbstickOuter.Position.X.Offset,
|
||||||
|
thumbstickFrame.Position.Y.Offset - thumbstickOuter.Position.Y.Offset
|
||||||
|
)
|
||||||
end
|
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)
|
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)
|
-- 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)
|
local thumbstickInnerCenter = Vector2.new(
|
||||||
local movementVectorUnit = Vector2.new(touchLocation.x - thumbstickInnerCenter.x, touchLocation.y - thumbstickInnerCenter.y).unit
|
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 outerToInnerVectorCurrent = Vector2.new(thumbstickInnerCenter.x - thumbstickOuterCenter.x, thumbstickInnerCenter.y - thumbstickOuterCenter.y)
|
local outerToInnerVectorCurrent = Vector2.new(
|
||||||
|
thumbstickInnerCenter.x - thumbstickOuterCenter.x,
|
||||||
|
thumbstickInnerCenter.y - thumbstickOuterCenter.y
|
||||||
|
)
|
||||||
local outerToInnerVectorCurrentUnit = outerToInnerVectorCurrent.unit
|
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,
|
-- First, find the angle between the new thumbstick movement vector,
|
||||||
-- and the vector between thumbstick inner and thumbstick outer.
|
-- 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
|
-- 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 crossOuterToInnerWithMovement = (outerToInnerVectorCurrentUnit.x * movementVectorUnit.y)
|
||||||
local angle = math.atan2(crossOuterToInnerWithMovement, dotProduct(outerToInnerVectorCurrentUnit, movementVectorUnit))
|
- (outerToInnerVectorCurrentUnit.y * movementVectorUnit.x)
|
||||||
local anglePercent = angle * math.min( (movementVector.magnitude)/(outerToInnerVectorCurrent.magnitude), 1.0);
|
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 angle is significant, rotate about the inner thumbsticks current center
|
||||||
if math.abs(anglePercent) > 0.00001 then
|
if math.abs(anglePercent) > 0.00001 then
|
||||||
local outerThumbCenter = rotatePointAboutLocation(thumbstickOuterCenter, thumbstickInnerCenter, anglePercent)
|
local outerThumbCenter =
|
||||||
thumbstickOuter.Position = transformFromCenterToTopLeft(Vector2.new(outerThumbCenter.x,outerThumbCenter.y), thumbstickOuter)
|
rotatePointAboutLocation(thumbstickOuterCenter, thumbstickInnerCenter, anglePercent)
|
||||||
|
thumbstickOuter.Position =
|
||||||
|
transformFromCenterToTopLeft(Vector2.new(outerThumbCenter.x, outerThumbCenter.y), thumbstickOuter)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- now just translate outer thumbstick to make sure it stays nears inner thumbstick
|
-- now just translate outer thumbstick to make sure it stays nears inner thumbstick
|
||||||
thumbstickOuter.Position = UDim2.new(0,thumbstickOuter.Position.X.Offset+movementVector.x,0,thumbstickOuter.Position.Y.Offset+movementVector.y)
|
thumbstickOuter.Position = UDim2.new(
|
||||||
|
0,
|
||||||
|
thumbstickOuter.Position.X.Offset + movementVector.x,
|
||||||
|
0,
|
||||||
|
thumbstickOuter.Position.Y.Offset + movementVector.y
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
thumbstickFrame.Position = transformFromCenterToTopLeft(touchLocation, thumbstickFrame)
|
thumbstickFrame.Position = transformFromCenterToTopLeft(touchLocation, thumbstickFrame)
|
||||||
|
|
@ -159,10 +193,18 @@ function followThumbstickTouchMove(thumbstickFrame, thumbstickOuter, touchLocati
|
||||||
thumbstickOuterPosition = Vector2.new(thumbstickOuter.Position.X.Offset, thumbstickOuter.Position.Y.Offset)
|
thumbstickOuterPosition = Vector2.new(thumbstickOuter.Position.X.Offset, thumbstickOuter.Position.Y.Offset)
|
||||||
if DistanceBetweenTwoPoints(thumbstickFramePosition, thumbstickOuterPosition) > thumbstickSize / 2 then
|
if DistanceBetweenTwoPoints(thumbstickFramePosition, thumbstickOuterPosition) > thumbstickSize / 2 then
|
||||||
local vectorWithLength = (thumbstickOuterPosition - thumbstickFramePosition).unit * thumbstickSize / 2
|
local vectorWithLength = (thumbstickOuterPosition - thumbstickFramePosition).unit * thumbstickSize / 2
|
||||||
thumbstickOuter.Position = UDim2.new(0,thumbstickFramePosition.x + vectorWithLength.x,0,thumbstickFramePosition.y + vectorWithLength.y)
|
thumbstickOuter.Position = UDim2.new(
|
||||||
|
0,
|
||||||
|
thumbstickFramePosition.x + vectorWithLength.x,
|
||||||
|
0,
|
||||||
|
thumbstickFramePosition.y + vectorWithLength.y
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
return Vector2.new(thumbstickFrame.Position.X.Offset - thumbstickOuter.Position.X.Offset,thumbstickFrame.Position.Y.Offset - thumbstickOuter.Position.Y.Offset)
|
return Vector2.new(
|
||||||
|
thumbstickFrame.Position.X.Offset - thumbstickOuter.Position.X.Offset,
|
||||||
|
thumbstickFrame.Position.Y.Offset - thumbstickOuter.Position.Y.Offset
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function movementOutsideDeadZone(movementVector)
|
function movementOutsideDeadZone(movementVector)
|
||||||
|
|
@ -170,14 +212,14 @@ function movementOutsideDeadZone(movementVector)
|
||||||
end
|
end
|
||||||
|
|
||||||
function constructThumbstick(defaultThumbstickPos, updateFunction, stationaryThumbstick)
|
function constructThumbstick(defaultThumbstickPos, updateFunction, stationaryThumbstick)
|
||||||
local thumbstickFrame = Instance.new("Frame")
|
local thumbstickFrame = Instance.new "Frame"
|
||||||
thumbstickFrame.Name = "ThumbstickFrame"
|
thumbstickFrame.Name = "ThumbstickFrame"
|
||||||
thumbstickFrame.Active = true
|
thumbstickFrame.Active = true
|
||||||
thumbstickFrame.Size = UDim2.new(0, thumbstickSize, 0, thumbstickSize)
|
thumbstickFrame.Size = UDim2.new(0, thumbstickSize, 0, thumbstickSize)
|
||||||
thumbstickFrame.Position = defaultThumbstickPos
|
thumbstickFrame.Position = defaultThumbstickPos
|
||||||
thumbstickFrame.BackgroundTransparency = 1
|
thumbstickFrame.BackgroundTransparency = 1
|
||||||
|
|
||||||
local outerThumbstick = Instance.new("ImageLabel")
|
local outerThumbstick = Instance.new "ImageLabel"
|
||||||
outerThumbstick.Name = "OuterThumbstick"
|
outerThumbstick.Name = "OuterThumbstick"
|
||||||
outerThumbstick.Image = touchControlsSheet
|
outerThumbstick.Image = touchControlsSheet
|
||||||
outerThumbstick.ImageRectOffset = Vector2.new(0, 0)
|
outerThumbstick.ImageRectOffset = Vector2.new(0, 0)
|
||||||
|
|
@ -187,14 +229,19 @@ function constructThumbstick(defaultThumbstickPos, updateFunction, stationaryThu
|
||||||
outerThumbstick.Position = defaultThumbstickPos
|
outerThumbstick.Position = defaultThumbstickPos
|
||||||
outerThumbstick.Parent = Game.CoreGui.RobloxGui
|
outerThumbstick.Parent = Game.CoreGui.RobloxGui
|
||||||
|
|
||||||
local innerThumbstick = Instance.new("ImageLabel")
|
local innerThumbstick = Instance.new "ImageLabel"
|
||||||
innerThumbstick.Name = "InnerThumbstick"
|
innerThumbstick.Name = "InnerThumbstick"
|
||||||
innerThumbstick.Image = touchControlsSheet
|
innerThumbstick.Image = touchControlsSheet
|
||||||
innerThumbstick.ImageRectOffset = Vector2.new(220, 0)
|
innerThumbstick.ImageRectOffset = Vector2.new(220, 0)
|
||||||
innerThumbstick.ImageRectSize = Vector2.new(111, 111)
|
innerThumbstick.ImageRectSize = Vector2.new(111, 111)
|
||||||
innerThumbstick.BackgroundTransparency = 1
|
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, 0, thumbstickFrame.Size.Y.Offset/2 - thumbstickSize/4)
|
innerThumbstick.Position = UDim2.new(
|
||||||
|
0,
|
||||||
|
thumbstickFrame.Size.X.Offset / 2 - thumbstickSize / 4,
|
||||||
|
0,
|
||||||
|
thumbstickFrame.Size.Y.Offset / 2 - thumbstickSize / 4
|
||||||
|
)
|
||||||
innerThumbstick.Parent = thumbstickFrame
|
innerThumbstick.Parent = thumbstickFrame
|
||||||
innerThumbstick.ZIndex = 2
|
innerThumbstick.ZIndex = 2
|
||||||
|
|
||||||
|
|
@ -203,10 +250,18 @@ function constructThumbstick(defaultThumbstickPos, updateFunction, stationaryThu
|
||||||
local userInputSeviceTouchEndedCon = nil
|
local userInputSeviceTouchEndedCon = nil
|
||||||
|
|
||||||
local startInputTracking = function(inputObject)
|
local startInputTracking = function(inputObject)
|
||||||
if thumbstickTouch then return end
|
if thumbstickTouch then
|
||||||
if inputObject == cameraTouch then return end
|
return
|
||||||
if inputObject == currentJumpTouch then return end
|
end
|
||||||
if inputObject.UserInputType ~= Enum.UserInputType.Touch then return end
|
if inputObject == cameraTouch then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if inputObject == currentJumpTouch then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if inputObject.UserInputType ~= Enum.UserInputType.Touch then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
thumbstickTouch = inputObject
|
thumbstickTouch = inputObject
|
||||||
table.insert(thumbstickTouches, thumbstickTouch)
|
table.insert(thumbstickTouches, thumbstickTouch)
|
||||||
|
|
@ -218,9 +273,17 @@ function constructThumbstick(defaultThumbstickPos, updateFunction, stationaryThu
|
||||||
if movedInput == thumbstickTouch then
|
if movedInput == thumbstickTouch then
|
||||||
local movementVector = nil
|
local movementVector = nil
|
||||||
if stationaryThumbstick then
|
if stationaryThumbstick then
|
||||||
movementVector = stationaryThumbstickTouchMove(thumbstickFrame,outerThumbstick,Vector2.new(movedInput.Position.x,movedInput.Position.y))
|
movementVector = stationaryThumbstickTouchMove(
|
||||||
|
thumbstickFrame,
|
||||||
|
outerThumbstick,
|
||||||
|
Vector2.new(movedInput.Position.x, movedInput.Position.y)
|
||||||
|
)
|
||||||
else
|
else
|
||||||
movementVector = followThumbstickTouchMove(thumbstickFrame,outerThumbstick,Vector2.new(movedInput.Position.x,movedInput.Position.y))
|
movementVector = followThumbstickTouchMove(
|
||||||
|
thumbstickFrame,
|
||||||
|
outerThumbstick,
|
||||||
|
Vector2.new(movedInput.Position.x, movedInput.Position.y)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
if updateFunction then
|
if updateFunction then
|
||||||
|
|
@ -300,9 +363,8 @@ function setupCharacterMovement( parentFrame )
|
||||||
return refreshCharacterMovement
|
return refreshCharacterMovement
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function setupJumpButton(parentFrame)
|
function setupJumpButton(parentFrame)
|
||||||
local jumpButton = Instance.new("ImageButton")
|
local jumpButton = Instance.new "ImageButton"
|
||||||
jumpButton.Name = "JumpButton"
|
jumpButton.Name = "JumpButton"
|
||||||
jumpButton.BackgroundTransparency = 1
|
jumpButton.BackgroundTransparency = 1
|
||||||
jumpButton.Image = touchControlsSheet
|
jumpButton.Image = touchControlsSheet
|
||||||
|
|
@ -327,9 +389,15 @@ function setupJumpButton( parentFrame )
|
||||||
end
|
end
|
||||||
|
|
||||||
jumpButton.InputBegan:connect(function(inputObject)
|
jumpButton.InputBegan:connect(function(inputObject)
|
||||||
if inputObject.UserInputType ~= Enum.UserInputType.Touch then return end
|
if inputObject.UserInputType ~= Enum.UserInputType.Touch then
|
||||||
if currentJumpTouch then return end
|
return
|
||||||
if inputObject == cameraTouch then return end
|
end
|
||||||
|
if currentJumpTouch then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if inputObject == cameraTouch then
|
||||||
|
return
|
||||||
|
end
|
||||||
for i, touch in pairs(oldJumpTouches) do
|
for i, touch in pairs(oldJumpTouches) do
|
||||||
if touch == inputObject then
|
if touch == inputObject then
|
||||||
return
|
return
|
||||||
|
|
@ -342,7 +410,9 @@ function setupJumpButton( parentFrame )
|
||||||
doJumpLoop()
|
doJumpLoop()
|
||||||
end)
|
end)
|
||||||
jumpButton.InputEnded:connect(function(inputObject)
|
jumpButton.InputEnded:connect(function(inputObject)
|
||||||
if inputObject.UserInputType ~= Enum.UserInputType.Touch then return end
|
if inputObject.UserInputType ~= Enum.UserInputType.Touch then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
jumpButton.ImageRectOffset = Vector2.new(176, 222)
|
jumpButton.ImageRectOffset = Vector2.new(176, 222)
|
||||||
jumpButton.ImageRectSize = Vector2.new(174, 174)
|
jumpButton.ImageRectSize = Vector2.new(174, 174)
|
||||||
|
|
@ -371,7 +441,9 @@ function setupJumpButton( parentFrame )
|
||||||
end
|
end
|
||||||
|
|
||||||
function isTouchUsedByJumpButton(touch)
|
function isTouchUsedByJumpButton(touch)
|
||||||
if touch == currentJumpTouch then return true end
|
if touch == currentJumpTouch then
|
||||||
|
return true
|
||||||
|
end
|
||||||
for i, touchToCompare in pairs(oldJumpTouches) do
|
for i, touchToCompare in pairs(oldJumpTouches) do
|
||||||
if touch == touchToCompare then
|
if touch == touchToCompare then
|
||||||
return true
|
return true
|
||||||
|
|
@ -419,8 +491,10 @@ function setupCameraControl(parentFrame, refreshCharacterMoveFunc)
|
||||||
|
|
||||||
local startPinch = function(firstTouch, secondTouch)
|
local startPinch = function(firstTouch, secondTouch)
|
||||||
-- track pinching in new frame
|
-- track pinching in new frame
|
||||||
if pinchFrame then pinchFrame:Destroy() end -- make sure we didn't track in any mud
|
if pinchFrame then
|
||||||
pinchFrame = Instance.new("Frame")
|
pinchFrame:Destroy()
|
||||||
|
end -- make sure we didn't track in any mud
|
||||||
|
pinchFrame = Instance.new "Frame"
|
||||||
pinchFrame.Name = "PinchFrame"
|
pinchFrame.Name = "PinchFrame"
|
||||||
pinchFrame.BackgroundTransparency = 1
|
pinchFrame.BackgroundTransparency = 1
|
||||||
pinchFrame.Parent = parentFrame
|
pinchFrame.Parent = parentFrame
|
||||||
|
|
@ -484,8 +558,12 @@ function setupCameraControl(parentFrame, refreshCharacterMoveFunc)
|
||||||
end
|
end
|
||||||
|
|
||||||
parentFrame.InputBegan:connect(function(inputObject)
|
parentFrame.InputBegan:connect(function(inputObject)
|
||||||
if inputObject.UserInputType ~= Enum.UserInputType.Touch then return end
|
if inputObject.UserInputType ~= Enum.UserInputType.Touch then
|
||||||
if isTouchUsedByJumpButton(inputObject) then return end
|
return
|
||||||
|
end
|
||||||
|
if isTouchUsedByJumpButton(inputObject) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local usedByThumbstick = isTouchUsedByThumbstick(inputObject)
|
local usedByThumbstick = isTouchUsedByThumbstick(inputObject)
|
||||||
if not usedByThumbstick then
|
if not usedByThumbstick then
|
||||||
|
|
@ -499,8 +577,12 @@ function setupCameraControl(parentFrame, refreshCharacterMoveFunc)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
userInputService.InputChanged:connect(function(inputObject)
|
userInputService.InputChanged:connect(function(inputObject)
|
||||||
if inputObject.UserInputType ~= Enum.UserInputType.Touch then return end
|
if inputObject.UserInputType ~= Enum.UserInputType.Touch then
|
||||||
if cameraTouch ~= inputObject then return end
|
return
|
||||||
|
end
|
||||||
|
if cameraTouch ~= inputObject then
|
||||||
|
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
|
local touchDiff = (lastPos - newPos) * CameraRotateSensitivity
|
||||||
|
|
@ -532,7 +614,7 @@ function setupCameraControl(parentFrame, refreshCharacterMoveFunc)
|
||||||
end
|
end
|
||||||
|
|
||||||
function setupTouchControls()
|
function setupTouchControls()
|
||||||
local touchControlFrame = Instance.new("Frame")
|
local touchControlFrame = Instance.new "Frame"
|
||||||
touchControlFrame.Name = "TouchControlFrame"
|
touchControlFrame.Name = "TouchControlFrame"
|
||||||
touchControlFrame.Size = UDim2.new(1, 0, 1, 0)
|
touchControlFrame.Size = UDim2.new(1, 0, 1, 0)
|
||||||
touchControlFrame.BackgroundTransparency = 1
|
touchControlFrame.BackgroundTransparency = 1
|
||||||
|
|
@ -543,7 +625,9 @@ function setupTouchControls()
|
||||||
setupCameraControl(touchControlFrame, refreshCharacterMoveFunc)
|
setupCameraControl(touchControlFrame, refreshCharacterMoveFunc)
|
||||||
|
|
||||||
userInputService.ProcessedEvent:connect(function(inputObject, processed)
|
userInputService.ProcessedEvent:connect(function(inputObject, processed)
|
||||||
if not processed then return end
|
if not processed then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- kill camera pan if the touch is used by some user controls
|
-- 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
|
||||||
|
|
@ -552,7 +636,6 @@ function setupTouchControls()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
-- Start of Script
|
-- Start of Script
|
||||||
|
|
|
||||||
772
157877000.lua
772
157877000.lua
File diff suppressed because it is too large
Load Diff
34
36868950.lua
34
36868950.lua
|
|
@ -1,13 +1,13 @@
|
||||||
local controlFrame = script.Parent:FindFirstChild("ControlFrame")
|
local controlFrame = script.Parent:FindFirstChild "ControlFrame"
|
||||||
|
|
||||||
if not controlFrame then return end
|
if not controlFrame then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local topLeftControl = controlFrame:FindFirstChild("TopLeftControl")
|
local bottomLeftControl = controlFrame:FindFirstChild "BottomLeftControl"
|
||||||
local bottomLeftControl = controlFrame:FindFirstChild("BottomLeftControl")
|
local bottomRightControl = controlFrame:FindFirstChild "BottomRightControl"
|
||||||
local bottomRightControl = controlFrame:FindFirstChild("BottomRightControl")
|
|
||||||
|
|
||||||
|
local frameTip = Instance.new "TextLabel"
|
||||||
local frameTip = Instance.new("TextLabel")
|
|
||||||
frameTip.Name = "ToolTip"
|
frameTip.Name = "ToolTip"
|
||||||
frameTip.Text = ""
|
frameTip.Text = ""
|
||||||
frameTip.Font = Enum.Font.ArialBold
|
frameTip.Font = Enum.Font.ArialBold
|
||||||
|
|
@ -22,7 +22,7 @@ frameTip.BackgroundTransparency = 1
|
||||||
frameTip.TextTransparency = 1
|
frameTip.TextTransparency = 1
|
||||||
frameTip.TextWrap = true
|
frameTip.TextWrap = true
|
||||||
|
|
||||||
local inside = Instance.new("BoolValue")
|
local inside = Instance.new "BoolValue"
|
||||||
inside.Name = "inside"
|
inside.Name = "inside"
|
||||||
inside.Value = false
|
inside.Value = false
|
||||||
inside.Parent = frameTip
|
inside.Parent = frameTip
|
||||||
|
|
@ -30,7 +30,7 @@ inside.Parent = frameTip
|
||||||
function setUpListeners(frameToListen)
|
function setUpListeners(frameToListen)
|
||||||
local fadeSpeed = 0.1
|
local fadeSpeed = 0.1
|
||||||
frameToListen.Parent.MouseEnter:connect(function()
|
frameToListen.Parent.MouseEnter:connect(function()
|
||||||
if frameToListen:FindFirstChild("inside") then
|
if frameToListen:FindFirstChild "inside" then
|
||||||
frameToListen.inside.Value = true
|
frameToListen.inside.Value = true
|
||||||
wait(1.2)
|
wait(1.2)
|
||||||
if frameToListen.inside.Value then
|
if frameToListen.inside.Value then
|
||||||
|
|
@ -47,13 +47,17 @@ function setUpListeners(frameToListen)
|
||||||
killFrame.BackgroundTransparency = 1
|
killFrame.BackgroundTransparency = 1
|
||||||
killFrame.TextTransparency = 1
|
killFrame.TextTransparency = 1
|
||||||
end
|
end
|
||||||
frameToListen.Parent.MouseLeave:connect(function() killTip(frameToListen) end)
|
frameToListen.Parent.MouseLeave:connect(function()
|
||||||
frameToListen.Parent.MouseButton1Click:connect(function() killTip(frameToListen) end)
|
killTip(frameToListen)
|
||||||
|
end)
|
||||||
|
frameToListen.Parent.MouseButton1Click:connect(function()
|
||||||
|
killTip(frameToListen)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function createSettingsButtonTip(parent)
|
function createSettingsButtonTip(parent)
|
||||||
if parent == nil then
|
if parent == nil then
|
||||||
parent = bottomLeftControl:FindFirstChild("SettingsButton")
|
parent = bottomLeftControl:FindFirstChild "SettingsButton"
|
||||||
end
|
end
|
||||||
|
|
||||||
local toolTip = frameTip:clone()
|
local toolTip = frameTip:clone()
|
||||||
|
|
@ -70,10 +74,8 @@ wait(5) -- make sure we are loaded in, won't need tool tips for first 5 seconds
|
||||||
---------------- set up Bottom Left Tool Tips -------------------------
|
---------------- set up Bottom Left Tool Tips -------------------------
|
||||||
|
|
||||||
local bottomLeftChildren = bottomLeftControl:GetChildren()
|
local bottomLeftChildren = bottomLeftControl:GetChildren()
|
||||||
local hasSettingsTip = false
|
|
||||||
|
|
||||||
for i = 1, #bottomLeftChildren do
|
for i = 1, #bottomLeftChildren do
|
||||||
|
|
||||||
if bottomLeftChildren[i].Name == "Exit" then
|
if bottomLeftChildren[i].Name == "Exit" then
|
||||||
local exitTip = frameTip:clone()
|
local exitTip = frameTip:clone()
|
||||||
exitTip.RobloxLocked = true
|
exitTip.RobloxLocked = true
|
||||||
|
|
@ -93,11 +95,11 @@ end
|
||||||
local bottomRightChildren = bottomRightControl:GetChildren()
|
local bottomRightChildren = bottomRightControl:GetChildren()
|
||||||
|
|
||||||
for i = 1, #bottomRightChildren do
|
for i = 1, #bottomRightChildren do
|
||||||
if bottomRightChildren[i].Name:find("Camera") ~= nil then
|
if bottomRightChildren[i].Name:find "Camera" ~= nil then
|
||||||
local cameraTip = frameTip:clone()
|
local cameraTip = frameTip:clone()
|
||||||
cameraTip.RobloxLocked = true
|
cameraTip.RobloxLocked = true
|
||||||
cameraTip.Text = "Camera View"
|
cameraTip.Text = "Camera View"
|
||||||
if bottomRightChildren[i].Name:find("Zoom") then
|
if bottomRightChildren[i].Name:find "Zoom" then
|
||||||
cameraTip.Position = UDim2.new(-1, 0, -1.5)
|
cameraTip.Position = UDim2.new(-1, 0, -1.5)
|
||||||
else
|
else
|
||||||
cameraTip.Position = UDim2.new(0, 0, -1.5, 0)
|
cameraTip.Position = UDim2.new(0, 0, -1.5, 0)
|
||||||
|
|
|
||||||
28
37801172.lua
28
37801172.lua
|
|
@ -1,10 +1,11 @@
|
||||||
|
|
||||||
-- Creates all neccessary scripts for the gui on initial load, everything except build tools
|
-- Creates all neccessary scripts for the gui on initial load, everything except build tools
|
||||||
-- Created by Ben T. 10/29/10
|
-- 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
|
-- Please note that these are loaded in a specific order to diminish errors/perceived load time by user
|
||||||
local scriptContext = game:GetService("ScriptContext")
|
local scriptContext = game:GetService "ScriptContext"
|
||||||
local touchEnabled = false
|
local touchEnabled = false
|
||||||
pcall(function() touchEnabled = game:GetService("UserInputService").TouchEnabled end)
|
pcall(function()
|
||||||
|
touchEnabled = game:GetService("UserInputService").TouchEnabled
|
||||||
|
end)
|
||||||
|
|
||||||
-- library registration
|
-- library registration
|
||||||
scriptContext:AddCoreScript(60595695, scriptContext, "/Libraries/LibraryRegistration/LibraryRegistration")
|
scriptContext:AddCoreScript(60595695, scriptContext, "/Libraries/LibraryRegistration/LibraryRegistration")
|
||||||
|
|
@ -21,11 +22,11 @@ local function waitForProperty(instance, property)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Responsible for tracking logging items
|
-- Responsible for tracking logging items
|
||||||
local scriptContext = game:GetService("ScriptContext")
|
local scriptContext = game:GetService "ScriptContext"
|
||||||
scriptContext:AddCoreScript(59002209, scriptContext, "CoreScripts/Sections")
|
scriptContext:AddCoreScript(59002209, scriptContext, "CoreScripts/Sections")
|
||||||
|
|
||||||
waitForChild(game:GetService("CoreGui"),"RobloxGui")
|
waitForChild(game:GetService "CoreGui", "RobloxGui")
|
||||||
local screenGui = game:GetService("CoreGui"):FindFirstChild("RobloxGui")
|
local screenGui = game:GetService("CoreGui"):FindFirstChild "RobloxGui"
|
||||||
|
|
||||||
if not touchEnabled then
|
if not touchEnabled then
|
||||||
-- ToolTipper (creates tool tips for gui)
|
-- ToolTipper (creates tool tips for gui)
|
||||||
|
|
@ -48,10 +49,7 @@ scriptContext:AddCoreScript(97188756, screenGui, "CoreScripts/ChatScript")
|
||||||
-- Purchase Prompt Script
|
-- Purchase Prompt Script
|
||||||
scriptContext:AddCoreScript(107893730, screenGui, "CoreScripts/PurchasePromptScript")
|
scriptContext:AddCoreScript(107893730, screenGui, "CoreScripts/PurchasePromptScript")
|
||||||
|
|
||||||
if not touchEnabled then
|
if not touchEnabled or screenGui.AbsoluteSize.Y > 600 then
|
||||||
-- New Player List
|
|
||||||
scriptContext:AddCoreScript(48488235,screenGui,"CoreScripts/PlayerListScript")
|
|
||||||
elseif screenGui.AbsoluteSize.Y > 600 then
|
|
||||||
-- New Player List
|
-- New Player List
|
||||||
scriptContext:AddCoreScript(48488235, screenGui, "CoreScripts/PlayerListScript")
|
scriptContext:AddCoreScript(48488235, screenGui, "CoreScripts/PlayerListScript")
|
||||||
else
|
else
|
||||||
|
|
@ -86,12 +84,12 @@ if game.CoreGui.Version >= 3 and game.PlaceId ~= 130815926 then --todo: remove p
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local IsPersonalServer = not not game.Workspace:FindFirstChild("PSVariable")
|
local IsPersonalServer = not not game.Workspace:FindFirstChild "PSVariable"
|
||||||
if IsPersonalServer then
|
if IsPersonalServer then
|
||||||
game:GetService("ScriptContext"):AddCoreScript(64164692, game.Players.LocalPlayer, "BuildToolManager")
|
game:GetService("ScriptContext"):AddCoreScript(64164692, game.Players.LocalPlayer, "BuildToolManager")
|
||||||
end
|
end
|
||||||
game.Workspace.ChildAdded:connect(function(nchild)
|
game.Workspace.ChildAdded:connect(function(nchild)
|
||||||
if nchild.Name=='PSVariable' and nchild:IsA('BoolValue') then
|
if nchild.Name == "PSVariable" and nchild:IsA "BoolValue" then
|
||||||
IsPersonalServer = true
|
IsPersonalServer = true
|
||||||
game:GetService("ScriptContext"):AddCoreScript(64164692, game.Players.LocalPlayer, "BuildToolManager")
|
game:GetService("ScriptContext"):AddCoreScript(64164692, game.Players.LocalPlayer, "BuildToolManager")
|
||||||
end
|
end
|
||||||
|
|
@ -101,10 +99,10 @@ if touchEnabled then -- touch devices don't use same control frame
|
||||||
-- only used for touch device button generation
|
-- 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")
|
||||||
waitForChild(screenGui.ControlFrame, 'BottomLeftControl')
|
waitForChild(screenGui.ControlFrame, "BottomLeftControl")
|
||||||
screenGui.ControlFrame.BottomLeftControl.Visible = false
|
screenGui.ControlFrame.BottomLeftControl.Visible = false
|
||||||
|
|
||||||
waitForChild(screenGui.ControlFrame, 'TopLeftControl')
|
waitForChild(screenGui.ControlFrame, "TopLeftControl")
|
||||||
screenGui.ControlFrame.TopLeftControl.Visible = false
|
screenGui.ControlFrame.TopLeftControl.Visible = false
|
||||||
end
|
end
|
||||||
133
38037565.lua
133
38037565.lua
|
|
@ -1,52 +1,52 @@
|
||||||
local damageGuiWidth = 5.0
|
local damageGuiWidth = 5.0
|
||||||
local damageGuiHeight = 5.0
|
local damageGuiHeight = 5.0
|
||||||
|
|
||||||
|
|
||||||
function waitForChild(parent, childName)
|
function waitForChild(parent, childName)
|
||||||
local child = parent:findFirstChild(childName)
|
local child = parent:findFirstChild(childName)
|
||||||
if child then return child end
|
if child then
|
||||||
|
return child
|
||||||
|
end
|
||||||
while true do
|
while true do
|
||||||
child = parent.ChildAdded:wait()
|
child = parent.ChildAdded:wait()
|
||||||
if child.Name==childName then return child end
|
if child.Name == childName then
|
||||||
|
return child
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- declarations
|
-- declarations
|
||||||
local Figure = script.Parent
|
local Figure = script.Parent
|
||||||
local Head = waitForChild(Figure, "Head")
|
local Humanoid = waitForChild(Figure, "Humanoid")
|
||||||
local Humanoid = waitForChild(Figure, "Humanoid")
|
local Torso = waitForChild(Figure, "Torso")
|
||||||
local walkSpeed = Humanoid.WalkSpeed
|
|
||||||
local Torso = waitForChild(Figure, "Torso")
|
|
||||||
|
|
||||||
local config = Figure:FindFirstChild("PlayerStats")
|
local config = Figure:FindFirstChild "PlayerStats"
|
||||||
|
|
||||||
local inCharTag = Instance.new("BoolValue")
|
local inCharTag = Instance.new "BoolValue"
|
||||||
inCharTag.Name = "InCharTag"
|
inCharTag.Name = "InCharTag"
|
||||||
|
|
||||||
local hider = Instance.new("BoolValue")
|
local hider = Instance.new "BoolValue"
|
||||||
hider.Name = "RobloxBuildTool"
|
hider.Name = "RobloxBuildTool"
|
||||||
|
|
||||||
local currentChildren
|
local currentChildren
|
||||||
local backpackTools
|
local backpackTools
|
||||||
|
|
||||||
if config == nil then
|
if config == nil then
|
||||||
config = Instance.new("Configuration")
|
config = Instance.new "Configuration"
|
||||||
config.Parent = Figure
|
config.Parent = Figure
|
||||||
config.Name = "PlayerStats"
|
config.Name = "PlayerStats"
|
||||||
end
|
end
|
||||||
|
|
||||||
local myHealth = config:FindFirstChild("MaxHealth")
|
local myHealth = config:FindFirstChild "MaxHealth"
|
||||||
if myHealth == nil then
|
if myHealth == nil then
|
||||||
myHealth = Instance.new("NumberValue")
|
myHealth = Instance.new "NumberValue"
|
||||||
myHealth.Parent = config
|
myHealth.Parent = config
|
||||||
myHealth.Value = 100
|
myHealth.Value = 100
|
||||||
myHealth.Name = "MaxHealth"
|
myHealth.Name = "MaxHealth"
|
||||||
end
|
end
|
||||||
|
|
||||||
Humanoid.MaxHealth = myHealth.Value
|
Humanoid.MaxHealth = myHealth.Value
|
||||||
Humanoid.Health = myHealth.Value
|
Humanoid.Health = myHealth.Value
|
||||||
|
|
||||||
|
|
||||||
function onMaxHealthChange()
|
function onMaxHealthChange()
|
||||||
Humanoid.MaxHealth = myHealth.Value
|
Humanoid.MaxHealth = myHealth.Value
|
||||||
Humanoid.Health = myHealth.Value
|
Humanoid.Health = myHealth.Value
|
||||||
|
|
@ -54,39 +54,43 @@ end
|
||||||
|
|
||||||
myHealth.Changed:connect(onMaxHealthChange)
|
myHealth.Changed:connect(onMaxHealthChange)
|
||||||
|
|
||||||
|
|
||||||
--Humanoid.MaxHealth = myHealth.Value
|
--Humanoid.MaxHealth = myHealth.Value
|
||||||
--Humanoid.Health = Humanoid.MaxHealth
|
--Humanoid.Health = Humanoid.MaxHealth
|
||||||
|
|
||||||
local vPlayer = game.Players:GetPlayerFromCharacter(script.Parent)
|
local vPlayer = game.Players:GetPlayerFromCharacter(script.Parent)
|
||||||
local dotGui = vPlayer.PlayerGui:FindFirstChild("DamageOverTimeGui")
|
local dotGui = vPlayer.PlayerGui:FindFirstChild "DamageOverTimeGui"
|
||||||
if dotGui == nil then
|
if dotGui == nil then
|
||||||
dotGui = Instance.new("BillboardGui")
|
dotGui = Instance.new "BillboardGui"
|
||||||
dotGui.Name = "DamageOverTimeGui"
|
dotGui.Name = "DamageOverTimeGui"
|
||||||
dotGui.Parent = vPlayer.PlayerGui
|
dotGui.Parent = vPlayer.PlayerGui
|
||||||
dotGui.Adornee = script.Parent:FindFirstChild("Head")
|
dotGui.Adornee = script.Parent:FindFirstChild "Head"
|
||||||
dotGui.Active = true
|
dotGui.Active = true
|
||||||
dotGui.size = UDim2.new(damageGuiWidth, 0.0, damageGuiHeight, 0.0)
|
dotGui.size = UDim2.new(damageGuiWidth, 0, damageGuiHeight, 0.0)
|
||||||
dotGui.StudsOffset = Vector3.new(0.0, 2.0, 0.0)
|
dotGui.StudsOffset = Vector3.new(0, 2.0, 0.0)
|
||||||
end
|
end
|
||||||
|
|
||||||
print("newHealth declarations finished")
|
print "newHealth declarations finished"
|
||||||
|
|
||||||
function billboardHealthChange(dmg)
|
function billboardHealthChange(dmg)
|
||||||
local textLabel = Instance.new("TextLabel")
|
local textLabel = Instance.new "TextLabel"
|
||||||
if dmg > 0 then textLabel.Text = tostring(dmg) textLabel.TextColor3 = Color3.new(0, 1, 0)
|
if dmg > 0 then
|
||||||
else textLabel.Text = tostring(dmg) textLabel.TextColor3 = Color3.new(1, 0, 1) end
|
textLabel.Text = tostring(dmg)
|
||||||
textLabel.size = UDim2.new(1.0, 0.0, 1.0, 0.0)
|
textLabel.TextColor3 = Color3.new(0, 1, 0)
|
||||||
|
else
|
||||||
|
textLabel.Text = tostring(dmg)
|
||||||
|
textLabel.TextColor3 = Color3.new(1, 0, 1)
|
||||||
|
end
|
||||||
|
textLabel.size = UDim2.new(1, 0, 1, 0.0)
|
||||||
textLabel.Active = true
|
textLabel.Active = true
|
||||||
textLabel.FontSize = 6
|
textLabel.FontSize = 6
|
||||||
textLabel.BackgroundTransparency = 1
|
textLabel.BackgroundTransparency = 1
|
||||||
textLabel.Parent = dotGui
|
textLabel.Parent = dotGui
|
||||||
|
|
||||||
for t = 1, 10 do
|
for t = 1, 10 do
|
||||||
wait(.1)
|
wait(0.1)
|
||||||
textLabel.TextTransparency = t / 10
|
textLabel.TextTransparency = t / 10
|
||||||
textLabel.Position = UDim2.new(0, 0, 0, -t * 5)
|
textLabel.Position = UDim2.new(0, 0, 0, -t * 5)
|
||||||
textLabel.FontSize = 6-t*.6
|
textLabel.FontSize = 6 - t * 0.6
|
||||||
end
|
end
|
||||||
|
|
||||||
textLabel:remove()
|
textLabel:remove()
|
||||||
|
|
@ -94,10 +98,10 @@ end
|
||||||
|
|
||||||
function setMaxHealth()
|
function setMaxHealth()
|
||||||
--print(Humanoid.Health)
|
--print(Humanoid.Health)
|
||||||
if myHealth.Value >=0 then
|
if myHealth.Value >= 0 then
|
||||||
Humanoid.MaxHealth = myHealth.Value
|
Humanoid.MaxHealth = myHealth.Value
|
||||||
print(Humanoid.MaxHealth)
|
print(Humanoid.MaxHealth)
|
||||||
if Humanoid.Health > Humanoid.MaxHealth then
|
if Humanoid.Health > Humanoid.MaxHealth then
|
||||||
Humanoid.Health = Humanoid.MaxHealth
|
Humanoid.Health = Humanoid.MaxHealth
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -107,43 +111,50 @@ myHealth.Changed:connect(setMaxHealth)
|
||||||
|
|
||||||
-- Visual Effects --
|
-- Visual Effects --
|
||||||
|
|
||||||
fireEffect = Instance.new("Fire")
|
fireEffect = Instance.new "Fire"
|
||||||
fireEffect.Heat = 0.1
|
fireEffect.Heat = 0.1
|
||||||
fireEffect.Size = 3.0
|
fireEffect.Size = 3.0
|
||||||
fireEffect.Name = "FireEffect"
|
fireEffect.Name = "FireEffect"
|
||||||
fireEffect.Enabled = false
|
fireEffect.Enabled = false
|
||||||
--
|
--
|
||||||
|
|
||||||
|
|
||||||
-- regeneration
|
-- regeneration
|
||||||
while true do
|
while true do
|
||||||
local s = wait(1)
|
local s = wait(1)
|
||||||
local health = Humanoid.Health
|
local health = Humanoid.Health
|
||||||
if health > 0 then -- and health < Humanoid.MaxHealth then
|
if health > 0 then -- and health < Humanoid.MaxHealth then
|
||||||
local delta = 0
|
local delta = 0
|
||||||
if config then
|
if config then
|
||||||
regen = config:FindFirstChild("Regen")
|
regen = config:FindFirstChild "Regen"
|
||||||
poison = config:FindFirstChild("Poison")
|
poison = config:FindFirstChild "Poison"
|
||||||
ice = config:FindFirstChild("Ice")
|
ice = config:FindFirstChild "Ice"
|
||||||
fire = config:FindFirstChild("Fire")
|
fire = config:FindFirstChild "Fire"
|
||||||
stun = config:FindFirstChild("Stun")
|
stun = config:FindFirstChild "Stun"
|
||||||
if regen then
|
if regen then
|
||||||
delta = delta + regen.Value.X
|
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?
|
if regen.Value.Y >= 0 then
|
||||||
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, regen.Value.Y - s, regen.Value.Z) -- maybe have 3rd parameter be an increaser/decreaser?
|
||||||
else regen:remove() end -- infinity is -1
|
elseif regen.Value.Y == -1 then
|
||||||
|
regen.Value = Vector3.new(regen.Value.X + regen.Value.Z, -1, regen.Value.Z)
|
||||||
|
else
|
||||||
|
regen:remove()
|
||||||
|
end -- infinity is -1
|
||||||
end
|
end
|
||||||
if poison then
|
if poison then
|
||||||
delta = delta - poison.Value.X
|
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)
|
if poison.Value.Y >= 0 then
|
||||||
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, poison.Value.Y - s, poison.Value.Z)
|
||||||
else poison:remove() end -- infinity is -1
|
elseif poison.Value.Y == -1 then
|
||||||
|
poison.Value = Vector3.new(poison.Value.X + poison.Value.Z, -1, poison.Value.Z)
|
||||||
|
else
|
||||||
|
poison:remove()
|
||||||
|
end -- infinity is -1
|
||||||
end
|
end
|
||||||
|
|
||||||
if ice then
|
if ice then
|
||||||
--print("IN ICE")
|
--print("IN ICE")
|
||||||
delta = delta - ice.Value.X
|
delta = delta - ice.Value.X
|
||||||
if ice.Value.Y >=0 then
|
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
|
else
|
||||||
ice:remove()
|
ice:remove()
|
||||||
|
|
@ -154,7 +165,7 @@ fireEffect.Enabled = false
|
||||||
fireEffect.Enabled = true
|
fireEffect.Enabled = true
|
||||||
fireEffect.Parent = Figure.Torso
|
fireEffect.Parent = Figure.Torso
|
||||||
delta = delta - fire.Value.X
|
delta = delta - fire.Value.X
|
||||||
if fire.Value.Y >= 0 then
|
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
|
else
|
||||||
fire:remove()
|
fire:remove()
|
||||||
|
|
@ -164,19 +175,19 @@ fireEffect.Enabled = false
|
||||||
end
|
end
|
||||||
|
|
||||||
if stun then
|
if stun then
|
||||||
if stun.Value > 0 then
|
if stun.Value > 0 then
|
||||||
Torso.Anchored = true
|
Torso.Anchored = true
|
||||||
currentChildren = script.Parent:GetChildren()
|
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
|
for i = 1, #currentChildren do
|
||||||
if currentChildren[i].className == "Tool" then
|
if currentChildren[i].className == "Tool" then
|
||||||
inCharTag:Clone().Parent = currentChildren[i]
|
inCharTag:Clone().Parent = currentChildren[i]
|
||||||
print(backpackTools)
|
print(backpackTools)
|
||||||
table.insert(backpackTools, currentChildren[i])
|
table.insert(backpackTools, currentChildren[i])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for i = 1, #backpackTools do
|
for i = 1, #backpackTools do
|
||||||
if backpackTools[i]:FindFirstChild("RobloxBuildTool") == nil then
|
if backpackTools[i]:FindFirstChild "RobloxBuildTool" == nil then
|
||||||
hider:Clone().Parent = backpackTools[i]
|
hider:Clone().Parent = backpackTools[i]
|
||||||
backpackTools[i].Parent = game.Lighting
|
backpackTools[i].Parent = game.Lighting
|
||||||
end
|
end
|
||||||
|
|
@ -189,13 +200,15 @@ fireEffect.Enabled = false
|
||||||
else
|
else
|
||||||
Torso.Anchored = false
|
Torso.Anchored = false
|
||||||
for i = 1, #backpackTools do
|
for i = 1, #backpackTools do
|
||||||
rbTool = backpackTools[i]:FindFirstChild("RobloxBuildTool")
|
rbTool = backpackTools[i]:FindFirstChild "RobloxBuildTool"
|
||||||
if rbTool then rbTool:Remove() end
|
if rbTool then
|
||||||
|
rbTool:Remove()
|
||||||
|
end
|
||||||
backpackTools[i].Parent = game.Lighting
|
backpackTools[i].Parent = game.Lighting
|
||||||
end
|
end
|
||||||
wait(0.2)
|
wait(0.2)
|
||||||
for i = 1, #backpackTools do
|
for i = 1, #backpackTools do
|
||||||
wasInCharacter = backpackTools[i]:FindFirstChild("InCharTag")
|
wasInCharacter = backpackTools[i]:FindFirstChild "InCharTag"
|
||||||
if wasInChar then
|
if wasInChar then
|
||||||
wasInChar:Remove()
|
wasInChar:Remove()
|
||||||
backpackTools[i].Parent = script.Parent
|
backpackTools[i].Parent = script.Parent
|
||||||
|
|
@ -216,10 +229,10 @@ fireEffect.Enabled = false
|
||||||
--health = health + delta * s * Humanoid.MaxHealth
|
--health = health + delta * s * Humanoid.MaxHealth
|
||||||
|
|
||||||
health = Humanoid.Health + delta * s
|
health = Humanoid.Health + delta * s
|
||||||
if health * 1.01 < Humanoid.MaxHealth then
|
if health * 1.01 < Humanoid.MaxHealth then
|
||||||
Humanoid.Health = health
|
Humanoid.Health = health
|
||||||
--myHealth.Value = math.floor(Humanoid.Health)
|
--myHealth.Value = math.floor(Humanoid.Health)
|
||||||
elseif delta > 0 then
|
elseif delta > 0 then
|
||||||
Humanoid.Health = Humanoid.MaxHealth
|
Humanoid.Health = Humanoid.MaxHealth
|
||||||
--myHealth.Value = Humanoid.Health
|
--myHealth.Value = Humanoid.Health
|
||||||
end
|
end
|
||||||
|
|
|
||||||
112
39250920.lua
112
39250920.lua
|
|
@ -10,7 +10,6 @@ function waitForChild(instance, name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local mainFrame
|
local mainFrame
|
||||||
local choices = {}
|
local choices = {}
|
||||||
local lastChoice
|
local lastChoice
|
||||||
|
|
@ -27,7 +26,6 @@ local conversationTimedOut = "Chat ended because you didn't reply"
|
||||||
local conversationTimedOutSize = 350
|
local conversationTimedOutSize = 350
|
||||||
|
|
||||||
local player
|
local player
|
||||||
local screenGui
|
|
||||||
local chatNotificationGui
|
local chatNotificationGui
|
||||||
local messageDialog
|
local messageDialog
|
||||||
local timeoutScript
|
local timeoutScript
|
||||||
|
|
@ -38,7 +36,7 @@ local dialogConnections = {}
|
||||||
local gui = nil
|
local gui = nil
|
||||||
waitForChild(game, "CoreGui")
|
waitForChild(game, "CoreGui")
|
||||||
waitForChild(game.CoreGui, "RobloxGui")
|
waitForChild(game.CoreGui, "RobloxGui")
|
||||||
if game.CoreGui.RobloxGui:FindFirstChild("ControlFrame") then
|
if game.CoreGui.RobloxGui:FindFirstChild "ControlFrame" then
|
||||||
gui = game.CoreGui.RobloxGui.ControlFrame
|
gui = game.CoreGui.RobloxGui.ControlFrame
|
||||||
else
|
else
|
||||||
gui = game.CoreGui.RobloxGui
|
gui = game.CoreGui.RobloxGui
|
||||||
|
|
@ -52,9 +50,8 @@ function currentTone()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function createChatNotificationGui()
|
function createChatNotificationGui()
|
||||||
chatNotificationGui = Instance.new("BillboardGui")
|
chatNotificationGui = Instance.new "BillboardGui"
|
||||||
chatNotificationGui.Name = "ChatNotificationGui"
|
chatNotificationGui.Name = "ChatNotificationGui"
|
||||||
chatNotificationGui.ExtentsOffset = Vector3.new(0, 1, 0)
|
chatNotificationGui.ExtentsOffset = Vector3.new(0, 1, 0)
|
||||||
chatNotificationGui.Size = UDim2.new(4, 0, 5.42857122, 0)
|
chatNotificationGui.Size = UDim2.new(4, 0, 5.42857122, 0)
|
||||||
|
|
@ -64,18 +61,17 @@ function createChatNotificationGui()
|
||||||
chatNotificationGui.RobloxLocked = true
|
chatNotificationGui.RobloxLocked = true
|
||||||
chatNotificationGui.Active = true
|
chatNotificationGui.Active = true
|
||||||
|
|
||||||
local image = Instance.new("ImageLabel")
|
local image = Instance.new "ImageLabel"
|
||||||
image.Name = "Image"
|
image.Name = "Image"
|
||||||
image.Active = false
|
image.Active = false
|
||||||
image.BackgroundTransparency = 1
|
image.BackgroundTransparency = 1
|
||||||
image.Position = UDim2.new(0, 0, 0, 0)
|
image.Position = UDim2.new(0, 0, 0, 0)
|
||||||
image.Size = UDim2.new(1.0,0,1.0,0)
|
image.Size = UDim2.new(1, 0, 1, 0)
|
||||||
image.Image = ""
|
image.Image = ""
|
||||||
image.RobloxLocked = true
|
image.RobloxLocked = true
|
||||||
image.Parent = chatNotificationGui
|
image.Parent = chatNotificationGui
|
||||||
|
|
||||||
|
local button = Instance.new "ImageButton"
|
||||||
local button = Instance.new("ImageButton")
|
|
||||||
button.Name = "Button"
|
button.Name = "Button"
|
||||||
button.AutoButtonColor = false
|
button.AutoButtonColor = false
|
||||||
button.Position = UDim2.new(0.0879999995, 0, 0.0529999994, 0)
|
button.Position = UDim2.new(0.0879999995, 0, 0.0529999994, 0)
|
||||||
|
|
@ -97,7 +93,7 @@ function getChatColor(tone)
|
||||||
end
|
end
|
||||||
|
|
||||||
function styleChoices(tone)
|
function styleChoices(tone)
|
||||||
for i, obj in pairs(choices) do
|
for _, obj in pairs(choices) do
|
||||||
resetColor(obj, tone)
|
resetColor(obj, tone)
|
||||||
end
|
end
|
||||||
resetColor(lastChoice, tone)
|
resetColor(lastChoice, tone)
|
||||||
|
|
@ -135,12 +131,12 @@ function setChatNotificationTone(gui, purpose, tone)
|
||||||
end
|
end
|
||||||
|
|
||||||
function createMessageDialog()
|
function createMessageDialog()
|
||||||
messageDialog = Instance.new("Frame");
|
messageDialog = Instance.new "Frame"
|
||||||
messageDialog.Name = "DialogScriptMessage"
|
messageDialog.Name = "DialogScriptMessage"
|
||||||
messageDialog.Style = Enum.FrameStyle.RobloxRound
|
messageDialog.Style = Enum.FrameStyle.RobloxRound
|
||||||
messageDialog.Visible = false
|
messageDialog.Visible = false
|
||||||
|
|
||||||
local text = Instance.new("TextLabel")
|
local text = Instance.new "TextLabel"
|
||||||
text.Name = "Text"
|
text.Name = "Text"
|
||||||
text.Position = UDim2.new(0, 0, 0, -1)
|
text.Position = UDim2.new(0, 0, 0, -1)
|
||||||
text.Size = UDim2.new(1, 0, 1, 0)
|
text.Size = UDim2.new(1, 0, 1, 0)
|
||||||
|
|
@ -192,20 +188,20 @@ function highlightColor(frame, tone)
|
||||||
end
|
end
|
||||||
|
|
||||||
function wanderDialog()
|
function wanderDialog()
|
||||||
print("Wander")
|
print "Wander"
|
||||||
mainFrame.Visible = false
|
mainFrame.Visible = false
|
||||||
endDialog()
|
endDialog()
|
||||||
showMessage(characterWanderedOffMessage, characterWanderedOffSize)
|
showMessage(characterWanderedOffMessage, characterWanderedOffSize)
|
||||||
end
|
end
|
||||||
|
|
||||||
function timeoutDialog()
|
function timeoutDialog()
|
||||||
print("Timeout")
|
print "Timeout"
|
||||||
mainFrame.Visible = false
|
mainFrame.Visible = false
|
||||||
endDialog()
|
endDialog()
|
||||||
showMessage(conversationTimedOut, conversationTimedOutSize)
|
showMessage(conversationTimedOut, conversationTimedOutSize)
|
||||||
end
|
end
|
||||||
function normalEndDialog()
|
function normalEndDialog()
|
||||||
print("Done")
|
print "Done"
|
||||||
endDialog()
|
endDialog()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -253,10 +249,18 @@ function selectChoice(choice)
|
||||||
else
|
else
|
||||||
local dialogChoice = choiceMap[choice]
|
local dialogChoice = choiceMap[choice]
|
||||||
|
|
||||||
game.Chat:Chat(game.Players.LocalPlayer.Character, sanitizeMessage(dialogChoice.UserDialog), getChatColor(currentTone()))
|
game.Chat:Chat(
|
||||||
|
game.Players.LocalPlayer.Character,
|
||||||
|
sanitizeMessage(dialogChoice.UserDialog),
|
||||||
|
getChatColor(currentTone())
|
||||||
|
)
|
||||||
wait(1)
|
wait(1)
|
||||||
currentConversationDialog:SignalDialogChoiceSelected(player, dialogChoice)
|
currentConversationDialog:SignalDialogChoiceSelected(player, dialogChoice)
|
||||||
game.Chat:Chat(currentConversationPartner, sanitizeMessage(dialogChoice.ResponseDialog), getChatColor(currentTone()))
|
game.Chat:Chat(
|
||||||
|
currentConversationPartner,
|
||||||
|
sanitizeMessage(dialogChoice.ResponseDialog),
|
||||||
|
getChatColor(currentTone())
|
||||||
|
)
|
||||||
|
|
||||||
variableDelay(dialogChoice.ResponseDialog)
|
variableDelay(dialogChoice.ResponseDialog)
|
||||||
presentDialogChoices(currentConversationPartner, dialogChoice:GetChildren())
|
presentDialogChoices(currentConversationPartner, dialogChoice:GetChildren())
|
||||||
|
|
@ -264,17 +268,23 @@ function selectChoice(choice)
|
||||||
end
|
end
|
||||||
|
|
||||||
function newChoice(numberText)
|
function newChoice(numberText)
|
||||||
local frame = Instance.new("TextButton")
|
local frame = Instance.new "TextButton"
|
||||||
frame.BackgroundColor3 = Color3.new(0 / 255, 0 / 255, 179 / 255)
|
frame.BackgroundColor3 = Color3.new(0 / 255, 0 / 255, 179 / 255)
|
||||||
frame.AutoButtonColor = false
|
frame.AutoButtonColor = false
|
||||||
frame.BorderSizePixel = 0
|
frame.BorderSizePixel = 0
|
||||||
frame.Text = ""
|
frame.Text = ""
|
||||||
frame.MouseEnter:connect(function() highlightColor(frame, currentTone()) end)
|
frame.MouseEnter:connect(function()
|
||||||
frame.MouseLeave:connect(function() resetColor(frame, currentTone()) end)
|
highlightColor(frame, currentTone())
|
||||||
frame.MouseButton1Click:connect(function() selectChoice(frame) end)
|
end)
|
||||||
|
frame.MouseLeave:connect(function()
|
||||||
|
resetColor(frame, currentTone())
|
||||||
|
end)
|
||||||
|
frame.MouseButton1Click:connect(function()
|
||||||
|
selectChoice(frame)
|
||||||
|
end)
|
||||||
frame.RobloxLocked = true
|
frame.RobloxLocked = true
|
||||||
|
|
||||||
local number = Instance.new("TextLabel")
|
local number = Instance.new "TextLabel"
|
||||||
number.Name = "Number"
|
number.Name = "Number"
|
||||||
number.TextColor3 = Color3.new(127 / 255, 212 / 255, 255 / 255)
|
number.TextColor3 = Color3.new(127 / 255, 212 / 255, 255 / 255)
|
||||||
number.Text = numberText
|
number.Text = numberText
|
||||||
|
|
@ -287,7 +297,7 @@ function newChoice(numberText)
|
||||||
number.RobloxLocked = true
|
number.RobloxLocked = true
|
||||||
number.Parent = frame
|
number.Parent = frame
|
||||||
|
|
||||||
local prompt = Instance.new("TextLabel")
|
local prompt = Instance.new "TextLabel"
|
||||||
prompt.Name = "UserPrompt"
|
prompt.Name = "UserPrompt"
|
||||||
prompt.BackgroundTransparency = 1
|
prompt.BackgroundTransparency = 1
|
||||||
prompt.TextColor3 = Color3.new(1, 1, 1)
|
prompt.TextColor3 = Color3.new(1, 1, 1)
|
||||||
|
|
@ -303,22 +313,22 @@ function newChoice(numberText)
|
||||||
return frame
|
return frame
|
||||||
end
|
end
|
||||||
function initialize(parent)
|
function initialize(parent)
|
||||||
choices[1] = newChoice("1)")
|
choices[1] = newChoice "1)"
|
||||||
choices[2] = newChoice("2)")
|
choices[2] = newChoice "2)"
|
||||||
choices[3] = newChoice("3)")
|
choices[3] = newChoice "3)"
|
||||||
choices[4] = newChoice("4)")
|
choices[4] = newChoice "4)"
|
||||||
|
|
||||||
lastChoice = newChoice("5)")
|
lastChoice = newChoice "5)"
|
||||||
lastChoice.UserPrompt.Text = "Goodbye!"
|
lastChoice.UserPrompt.Text = "Goodbye!"
|
||||||
lastChoice.Size = UDim2.new(1, 0, 0, 28)
|
lastChoice.Size = UDim2.new(1, 0, 0, 28)
|
||||||
|
|
||||||
mainFrame = Instance.new("Frame")
|
mainFrame = Instance.new "Frame"
|
||||||
mainFrame.Name = "UserDialogArea"
|
mainFrame.Name = "UserDialogArea"
|
||||||
mainFrame.Size = UDim2.new(0, 350, 0, 200)
|
mainFrame.Size = UDim2.new(0, 350, 0, 200)
|
||||||
mainFrame.Style = Enum.FrameStyle.ChatBlue
|
mainFrame.Style = Enum.FrameStyle.ChatBlue
|
||||||
mainFrame.Visible = false
|
mainFrame.Visible = false
|
||||||
|
|
||||||
imageLabel = Instance.new("ImageLabel")
|
imageLabel = Instance.new "ImageLabel"
|
||||||
imageLabel.Name = "Tail"
|
imageLabel.Name = "Tail"
|
||||||
imageLabel.Size = UDim2.new(0, 62, 0, 53)
|
imageLabel.Size = UDim2.new(0, 62, 0, 53)
|
||||||
imageLabel.Position = UDim2.new(1, 8, 0.25)
|
imageLabel.Position = UDim2.new(1, 8, 0.25)
|
||||||
|
|
@ -346,11 +356,13 @@ function presentDialogChoices(talkingPart, dialogChoices)
|
||||||
currentConversationPartner = talkingPart
|
currentConversationPartner = talkingPart
|
||||||
sortedDialogChoices = {}
|
sortedDialogChoices = {}
|
||||||
for n, obj in pairs(dialogChoices) do
|
for n, obj in pairs(dialogChoices) do
|
||||||
if obj:IsA("DialogChoice") then
|
if obj:IsA "DialogChoice" then
|
||||||
table.insert(sortedDialogChoices, obj)
|
table.insert(sortedDialogChoices, obj)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.sort(sortedDialogChoices, function(a,b) return a.Name < b.Name end)
|
table.sort(sortedDialogChoices, function(a, b)
|
||||||
|
return a.Name < b.Name
|
||||||
|
end)
|
||||||
|
|
||||||
if #sortedDialogChoices == 0 then
|
if #sortedDialogChoices == 0 then
|
||||||
normalEndDialog()
|
normalEndDialog()
|
||||||
|
|
@ -386,7 +398,7 @@ function presentDialogChoices(talkingPart, dialogChoices)
|
||||||
lastChoice.Number.Text = pos .. ")"
|
lastChoice.Number.Text = pos .. ")"
|
||||||
|
|
||||||
mainFrame.Size = UDim2.new(0, 350, 0, yPosition + 24 + 32)
|
mainFrame.Size = UDim2.new(0, 350, 0, yPosition + 24 + 32)
|
||||||
mainFrame.Position = UDim2.new(0,20,0.0, -mainFrame.Size.Y.Offset-20)
|
mainFrame.Position = UDim2.new(0, 20, 0, -mainFrame.Size.Y.Offset - 20)
|
||||||
styleMainFrame(currentTone())
|
styleMainFrame(currentTone())
|
||||||
mainFrame.Visible = true
|
mainFrame.Visible = true
|
||||||
end
|
end
|
||||||
|
|
@ -425,7 +437,13 @@ end
|
||||||
|
|
||||||
function checkForLeaveArea()
|
function checkForLeaveArea()
|
||||||
while currentConversationDialog do
|
while currentConversationDialog do
|
||||||
if currentConversationDialog.Parent and (player:DistanceFromCharacter(currentConversationDialog.Parent.Position) >= currentConversationDialog.ConversationDistance) then
|
if
|
||||||
|
currentConversationDialog.Parent
|
||||||
|
and (
|
||||||
|
player:DistanceFromCharacter(currentConversationDialog.Parent.Position)
|
||||||
|
>= currentConversationDialog.ConversationDistance
|
||||||
|
)
|
||||||
|
then
|
||||||
wanderDialog()
|
wanderDialog()
|
||||||
end
|
end
|
||||||
wait(1)
|
wait(1)
|
||||||
|
|
@ -433,7 +451,7 @@ function checkForLeaveArea()
|
||||||
end
|
end
|
||||||
|
|
||||||
function startDialog(dialog)
|
function startDialog(dialog)
|
||||||
if dialog.Parent and dialog.Parent:IsA("BasePart") then
|
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)
|
showMessage(tooFarAwayMessage, tooFarAwaySize)
|
||||||
return
|
return
|
||||||
|
|
@ -465,13 +483,15 @@ end
|
||||||
|
|
||||||
function addDialog(dialog)
|
function addDialog(dialog)
|
||||||
if dialog.Parent then
|
if dialog.Parent then
|
||||||
if dialog.Parent:IsA("BasePart") then
|
if dialog.Parent:IsA "BasePart" then
|
||||||
local chatGui = chatNotificationGui:clone()
|
local chatGui = chatNotificationGui:clone()
|
||||||
chatGui.Enabled = not dialog.InUse
|
chatGui.Enabled = not dialog.InUse
|
||||||
chatGui.Adornee = dialog.Parent
|
chatGui.Adornee = dialog.Parent
|
||||||
chatGui.RobloxLocked = true
|
chatGui.RobloxLocked = true
|
||||||
chatGui.Parent = game.CoreGui
|
chatGui.Parent = game.CoreGui
|
||||||
chatGui.Image.Button.MouseButton1Click:connect(function() startDialog(dialog) end)
|
chatGui.Image.Button.MouseButton1Click:connect(function()
|
||||||
|
startDialog(dialog)
|
||||||
|
end)
|
||||||
setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone)
|
setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone)
|
||||||
|
|
||||||
dialogMap[dialog] = chatGui
|
dialogMap[dialog] = chatGui
|
||||||
|
|
@ -538,7 +558,7 @@ function onLoad()
|
||||||
waitForChild(gui, "BottomLeftControl")
|
waitForChild(gui, "BottomLeftControl")
|
||||||
|
|
||||||
--print("Initializing Frame")
|
--print("Initializing Frame")
|
||||||
local frame = Instance.new("Frame")
|
local frame = Instance.new "Frame"
|
||||||
frame.Name = "DialogFrame"
|
frame.Name = "DialogFrame"
|
||||||
frame.Position = UDim2.new(0, 0, 0, 0)
|
frame.Position = UDim2.new(0, 0, 0, 0)
|
||||||
frame.Size = UDim2.new(0, 0, 0, 0)
|
frame.Size = UDim2.new(0, 0, 0, 0)
|
||||||
|
|
@ -548,10 +568,18 @@ function onLoad()
|
||||||
initialize(frame)
|
initialize(frame)
|
||||||
|
|
||||||
--print("Adding Dialogs")
|
--print("Adding Dialogs")
|
||||||
game.CollectionService.ItemAdded:connect(function(obj) if obj:IsA("Dialog") then addDialog(obj) end end)
|
game.CollectionService.ItemAdded:connect(function(obj)
|
||||||
game.CollectionService.ItemRemoved:connect(function(obj) if obj:IsA("Dialog") then removeDialog(obj) end end)
|
if obj:IsA "Dialog" then
|
||||||
for i, obj in pairs(game.CollectionService:GetCollection("Dialog")) do
|
addDialog(obj)
|
||||||
if obj:IsA("Dialog") then
|
end
|
||||||
|
end)
|
||||||
|
game.CollectionService.ItemRemoved:connect(function(obj)
|
||||||
|
if obj:IsA "Dialog" then
|
||||||
|
removeDialog(obj)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
for _, obj in pairs(game.CollectionService:GetCollection "Dialog") do
|
||||||
|
if obj:IsA "Dialog" then
|
||||||
addDialog(obj)
|
addDialog(obj)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
1189
45284430.lua
1189
45284430.lua
File diff suppressed because it is too large
Load Diff
13
45374389.lua
13
45374389.lua
|
|
@ -1,17 +1,14 @@
|
||||||
local t = {}
|
local t = {}
|
||||||
|
|
||||||
t.Foo =
|
t.Foo = function()
|
||||||
function()
|
print "foo"
|
||||||
print("foo")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
t.Bar =
|
t.Bar = function()
|
||||||
function()
|
print "bar"
|
||||||
print("bar")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
t.Help =
|
t.Help = function(funcNameOrFunc)
|
||||||
function(funcNameOrFunc)
|
|
||||||
--input argument can be a string or a function. Should return a description (of arguments and expected side effects)
|
--input argument can be a string or a function. Should return a description (of arguments and expected side effects)
|
||||||
if funcNameOrFunc == "Foo" or funcNameOrFunc == t.Foo then
|
if funcNameOrFunc == "Foo" or funcNameOrFunc == t.Foo then
|
||||||
return "Function Foo. Arguments: None. Side effect: prints foo"
|
return "Function Foo. Arguments: None. Side effect: prints foo"
|
||||||
|
|
|
||||||
776
46295863.lua
776
46295863.lua
File diff suppressed because it is too large
Load Diff
1793
48488235.lua
1793
48488235.lua
File diff suppressed because it is too large
Load Diff
231
48488398.lua
231
48488398.lua
|
|
@ -17,25 +17,32 @@ script.Parent.Popup.AcceptButton.Modal = true
|
||||||
local localPlayer = game.Players.LocalPlayer
|
local localPlayer = game.Players.LocalPlayer
|
||||||
local teleportUI = nil
|
local teleportUI = nil
|
||||||
|
|
||||||
local acceptedTeleport = Instance.new("IntValue")
|
|
||||||
|
|
||||||
local friendRequestBlacklist = {}
|
local friendRequestBlacklist = {}
|
||||||
|
|
||||||
local teleportEnabled = true
|
local teleportEnabled = true
|
||||||
|
|
||||||
local makePopupInvisible = function()
|
local makePopupInvisible = function()
|
||||||
if script.Parent.Popup then script.Parent.Popup.Visible = false end
|
if script.Parent.Popup then
|
||||||
|
script.Parent.Popup.Visible = false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function makeFriend(fromPlayer, toPlayer)
|
function makeFriend(fromPlayer, toPlayer)
|
||||||
|
local popup = script.Parent:FindFirstChild "Popup"
|
||||||
local popup = script.Parent:FindFirstChild("Popup")
|
if popup == nil then
|
||||||
if popup == nil then return end -- there is no popup!
|
return
|
||||||
if popup.Visible then return end -- currently popping something, abort!
|
end -- there is no popup!
|
||||||
if friendRequestBlacklist[fromPlayer] then return end -- previously cancelled friend request, we don't want it!
|
if popup.Visible then
|
||||||
|
return
|
||||||
|
end -- currently popping something, abort!
|
||||||
|
if friendRequestBlacklist[fromPlayer] then
|
||||||
|
return
|
||||||
|
end -- previously cancelled friend request, we don't want it!
|
||||||
|
|
||||||
popup.PopupText.Text = "Accept Friend Request from " .. tostring(fromPlayer.Name) .. "?"
|
popup.PopupText.Text = "Accept Friend Request from " .. tostring(fromPlayer.Name) .. "?"
|
||||||
popup.PopupImage.Image = "http://www.roblox.com/thumbs/avatar.ashx?userId="..tostring(fromPlayer.userId).."&x=352&y=352"
|
popup.PopupImage.Image = "http://www.roblox.com/thumbs/avatar.ashx?userId="
|
||||||
|
.. tostring(fromPlayer.userId)
|
||||||
|
.. "&x=352&y=352"
|
||||||
|
|
||||||
showTwoButtons()
|
showTwoButtons()
|
||||||
popup.Visible = true
|
popup.Visible = true
|
||||||
|
|
@ -48,62 +55,88 @@ function makeFriend(fromPlayer,toPlayer)
|
||||||
yesCon = popup.AcceptButton.MouseButton1Click:connect(function()
|
yesCon = popup.AcceptButton.MouseButton1Click:connect(function()
|
||||||
popup.Visible = false
|
popup.Visible = false
|
||||||
toPlayer:RequestFriendship(fromPlayer)
|
toPlayer:RequestFriendship(fromPlayer)
|
||||||
if yesCon then yesCon:disconnect() end
|
if yesCon then
|
||||||
if noCon then noCon:disconnect() end
|
yesCon:disconnect()
|
||||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
end
|
||||||
|
if noCon then
|
||||||
|
noCon:disconnect()
|
||||||
|
end
|
||||||
|
popup:TweenSize(
|
||||||
|
UDim2.new(0, 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quart,
|
||||||
|
1,
|
||||||
|
true,
|
||||||
|
makePopupInvisible()
|
||||||
|
)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
noCon = popup.DeclineButton.MouseButton1Click:connect(function()
|
noCon = popup.DeclineButton.MouseButton1Click:connect(function()
|
||||||
popup.Visible = false
|
popup.Visible = false
|
||||||
toPlayer:RevokeFriendship(fromPlayer)
|
toPlayer:RevokeFriendship(fromPlayer)
|
||||||
friendRequestBlacklist[fromPlayer] = true
|
friendRequestBlacklist[fromPlayer] = true
|
||||||
print("pop up blacklist")
|
print "pop up blacklist"
|
||||||
if yesCon then yesCon:disconnect() end
|
if yesCon then
|
||||||
if noCon then noCon:disconnect() end
|
yesCon:disconnect()
|
||||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
end
|
||||||
|
if noCon then
|
||||||
|
noCon:disconnect()
|
||||||
|
end
|
||||||
|
popup:TweenSize(
|
||||||
|
UDim2.new(0, 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quart,
|
||||||
|
1,
|
||||||
|
true,
|
||||||
|
makePopupInvisible()
|
||||||
|
)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
game.Players.FriendRequestEvent:connect(function(fromPlayer, toPlayer, event)
|
game.Players.FriendRequestEvent:connect(function(fromPlayer, toPlayer, event)
|
||||||
|
|
||||||
-- if this doesn't involve me, then do nothing
|
-- if this doesn't involve me, then do nothing
|
||||||
if fromPlayer ~= localPlayer and toPlayer ~= localPlayer then return end
|
if fromPlayer ~= localPlayer and toPlayer ~= localPlayer then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if fromPlayer == localPlayer then
|
if fromPlayer == localPlayer then
|
||||||
if event == Enum.FriendRequestEvent.Accept then
|
if event == Enum.FriendRequestEvent.Accept then
|
||||||
game:GetService("GuiService"):SendNotification("You are Friends",
|
game:GetService("GuiService"):SendNotification(
|
||||||
|
"You are Friends",
|
||||||
"With " .. toPlayer.Name .. "!",
|
"With " .. toPlayer.Name .. "!",
|
||||||
"http://www.roblox.com/thumbs/avatar.ashx?userId=" .. tostring(toPlayer.userId) .. "&x=48&y=48",
|
"http://www.roblox.com/thumbs/avatar.ashx?userId=" .. tostring(toPlayer.userId) .. "&x=48&y=48",
|
||||||
5,
|
5,
|
||||||
function()
|
function() end
|
||||||
|
)
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
elseif toPlayer == localPlayer then
|
elseif toPlayer == localPlayer then
|
||||||
if event == Enum.FriendRequestEvent.Issue then
|
if event == Enum.FriendRequestEvent.Issue then
|
||||||
if friendRequestBlacklist[fromPlayer] then return end -- previously cancelled friend request, we don't want it!
|
if friendRequestBlacklist[fromPlayer] then
|
||||||
game:GetService("GuiService"):SendNotification("Friend Request",
|
return
|
||||||
|
end -- previously cancelled friend request, we don't want it!
|
||||||
|
game:GetService("GuiService"):SendNotification(
|
||||||
|
"Friend Request",
|
||||||
"From " .. fromPlayer.Name,
|
"From " .. fromPlayer.Name,
|
||||||
"http://www.roblox.com/thumbs/avatar.ashx?userId=" .. tostring(fromPlayer.userId) .. "&x=48&y=48",
|
"http://www.roblox.com/thumbs/avatar.ashx?userId=" .. tostring(fromPlayer.userId) .. "&x=48&y=48",
|
||||||
8,
|
8,
|
||||||
function()
|
function()
|
||||||
makeFriend(fromPlayer, toPlayer)
|
makeFriend(fromPlayer, toPlayer)
|
||||||
end)
|
end
|
||||||
|
)
|
||||||
elseif event == Enum.FriendRequestEvent.Accept then
|
elseif event == Enum.FriendRequestEvent.Accept then
|
||||||
game:GetService("GuiService"):SendNotification("You are Friends",
|
game:GetService("GuiService"):SendNotification(
|
||||||
|
"You are Friends",
|
||||||
"With " .. fromPlayer.Name .. "!",
|
"With " .. fromPlayer.Name .. "!",
|
||||||
"http://www.roblox.com/thumbs/avatar.ashx?userId=" .. tostring(fromPlayer.userId) .. "&x=48&y=48",
|
"http://www.roblox.com/thumbs/avatar.ashx?userId=" .. tostring(fromPlayer.userId) .. "&x=48&y=48",
|
||||||
5,
|
5,
|
||||||
function()
|
function() end
|
||||||
|
)
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function showOneButton()
|
function showOneButton()
|
||||||
local popup = script.Parent:FindFirstChild("Popup")
|
local popup = script.Parent:FindFirstChild "Popup"
|
||||||
if popup then
|
if popup then
|
||||||
popup.OKButton.Visible = true
|
popup.OKButton.Visible = true
|
||||||
popup.DeclineButton.Visible = false
|
popup.DeclineButton.Visible = false
|
||||||
|
|
@ -112,7 +145,7 @@ function showOneButton()
|
||||||
end
|
end
|
||||||
|
|
||||||
function showTwoButtons()
|
function showTwoButtons()
|
||||||
local popup = script.Parent:FindFirstChild("Popup")
|
local popup = script.Parent:FindFirstChild "Popup"
|
||||||
if popup then
|
if popup then
|
||||||
popup.OKButton.Visible = false
|
popup.OKButton.Visible = false
|
||||||
popup.DeclineButton.Visible = true
|
popup.DeclineButton.Visible = true
|
||||||
|
|
@ -120,7 +153,7 @@ function showTwoButtons()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function onTeleport(teleportState, placeId, spawnName)
|
function onTeleport(teleportState, _, _)
|
||||||
if game:GetService("TeleportService").CustomizedTeleportUI == false then
|
if game:GetService("TeleportService").CustomizedTeleportUI == false then
|
||||||
if teleportState == Enum.TeleportState.Started then
|
if teleportState == Enum.TeleportState.Started then
|
||||||
showTeleportUI("Teleport started...", 0)
|
showTeleportUI("Teleport started...", 0)
|
||||||
|
|
@ -139,8 +172,9 @@ function showTeleportUI(message, timer)
|
||||||
teleportUI:Remove()
|
teleportUI:Remove()
|
||||||
end
|
end
|
||||||
waitForChild(localPlayer, "PlayerGui")
|
waitForChild(localPlayer, "PlayerGui")
|
||||||
teleportUI = Instance.new("Message", localPlayer.PlayerGui)
|
teleportUI = Instance.new "Message"
|
||||||
teleportUI.Text = message
|
teleportUI.Text = message
|
||||||
|
teleportUI.Parent = localPlayer.PlayerGui
|
||||||
if timer > 0 then
|
if timer > 0 then
|
||||||
wait(timer)
|
wait(timer)
|
||||||
teleportUI:Remove()
|
teleportUI:Remove()
|
||||||
|
|
@ -148,21 +182,31 @@ function showTeleportUI(message, timer)
|
||||||
end
|
end
|
||||||
|
|
||||||
if teleportEnabled then
|
if teleportEnabled then
|
||||||
|
|
||||||
localPlayer.OnTeleport:connect(onTeleport)
|
localPlayer.OnTeleport:connect(onTeleport)
|
||||||
|
|
||||||
game:GetService("TeleportService").ErrorCallback = function(message)
|
game:GetService("TeleportService").ErrorCallback = function(message)
|
||||||
local popup = script.Parent:FindFirstChild("Popup")
|
local popup = script.Parent:FindFirstChild "Popup"
|
||||||
showOneButton()
|
showOneButton()
|
||||||
popup.PopupText.Text = message
|
popup.PopupText.Text = message
|
||||||
local clickCon
|
local clickCon
|
||||||
clickCon = popup.OKButton.MouseButton1Click:connect(function()
|
clickCon = popup.OKButton.MouseButton1Click:connect(function()
|
||||||
game:GetService("TeleportService"):TeleportCancel()
|
game:GetService("TeleportService"):TeleportCancel()
|
||||||
if clickCon then clickCon:disconnect() end
|
if clickCon then
|
||||||
game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild("Popup"))
|
clickCon:disconnect()
|
||||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
end
|
||||||
|
game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild "Popup")
|
||||||
|
popup:TweenSize(
|
||||||
|
UDim2.new(0, 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quart,
|
||||||
|
1,
|
||||||
|
true,
|
||||||
|
makePopupInvisible()
|
||||||
|
)
|
||||||
end)
|
end)
|
||||||
game.GuiService:AddCenterDialog(script.Parent:FindFirstChild("Popup"), Enum.CenterDialogType.QuitDialog,
|
game.GuiService:AddCenterDialog(
|
||||||
|
script.Parent:FindFirstChild "Popup",
|
||||||
|
Enum.CenterDialogType.QuitDialog,
|
||||||
--ShowFunction
|
--ShowFunction
|
||||||
function()
|
function()
|
||||||
showOneButton()
|
showOneButton()
|
||||||
|
|
@ -171,68 +215,132 @@ if teleportEnabled then
|
||||||
end,
|
end,
|
||||||
--HideFunction
|
--HideFunction
|
||||||
function()
|
function()
|
||||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
popup:TweenSize(
|
||||||
end)
|
UDim2.new(0, 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quart,
|
||||||
|
1,
|
||||||
|
true,
|
||||||
|
makePopupInvisible()
|
||||||
|
)
|
||||||
|
end
|
||||||
|
)
|
||||||
end
|
end
|
||||||
game:GetService("TeleportService").ConfirmationCallback = function(message, placeId, spawnName)
|
game:GetService("TeleportService").ConfirmationCallback = function(message, placeId, spawnName)
|
||||||
local popup = script.Parent:FindFirstChild("Popup")
|
local popup = script.Parent:FindFirstChild "Popup"
|
||||||
popup.PopupText.Text = message
|
popup.PopupText.Text = message
|
||||||
popup.PopupImage.Image = ""
|
popup.PopupImage.Image = ""
|
||||||
|
|
||||||
local yesCon, noCon
|
local yesCon, noCon
|
||||||
|
|
||||||
local function killCons()
|
local function killCons()
|
||||||
if yesCon then yesCon:disconnect() end
|
if yesCon then
|
||||||
if noCon then noCon:disconnect() end
|
yesCon:disconnect()
|
||||||
game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild("Popup"))
|
end
|
||||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
if noCon then
|
||||||
|
noCon:disconnect()
|
||||||
|
end
|
||||||
|
game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild "Popup")
|
||||||
|
popup:TweenSize(
|
||||||
|
UDim2.new(0, 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quart,
|
||||||
|
1,
|
||||||
|
true,
|
||||||
|
makePopupInvisible()
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
yesCon = popup.AcceptButton.MouseButton1Click:connect(function()
|
yesCon = popup.AcceptButton.MouseButton1Click:connect(function()
|
||||||
killCons()
|
killCons()
|
||||||
local success, err = pcall(function() game:GetService("TeleportService"):TeleportImpl(placeId,spawnName) end)
|
local success, err = pcall(function()
|
||||||
|
game:GetService("TeleportService"):TeleportImpl(placeId, spawnName)
|
||||||
|
end)
|
||||||
if not success then
|
if not success then
|
||||||
showOneButton()
|
showOneButton()
|
||||||
popup.PopupText.Text = err
|
popup.PopupText.Text = err
|
||||||
local clickCon
|
local clickCon
|
||||||
clickCon = popup.OKButton.MouseButton1Click:connect(function()
|
clickCon = popup.OKButton.MouseButton1Click:connect(function()
|
||||||
if clickCon then clickCon:disconnect() end
|
if clickCon then
|
||||||
game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild("Popup"))
|
clickCon:disconnect()
|
||||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
end
|
||||||
|
game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild "Popup")
|
||||||
|
popup:TweenSize(
|
||||||
|
UDim2.new(0, 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quart,
|
||||||
|
1,
|
||||||
|
true,
|
||||||
|
makePopupInvisible()
|
||||||
|
)
|
||||||
end)
|
end)
|
||||||
game.GuiService:AddCenterDialog(script.Parent:FindFirstChild("Popup"), Enum.CenterDialogType.QuitDialog,
|
game.GuiService:AddCenterDialog(
|
||||||
|
script.Parent:FindFirstChild "Popup",
|
||||||
|
Enum.CenterDialogType.QuitDialog,
|
||||||
--ShowFunction
|
--ShowFunction
|
||||||
function()
|
function()
|
||||||
showOneButton()
|
showOneButton()
|
||||||
script.Parent:FindFirstChild("Popup").Visible = true
|
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,
|
end,
|
||||||
--HideFunction
|
--HideFunction
|
||||||
function()
|
function()
|
||||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
popup:TweenSize(
|
||||||
end)
|
UDim2.new(0, 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quart,
|
||||||
|
1,
|
||||||
|
true,
|
||||||
|
makePopupInvisible()
|
||||||
|
)
|
||||||
|
end
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
noCon = popup.DeclineButton.MouseButton1Click:connect(function()
|
noCon = popup.DeclineButton.MouseButton1Click:connect(function()
|
||||||
killCons()
|
killCons()
|
||||||
local success = pcall(function() game:GetService("TeleportService"):TeleportCancel() end)
|
pcall(function()
|
||||||
|
game:GetService("TeleportService"):TeleportCancel()
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local centerDialogSuccess = pcall(function() game.GuiService:AddCenterDialog(script.Parent:FindFirstChild("Popup"), Enum.CenterDialogType.QuitDialog,
|
local centerDialogSuccess = pcall(function()
|
||||||
|
game.GuiService:AddCenterDialog(
|
||||||
|
script.Parent:FindFirstChild "Popup",
|
||||||
|
Enum.CenterDialogType.QuitDialog,
|
||||||
--ShowFunction
|
--ShowFunction
|
||||||
function()
|
function()
|
||||||
showTwoButtons()
|
showTwoButtons()
|
||||||
popup.AcceptButton.Text = "Leave"
|
popup.AcceptButton.Text = "Leave"
|
||||||
popup.DeclineButton.Text = "Stay"
|
popup.DeclineButton.Text = "Stay"
|
||||||
script.Parent:FindFirstChild("Popup").Visible = true
|
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,
|
end,
|
||||||
--HideFunction
|
--HideFunction
|
||||||
function()
|
function()
|
||||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
popup:TweenSize(
|
||||||
end)
|
UDim2.new(0, 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quart,
|
||||||
|
1,
|
||||||
|
true,
|
||||||
|
makePopupInvisible()
|
||||||
|
)
|
||||||
|
end
|
||||||
|
)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if centerDialogSuccess == false then
|
if centerDialogSuccess == false then
|
||||||
|
|
@ -242,6 +350,5 @@ if teleportEnabled then
|
||||||
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
|
end
|
||||||
return true
|
return true
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
10
48488451.lua
10
48488451.lua
|
|
@ -1,6 +1,6 @@
|
||||||
--build our gui
|
--build our gui
|
||||||
|
|
||||||
local popupFrame = Instance.new("Frame")
|
local popupFrame = Instance.new "Frame"
|
||||||
popupFrame.Position = UDim2.new(0.5, -165, 0.5, -175)
|
popupFrame.Position = UDim2.new(0.5, -165, 0.5, -175)
|
||||||
popupFrame.Size = UDim2.new(0, 330, 0, 350)
|
popupFrame.Size = UDim2.new(0, 330, 0, 350)
|
||||||
popupFrame.Style = Enum.FrameStyle.RobloxRound
|
popupFrame.Style = Enum.FrameStyle.RobloxRound
|
||||||
|
|
@ -16,7 +16,7 @@ darken.Name = "Darken"
|
||||||
darken.ZIndex = 1
|
darken.ZIndex = 1
|
||||||
darken.Parent = popupFrame
|
darken.Parent = popupFrame
|
||||||
|
|
||||||
local acceptButton = Instance.new("TextButton")
|
local acceptButton = Instance.new "TextButton"
|
||||||
acceptButton.Position = UDim2.new(0, 20, 0, 270)
|
acceptButton.Position = UDim2.new(0, 20, 0, 270)
|
||||||
acceptButton.Size = UDim2.new(0, 100, 0, 50)
|
acceptButton.Size = UDim2.new(0, 100, 0, 50)
|
||||||
acceptButton.Font = Enum.Font.ArialBold
|
acceptButton.Font = Enum.Font.ArialBold
|
||||||
|
|
@ -41,7 +41,7 @@ okButton.Position = UDim2.new(0.5,-50,0,270)
|
||||||
okButton.Visible = false
|
okButton.Visible = false
|
||||||
okButton.Parent = popupFrame
|
okButton.Parent = popupFrame
|
||||||
|
|
||||||
local popupImage = Instance.new("ImageLabel")
|
local popupImage = Instance.new "ImageLabel"
|
||||||
popupImage.BackgroundTransparency = 1
|
popupImage.BackgroundTransparency = 1
|
||||||
popupImage.Position = UDim2.new(0.5, -140, 0, 0)
|
popupImage.Position = UDim2.new(0.5, -140, 0, 0)
|
||||||
popupImage.Size = UDim2.new(0, 280, 0, 280)
|
popupImage.Size = UDim2.new(0, 280, 0, 280)
|
||||||
|
|
@ -49,7 +49,7 @@ popupImage.ZIndex = 3
|
||||||
popupImage.Name = "PopupImage"
|
popupImage.Name = "PopupImage"
|
||||||
popupImage.Parent = popupFrame
|
popupImage.Parent = popupFrame
|
||||||
|
|
||||||
local backing = Instance.new("ImageLabel")
|
local backing = Instance.new "ImageLabel"
|
||||||
backing.BackgroundTransparency = 1
|
backing.BackgroundTransparency = 1
|
||||||
backing.Size = UDim2.new(1, 0, 1, 0)
|
backing.Size = UDim2.new(1, 0, 1, 0)
|
||||||
backing.Image = "http://www.roblox.com/asset/?id=47574181"
|
backing.Image = "http://www.roblox.com/asset/?id=47574181"
|
||||||
|
|
@ -57,7 +57,7 @@ backing.Name = "Backing"
|
||||||
backing.ZIndex = 2
|
backing.ZIndex = 2
|
||||||
backing.Parent = popupImage
|
backing.Parent = popupImage
|
||||||
|
|
||||||
local popupText = Instance.new("TextLabel")
|
local popupText = Instance.new "TextLabel"
|
||||||
popupText.Name = "PopupText"
|
popupText.Name = "PopupText"
|
||||||
popupText.Size = UDim2.new(1, 0, 0.8, 0)
|
popupText.Size = UDim2.new(1, 0, 0.8, 0)
|
||||||
popupText.Font = Enum.Font.ArialBold
|
popupText.Font = Enum.Font.ArialBold
|
||||||
|
|
|
||||||
335
53878047.lua
335
53878047.lua
|
|
@ -1,7 +1,9 @@
|
||||||
-- This script creates almost all gui elements found in the backpack (warning: there are a lot!)
|
-- This script creates almost all gui elements found in the backpack (warning: there are a lot!)
|
||||||
-- TODO: automate this process
|
-- TODO: automate this process
|
||||||
|
|
||||||
if game.CoreGui.Version < 3 then return end -- peace out if we aren't using the right client
|
if game.CoreGui.Version < 3 then
|
||||||
|
return
|
||||||
|
end -- peace out if we aren't using the right client
|
||||||
|
|
||||||
local gui = script.Parent
|
local gui = script.Parent
|
||||||
|
|
||||||
|
|
@ -19,7 +21,9 @@ end
|
||||||
|
|
||||||
local function IsTouchDevice()
|
local function IsTouchDevice()
|
||||||
local touchEnabled = false
|
local touchEnabled = false
|
||||||
pcall(function() touchEnabled = Game:GetService('UserInputService').TouchEnabled end)
|
pcall(function()
|
||||||
|
touchEnabled = Game:GetService("UserInputService").TouchEnabled
|
||||||
|
end)
|
||||||
return touchEnabled
|
return touchEnabled
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -32,10 +36,9 @@ end
|
||||||
|
|
||||||
waitForChild(game, "Players")
|
waitForChild(game, "Players")
|
||||||
waitForProperty(game.Players, "LocalPlayer")
|
waitForProperty(game.Players, "LocalPlayer")
|
||||||
local player = game.Players.LocalPlayer
|
|
||||||
|
|
||||||
-- First up is the current loadout
|
-- First up is the current loadout
|
||||||
local CurrentLoadout = Instance.new("Frame")
|
local CurrentLoadout = Instance.new "Frame"
|
||||||
CurrentLoadout.Name = "CurrentLoadout"
|
CurrentLoadout.Name = "CurrentLoadout"
|
||||||
CurrentLoadout.Position = UDim2.new(0.5, -300, 1, -85)
|
CurrentLoadout.Position = UDim2.new(0.5, -300, 1, -85)
|
||||||
CurrentLoadout.Size = UDim2.new(0, 600, 0, 54)
|
CurrentLoadout.Size = UDim2.new(0, 600, 0, 54)
|
||||||
|
|
@ -43,29 +46,29 @@ CurrentLoadout.BackgroundTransparency = 1
|
||||||
CurrentLoadout.RobloxLocked = true
|
CurrentLoadout.RobloxLocked = true
|
||||||
CurrentLoadout.Parent = gui
|
CurrentLoadout.Parent = gui
|
||||||
|
|
||||||
local CLBackground = Instance.new('ImageLabel')
|
local CLBackground = Instance.new "ImageLabel"
|
||||||
CLBackground.Name = 'Background';
|
CLBackground.Name = "Background"
|
||||||
CLBackground.Size = UDim2.new(1.2, 0, 1.2, 0);
|
CLBackground.Size = UDim2.new(1.2, 0, 1.2, 0)
|
||||||
CLBackground.Image = "http://www.roblox.com/asset/?id=96536002"
|
CLBackground.Image = "http://www.roblox.com/asset/?id=96536002"
|
||||||
CLBackground.BackgroundTransparency = 1.0;
|
CLBackground.BackgroundTransparency = 1
|
||||||
CLBackground.Position = UDim2.new(-0.1, 0, -0.1, 0);
|
CLBackground.Position = UDim2.new(-0.1, 0, -0.1, 0)
|
||||||
CLBackground.ZIndex = 0.0;
|
CLBackground.ZIndex = 0.0
|
||||||
CLBackground.Parent = CurrentLoadout
|
CLBackground.Parent = CurrentLoadout
|
||||||
CLBackground.Visible = false
|
CLBackground.Visible = false
|
||||||
|
|
||||||
local BackgroundUp = Instance.new('ImageLabel')
|
local BackgroundUp = Instance.new "ImageLabel"
|
||||||
BackgroundUp.Size = UDim2.new(1, 0, 0.025, 1)
|
BackgroundUp.Size = UDim2.new(1, 0, 0.025, 1)
|
||||||
BackgroundUp.Position = UDim2.new(0, 0, 0, 0)
|
BackgroundUp.Position = UDim2.new(0, 0, 0, 0)
|
||||||
BackgroundUp.Image = 'http://www.roblox.com/asset/?id=97662207'
|
BackgroundUp.Image = "http://www.roblox.com/asset/?id=97662207"
|
||||||
BackgroundUp.BackgroundTransparency = 1.0
|
BackgroundUp.BackgroundTransparency = 1
|
||||||
BackgroundUp.Parent = CLBackground
|
BackgroundUp.Parent = CLBackground
|
||||||
|
|
||||||
local Debounce = Instance.new("BoolValue")
|
local Debounce = Instance.new "BoolValue"
|
||||||
Debounce.Name = "Debounce"
|
Debounce.Name = "Debounce"
|
||||||
Debounce.RobloxLocked = true
|
Debounce.RobloxLocked = true
|
||||||
Debounce.Parent = CurrentLoadout
|
Debounce.Parent = CurrentLoadout
|
||||||
|
|
||||||
local BackpackButton = Instance.new("ImageButton")
|
local BackpackButton = Instance.new "ImageButton"
|
||||||
BackpackButton.RobloxLocked = true
|
BackpackButton.RobloxLocked = true
|
||||||
BackpackButton.Visible = false
|
BackpackButton.Visible = false
|
||||||
BackpackButton.Name = "BackpackButton"
|
BackpackButton.Name = "BackpackButton"
|
||||||
|
|
@ -85,7 +88,7 @@ if IsPhone() then
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = 0, NumSlots do
|
for i = 0, NumSlots do
|
||||||
local slotFrame = Instance.new("Frame")
|
local slotFrame = Instance.new "Frame"
|
||||||
slotFrame.RobloxLocked = true
|
slotFrame.RobloxLocked = true
|
||||||
slotFrame.BackgroundColor3 = Color3.new(0, 0, 0)
|
slotFrame.BackgroundColor3 = Color3.new(0, 0, 0)
|
||||||
slotFrame.BackgroundTransparency = 1
|
slotFrame.BackgroundTransparency = 1
|
||||||
|
|
@ -98,53 +101,51 @@ for i = 0, NumSlots do
|
||||||
slotFrame.Position = UDim2.new((i - 1) * 0.1, (i - 1) * 6, 0, 0)
|
slotFrame.Position = UDim2.new((i - 1) * 0.1, (i - 1) * 6, 0, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
slotFrame.Size = UDim2.new(0, 54, 1, 0)
|
slotFrame.Size = UDim2.new(0, 54, 1, 0)
|
||||||
slotFrame.Parent = CurrentLoadout
|
slotFrame.Parent = CurrentLoadout
|
||||||
|
|
||||||
if gui.AbsoluteSize.Y <= 320 then
|
if gui.AbsoluteSize.Y <= 320 then
|
||||||
slotFrame.Position = UDim2.new(0, (i - 1) * 60, 0, -50)
|
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
|
end
|
||||||
if gui.AbsoluteSize.Y <= 320 and i == 0 then
|
if gui.AbsoluteSize.Y <= 320 and i == 0 then
|
||||||
slotFrame:Destroy()
|
slotFrame:Destroy()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local TempSlot = Instance.new("ImageButton")
|
local TempSlot = Instance.new "ImageButton"
|
||||||
TempSlot.Name = "TempSlot"
|
TempSlot.Name = "TempSlot"
|
||||||
TempSlot.Active = true
|
TempSlot.Active = true
|
||||||
TempSlot.Size = UDim2.new(1, 0, 1, 0)
|
TempSlot.Size = UDim2.new(1, 0, 1, 0)
|
||||||
TempSlot.BackgroundTransparency = 1.0
|
TempSlot.BackgroundTransparency = 1
|
||||||
TempSlot.Style = 'Custom'
|
TempSlot.Style = "Custom"
|
||||||
TempSlot.Visible = false
|
TempSlot.Visible = false
|
||||||
TempSlot.RobloxLocked = true
|
TempSlot.RobloxLocked = true
|
||||||
TempSlot.Parent = CurrentLoadout
|
TempSlot.Parent = CurrentLoadout
|
||||||
TempSlot.ZIndex = 3.0
|
TempSlot.ZIndex = 3.0
|
||||||
|
|
||||||
local slotBackground = Instance.new('ImageLabel')
|
local slotBackground = Instance.new "ImageLabel"
|
||||||
slotBackground.Name = 'Background'
|
slotBackground.Name = "Background"
|
||||||
slotBackground.BackgroundTransparency = 1.0
|
slotBackground.BackgroundTransparency = 1
|
||||||
slotBackground.Image = 'http://www.roblox.com/asset/?id=97613075'
|
slotBackground.Image = "http://www.roblox.com/asset/?id=97613075"
|
||||||
slotBackground.Size = UDim2.new(1, 0, 1, 0)
|
slotBackground.Size = UDim2.new(1, 0, 1, 0)
|
||||||
slotBackground.Parent = TempSlot
|
slotBackground.Parent = TempSlot
|
||||||
|
|
||||||
local HighLight = Instance.new('ImageLabel')
|
local HighLight = Instance.new "ImageLabel"
|
||||||
HighLight.Name = 'Highlight'
|
HighLight.Name = "Highlight"
|
||||||
HighLight.BackgroundTransparency = 1.0
|
HighLight.BackgroundTransparency = 1
|
||||||
HighLight.Image = 'http://www.roblox.com/asset/?id=97643886'
|
HighLight.Image = "http://www.roblox.com/asset/?id=97643886"
|
||||||
HighLight.Size = UDim2.new(1, 0, 1, 0)
|
HighLight.Size = UDim2.new(1, 0, 1, 0)
|
||||||
--HighLight.Parent = TempSlot
|
--HighLight.Parent = TempSlot
|
||||||
HighLight.Visible = false
|
HighLight.Visible = false
|
||||||
|
|
||||||
-- TempSlot Children
|
-- TempSlot Children
|
||||||
local GearReference = Instance.new("ObjectValue")
|
local GearReference = Instance.new "ObjectValue"
|
||||||
GearReference.Name = "GearReference"
|
GearReference.Name = "GearReference"
|
||||||
GearReference.RobloxLocked = true
|
GearReference.RobloxLocked = true
|
||||||
GearReference.Parent = TempSlot
|
GearReference.Parent = TempSlot
|
||||||
|
|
||||||
|
local ToolTipLabel = Instance.new "TextLabel"
|
||||||
local ToolTipLabel = Instance.new("TextLabel")
|
|
||||||
ToolTipLabel.Name = "ToolTipLabel"
|
ToolTipLabel.Name = "ToolTipLabel"
|
||||||
ToolTipLabel.RobloxLocked = true
|
ToolTipLabel.RobloxLocked = true
|
||||||
ToolTipLabel.Text = ""
|
ToolTipLabel.Text = ""
|
||||||
|
|
@ -161,13 +162,12 @@ TempSlot.ZIndex = 3.0
|
||||||
ToolTipLabel.Position = UDim2.new(0, -30, 0, -30)
|
ToolTipLabel.Position = UDim2.new(0, -30, 0, -30)
|
||||||
ToolTipLabel.Parent = TempSlot
|
ToolTipLabel.Parent = TempSlot
|
||||||
|
|
||||||
|
local Kill = Instance.new "BoolValue"
|
||||||
local Kill = Instance.new("BoolValue")
|
|
||||||
Kill.Name = "Kill"
|
Kill.Name = "Kill"
|
||||||
Kill.RobloxLocked = true
|
Kill.RobloxLocked = true
|
||||||
Kill.Parent = TempSlot
|
Kill.Parent = TempSlot
|
||||||
|
|
||||||
local GearImage = Instance.new("ImageLabel")
|
local GearImage = Instance.new "ImageLabel"
|
||||||
GearImage.Name = "GearImage"
|
GearImage.Name = "GearImage"
|
||||||
GearImage.BackgroundTransparency = 1
|
GearImage.BackgroundTransparency = 1
|
||||||
GearImage.Position = UDim2.new(0, 0, 0, 0)
|
GearImage.Position = UDim2.new(0, 0, 0, 0)
|
||||||
|
|
@ -176,7 +176,7 @@ TempSlot.ZIndex = 3.0
|
||||||
GearImage.RobloxLocked = true
|
GearImage.RobloxLocked = true
|
||||||
GearImage.Parent = TempSlot
|
GearImage.Parent = TempSlot
|
||||||
|
|
||||||
local SlotNumber = Instance.new("TextLabel")
|
local SlotNumber = Instance.new "TextLabel"
|
||||||
SlotNumber.Name = "SlotNumber"
|
SlotNumber.Name = "SlotNumber"
|
||||||
SlotNumber.BackgroundTransparency = 1
|
SlotNumber.BackgroundTransparency = 1
|
||||||
SlotNumber.BorderSizePixel = 0
|
SlotNumber.BorderSizePixel = 0
|
||||||
|
|
@ -208,7 +208,7 @@ TempSlot.ZIndex = 3.0
|
||||||
SlotNumberUpShadow.Position = UDim2.new(0, -1, 0, -1)
|
SlotNumberUpShadow.Position = UDim2.new(0, -1, 0, -1)
|
||||||
SlotNumberUpShadow.Parent = TempSlot
|
SlotNumberUpShadow.Parent = TempSlot
|
||||||
|
|
||||||
local GearText = Instance.new("TextLabel")
|
local GearText = Instance.new "TextLabel"
|
||||||
GearText.RobloxLocked = true
|
GearText.RobloxLocked = true
|
||||||
GearText.Name = "GearText"
|
GearText.Name = "GearText"
|
||||||
GearText.BackgroundTransparency = 1
|
GearText.BackgroundTransparency = 1
|
||||||
|
|
@ -224,7 +224,7 @@ TempSlot.ZIndex = 3.0
|
||||||
|
|
||||||
--- Great, now lets make the inventory!
|
--- Great, now lets make the inventory!
|
||||||
|
|
||||||
local Backpack = Instance.new("Frame")
|
local Backpack = Instance.new "Frame"
|
||||||
Backpack.RobloxLocked = true
|
Backpack.RobloxLocked = true
|
||||||
Backpack.Visible = false
|
Backpack.Visible = false
|
||||||
Backpack.Name = "Backpack"
|
Backpack.Name = "Backpack"
|
||||||
|
|
@ -236,23 +236,23 @@ Backpack.Parent = gui
|
||||||
Backpack.Active = true
|
Backpack.Active = true
|
||||||
|
|
||||||
-- Backpack Children
|
-- Backpack Children
|
||||||
local SwapSlot = Instance.new("BoolValue")
|
local SwapSlot = Instance.new "BoolValue"
|
||||||
SwapSlot.RobloxLocked = true
|
SwapSlot.RobloxLocked = true
|
||||||
SwapSlot.Name = "SwapSlot"
|
SwapSlot.Name = "SwapSlot"
|
||||||
SwapSlot.Parent = Backpack
|
SwapSlot.Parent = Backpack
|
||||||
|
|
||||||
-- SwapSlot Children
|
-- SwapSlot Children
|
||||||
local Slot = Instance.new("IntValue")
|
local Slot = Instance.new "IntValue"
|
||||||
Slot.RobloxLocked = true
|
Slot.RobloxLocked = true
|
||||||
Slot.Name = "Slot"
|
Slot.Name = "Slot"
|
||||||
Slot.Parent = SwapSlot
|
Slot.Parent = SwapSlot
|
||||||
|
|
||||||
local GearButton = Instance.new("ObjectValue")
|
local GearButton = Instance.new "ObjectValue"
|
||||||
GearButton.RobloxLocked = true
|
GearButton.RobloxLocked = true
|
||||||
GearButton.Name = "GearButton"
|
GearButton.Name = "GearButton"
|
||||||
GearButton.Parent = SwapSlot
|
GearButton.Parent = SwapSlot
|
||||||
|
|
||||||
local Tabs = Instance.new("Frame")
|
local Tabs = Instance.new "Frame"
|
||||||
Tabs.Name = "Tabs"
|
Tabs.Name = "Tabs"
|
||||||
Tabs.Visible = false
|
Tabs.Visible = false
|
||||||
Tabs.Active = false
|
Tabs.Active = false
|
||||||
|
|
@ -266,7 +266,7 @@ Backpack.Active = true
|
||||||
|
|
||||||
-- Tabs Children
|
-- Tabs Children
|
||||||
|
|
||||||
local tabLine = Instance.new("Frame")
|
local tabLine = Instance.new "Frame"
|
||||||
tabLine.RobloxLocked = true
|
tabLine.RobloxLocked = true
|
||||||
tabLine.Name = "TabLine"
|
tabLine.Name = "TabLine"
|
||||||
tabLine.BackgroundColor3 = Color3.new(53 / 255, 53 / 255, 53 / 255)
|
tabLine.BackgroundColor3 = Color3.new(53 / 255, 53 / 255, 53 / 255)
|
||||||
|
|
@ -276,7 +276,7 @@ Backpack.Active = true
|
||||||
tabLine.ZIndex = 2
|
tabLine.ZIndex = 2
|
||||||
tabLine.Parent = Tabs
|
tabLine.Parent = Tabs
|
||||||
|
|
||||||
local InventoryButton = Instance.new("TextButton")
|
local InventoryButton = Instance.new "TextButton"
|
||||||
InventoryButton.RobloxLocked = true
|
InventoryButton.RobloxLocked = true
|
||||||
InventoryButton.Name = "InventoryButton"
|
InventoryButton.Name = "InventoryButton"
|
||||||
InventoryButton.Size = UDim2.new(0, 60, 0, 30)
|
InventoryButton.Size = UDim2.new(0, 60, 0, 30)
|
||||||
|
|
@ -294,7 +294,7 @@ Backpack.Active = true
|
||||||
InventoryButton.Parent = Tabs
|
InventoryButton.Parent = Tabs
|
||||||
|
|
||||||
if game.CoreGui.Version >= 8 then
|
if game.CoreGui.Version >= 8 then
|
||||||
local WardrobeButton = Instance.new("TextButton")
|
local WardrobeButton = Instance.new "TextButton"
|
||||||
WardrobeButton.RobloxLocked = true
|
WardrobeButton.RobloxLocked = true
|
||||||
WardrobeButton.Name = "WardrobeButton"
|
WardrobeButton.Name = "WardrobeButton"
|
||||||
WardrobeButton.Size = UDim2.new(0, 90, 0, 30)
|
WardrobeButton.Size = UDim2.new(0, 90, 0, 30)
|
||||||
|
|
@ -311,7 +311,7 @@ Backpack.Active = true
|
||||||
WardrobeButton.Parent = Tabs
|
WardrobeButton.Parent = Tabs
|
||||||
end
|
end
|
||||||
|
|
||||||
local closeButton = Instance.new("TextButton")
|
local closeButton = Instance.new "TextButton"
|
||||||
closeButton.RobloxLocked = true
|
closeButton.RobloxLocked = true
|
||||||
closeButton.Name = "CloseButton"
|
closeButton.Name = "CloseButton"
|
||||||
closeButton.Font = Enum.Font.ArialBold
|
closeButton.Font = Enum.Font.ArialBold
|
||||||
|
|
@ -325,19 +325,19 @@ Backpack.Active = true
|
||||||
closeButton.Modal = true
|
closeButton.Modal = true
|
||||||
|
|
||||||
--closeButton child
|
--closeButton child
|
||||||
local XImage = Instance.new("ImageLabel")
|
local XImage = Instance.new "ImageLabel"
|
||||||
XImage.RobloxLocked = true
|
XImage.RobloxLocked = true
|
||||||
XImage.Name = "XImage"
|
XImage.Name = "XImage"
|
||||||
game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=75547445")
|
game:GetService("ContentProvider"):Preload "http://www.roblox.com/asset/?id=75547445"
|
||||||
XImage.Image = "http://www.roblox.com/asset/?id=75547445" --TODO: move to rbxasset
|
XImage.Image = "http://www.roblox.com/asset/?id=75547445" --TODO: move to rbxasset
|
||||||
XImage.BackgroundTransparency = 1
|
XImage.BackgroundTransparency = 1
|
||||||
XImage.Position = UDim2.new(-.25,-1,-.25,-1)
|
XImage.Position = UDim2.new(-0.25, -1, -0.25, -1)
|
||||||
XImage.Size = UDim2.new(1.5, 2, 1.5, 2)
|
XImage.Size = UDim2.new(1.5, 2, 1.5, 2)
|
||||||
XImage.ZIndex = 2
|
XImage.ZIndex = 2
|
||||||
XImage.Parent = closeButton
|
XImage.Parent = closeButton
|
||||||
|
|
||||||
-- Generic Search gui used across backpack
|
-- Generic Search gui used across backpack
|
||||||
local SearchFrame = Instance.new("Frame")
|
local SearchFrame = Instance.new "Frame"
|
||||||
SearchFrame.RobloxLocked = true
|
SearchFrame.RobloxLocked = true
|
||||||
SearchFrame.Name = "SearchFrame"
|
SearchFrame.Name = "SearchFrame"
|
||||||
SearchFrame.BackgroundTransparency = 1
|
SearchFrame.BackgroundTransparency = 1
|
||||||
|
|
@ -346,7 +346,7 @@ Backpack.Active = true
|
||||||
SearchFrame.Parent = Backpack
|
SearchFrame.Parent = Backpack
|
||||||
|
|
||||||
-- SearchFrame Children
|
-- SearchFrame Children
|
||||||
local SearchButton = Instance.new("ImageButton")
|
local SearchButton = Instance.new "ImageButton"
|
||||||
SearchButton.RobloxLocked = true
|
SearchButton.RobloxLocked = true
|
||||||
SearchButton.Name = "SearchButton"
|
SearchButton.Name = "SearchButton"
|
||||||
SearchButton.Size = UDim2.new(0, 25, 0, 25)
|
SearchButton.Size = UDim2.new(0, 25, 0, 25)
|
||||||
|
|
@ -354,7 +354,7 @@ Backpack.Active = true
|
||||||
SearchButton.Image = "rbxasset://textures/ui/SearchIcon.png"
|
SearchButton.Image = "rbxasset://textures/ui/SearchIcon.png"
|
||||||
SearchButton.Parent = SearchFrame
|
SearchButton.Parent = SearchFrame
|
||||||
|
|
||||||
local SearchBoxFrame = Instance.new("TextButton")
|
local SearchBoxFrame = Instance.new "TextButton"
|
||||||
SearchBoxFrame.RobloxLocked = true
|
SearchBoxFrame.RobloxLocked = true
|
||||||
SearchBoxFrame.Position = UDim2.new(0, 25, 0, 0)
|
SearchBoxFrame.Position = UDim2.new(0, 25, 0, 0)
|
||||||
SearchBoxFrame.Size = UDim2.new(1, -28, 0, 26)
|
SearchBoxFrame.Size = UDim2.new(1, -28, 0, 26)
|
||||||
|
|
@ -364,7 +364,7 @@ Backpack.Active = true
|
||||||
SearchBoxFrame.Parent = SearchFrame
|
SearchBoxFrame.Parent = SearchFrame
|
||||||
|
|
||||||
-- SearchBoxFrame Children
|
-- SearchBoxFrame Children
|
||||||
local SearchBox = Instance.new("TextBox")
|
local SearchBox = Instance.new "TextBox"
|
||||||
SearchBox.RobloxLocked = true
|
SearchBox.RobloxLocked = true
|
||||||
SearchBox.Name = "SearchBox"
|
SearchBox.Name = "SearchBox"
|
||||||
SearchBox.BackgroundTransparency = 1
|
SearchBox.BackgroundTransparency = 1
|
||||||
|
|
@ -379,8 +379,7 @@ Backpack.Active = true
|
||||||
SearchBox.Text = "Search..."
|
SearchBox.Text = "Search..."
|
||||||
SearchBox.Parent = SearchBoxFrame
|
SearchBox.Parent = SearchBoxFrame
|
||||||
|
|
||||||
|
local ResetButton = Instance.new "TextButton"
|
||||||
local ResetButton = Instance.new("TextButton")
|
|
||||||
ResetButton.RobloxLocked = true
|
ResetButton.RobloxLocked = true
|
||||||
ResetButton.Visible = false
|
ResetButton.Visible = false
|
||||||
ResetButton.Name = "ResetButton"
|
ResetButton.Name = "ResetButton"
|
||||||
|
|
@ -395,7 +394,7 @@ Backpack.Active = true
|
||||||
ResetButton.Parent = SearchFrame
|
ResetButton.Parent = SearchFrame
|
||||||
|
|
||||||
------------------------------- GEAR -------------------------------------------------------
|
------------------------------- GEAR -------------------------------------------------------
|
||||||
local Gear = Instance.new("Frame")
|
local Gear = Instance.new "Frame"
|
||||||
Gear.Name = "Gear"
|
Gear.Name = "Gear"
|
||||||
Gear.RobloxLocked = true
|
Gear.RobloxLocked = true
|
||||||
Gear.BackgroundTransparency = 1
|
Gear.BackgroundTransparency = 1
|
||||||
|
|
@ -404,7 +403,7 @@ Backpack.Active = true
|
||||||
Gear.Parent = Backpack
|
Gear.Parent = Backpack
|
||||||
|
|
||||||
-- Gear Children
|
-- Gear Children
|
||||||
local AssetsList = Instance.new("Frame")
|
local AssetsList = Instance.new "Frame"
|
||||||
AssetsList.RobloxLocked = true
|
AssetsList.RobloxLocked = true
|
||||||
AssetsList.Name = "AssetsList"
|
AssetsList.Name = "AssetsList"
|
||||||
AssetsList.BackgroundTransparency = 1
|
AssetsList.BackgroundTransparency = 1
|
||||||
|
|
@ -413,38 +412,36 @@ Backpack.Active = true
|
||||||
AssetsList.Visible = false
|
AssetsList.Visible = false
|
||||||
AssetsList.Parent = Gear
|
AssetsList.Parent = Gear
|
||||||
|
|
||||||
local GearGrid = Instance.new("Frame")
|
local GearGrid = Instance.new "Frame"
|
||||||
GearGrid.RobloxLocked = true
|
GearGrid.RobloxLocked = true
|
||||||
GearGrid.Name = "GearGrid"
|
GearGrid.Name = "GearGrid"
|
||||||
GearGrid.Size = UDim2.new(0.95, 0, 1, 0)
|
GearGrid.Size = UDim2.new(0.95, 0, 1, 0)
|
||||||
GearGrid.BackgroundTransparency = 1
|
GearGrid.BackgroundTransparency = 1
|
||||||
GearGrid.Parent = Gear
|
GearGrid.Parent = Gear
|
||||||
|
|
||||||
|
local GearButton = Instance.new "ImageButton"
|
||||||
local GearButton = Instance.new("ImageButton")
|
|
||||||
GearButton.RobloxLocked = true
|
GearButton.RobloxLocked = true
|
||||||
GearButton.Visible = false
|
GearButton.Visible = false
|
||||||
GearButton.Name = "GearButton"
|
GearButton.Name = "GearButton"
|
||||||
GearButton.Size = UDim2.new(0, 54, 0, 54)
|
GearButton.Size = UDim2.new(0, 54, 0, 54)
|
||||||
GearButton.Style = 'Custom'
|
GearButton.Style = "Custom"
|
||||||
|
GearButton.BackgroundTransparency = 1
|
||||||
GearButton.Parent = GearGrid
|
GearButton.Parent = GearGrid
|
||||||
GearButton.BackgroundTransparency = 1.0
|
|
||||||
|
|
||||||
local slotBackground = Instance.new('ImageLabel')
|
local slotBackground = Instance.new "ImageLabel"
|
||||||
slotBackground.Name = 'Background'
|
slotBackground.Name = "Background"
|
||||||
slotBackground.BackgroundTransparency = 1.0
|
slotBackground.BackgroundTransparency = 1
|
||||||
slotBackground.Image = 'http://www.roblox.com/asset/?id=97613075'
|
slotBackground.Image = "http://www.roblox.com/asset/?id=97613075"
|
||||||
slotBackground.Size = UDim2.new(1, 0, 1, 0)
|
slotBackground.Size = UDim2.new(1, 0, 1, 0)
|
||||||
slotBackground.Parent = GearButton
|
slotBackground.Parent = GearButton
|
||||||
|
|
||||||
|
|
||||||
-- GearButton Children
|
-- GearButton Children
|
||||||
local GearReference = Instance.new("ObjectValue")
|
local GearReference = Instance.new "ObjectValue"
|
||||||
GearReference.RobloxLocked = true
|
GearReference.RobloxLocked = true
|
||||||
GearReference.Name = "GearReference"
|
GearReference.Name = "GearReference"
|
||||||
GearReference.Parent = GearButton
|
GearReference.Parent = GearButton
|
||||||
|
|
||||||
local GreyOutButton = Instance.new("Frame")
|
local GreyOutButton = Instance.new "Frame"
|
||||||
GreyOutButton.RobloxLocked = true
|
GreyOutButton.RobloxLocked = true
|
||||||
GreyOutButton.Name = "GreyOutButton"
|
GreyOutButton.Name = "GreyOutButton"
|
||||||
GreyOutButton.BackgroundTransparency = 0.5
|
GreyOutButton.BackgroundTransparency = 0.5
|
||||||
|
|
@ -454,7 +451,7 @@ Backpack.Active = true
|
||||||
GreyOutButton.ZIndex = 3
|
GreyOutButton.ZIndex = 3
|
||||||
GreyOutButton.Parent = GearButton
|
GreyOutButton.Parent = GearButton
|
||||||
|
|
||||||
local GearText = Instance.new("TextLabel")
|
local GearText = Instance.new "TextLabel"
|
||||||
GearText.RobloxLocked = true
|
GearText.RobloxLocked = true
|
||||||
GearText.Name = "GearText"
|
GearText.Name = "GearText"
|
||||||
GearText.BackgroundTransparency = 1
|
GearText.BackgroundTransparency = 1
|
||||||
|
|
@ -468,7 +465,7 @@ Backpack.Active = true
|
||||||
GearText.TextWrap = true
|
GearText.TextWrap = true
|
||||||
GearText.Parent = GearButton
|
GearText.Parent = GearButton
|
||||||
|
|
||||||
local GearGridScrollingArea = Instance.new("Frame")
|
local GearGridScrollingArea = Instance.new "Frame"
|
||||||
GearGridScrollingArea.RobloxLocked = true
|
GearGridScrollingArea.RobloxLocked = true
|
||||||
GearGridScrollingArea.Name = "GearGridScrollingArea"
|
GearGridScrollingArea.Name = "GearGridScrollingArea"
|
||||||
GearGridScrollingArea.Position = UDim2.new(1, -19, 0, 35)
|
GearGridScrollingArea.Position = UDim2.new(1, -19, 0, 35)
|
||||||
|
|
@ -476,7 +473,7 @@ Backpack.Active = true
|
||||||
GearGridScrollingArea.BackgroundTransparency = 1
|
GearGridScrollingArea.BackgroundTransparency = 1
|
||||||
GearGridScrollingArea.Parent = Gear
|
GearGridScrollingArea.Parent = Gear
|
||||||
|
|
||||||
local GearLoadouts = Instance.new("Frame")
|
local GearLoadouts = Instance.new "Frame"
|
||||||
GearLoadouts.RobloxLocked = true
|
GearLoadouts.RobloxLocked = true
|
||||||
GearLoadouts.Name = "GearLoadouts"
|
GearLoadouts.Name = "GearLoadouts"
|
||||||
GearLoadouts.BackgroundTransparency = 1
|
GearLoadouts.BackgroundTransparency = 1
|
||||||
|
|
@ -486,7 +483,7 @@ Backpack.Active = true
|
||||||
GearLoadouts.Visible = false
|
GearLoadouts.Visible = false
|
||||||
|
|
||||||
-- GearLoadouts Children
|
-- GearLoadouts Children
|
||||||
local GearLoadoutsHeader = Instance.new("Frame")
|
local GearLoadoutsHeader = Instance.new "Frame"
|
||||||
GearLoadoutsHeader.RobloxLocked = true
|
GearLoadoutsHeader.RobloxLocked = true
|
||||||
GearLoadoutsHeader.Name = "GearLoadoutsHeader"
|
GearLoadoutsHeader.Name = "GearLoadoutsHeader"
|
||||||
GearLoadoutsHeader.BackgroundColor3 = Color3.new(0, 0, 0)
|
GearLoadoutsHeader.BackgroundColor3 = Color3.new(0, 0, 0)
|
||||||
|
|
@ -496,7 +493,7 @@ Backpack.Active = true
|
||||||
GearLoadoutsHeader.Parent = GearLoadouts
|
GearLoadoutsHeader.Parent = GearLoadouts
|
||||||
|
|
||||||
-- GearLoadoutsHeader Children
|
-- GearLoadoutsHeader Children
|
||||||
local LoadoutsHeaderText = Instance.new("TextLabel")
|
local LoadoutsHeaderText = Instance.new "TextLabel"
|
||||||
LoadoutsHeaderText.RobloxLocked = true
|
LoadoutsHeaderText.RobloxLocked = true
|
||||||
LoadoutsHeaderText.Name = "LoadoutsHeaderText"
|
LoadoutsHeaderText.Name = "LoadoutsHeaderText"
|
||||||
LoadoutsHeaderText.BackgroundTransparency = 1
|
LoadoutsHeaderText.BackgroundTransparency = 1
|
||||||
|
|
@ -514,7 +511,7 @@ Backpack.Active = true
|
||||||
GearLoadoutsScrollingArea.Size = UDim2.new(0, 17, 0.85, -2)
|
GearLoadoutsScrollingArea.Size = UDim2.new(0, 17, 0.85, -2)
|
||||||
GearLoadoutsScrollingArea.Parent = GearLoadouts
|
GearLoadoutsScrollingArea.Parent = GearLoadouts
|
||||||
|
|
||||||
local LoadoutsList = Instance.new("Frame")
|
local LoadoutsList = Instance.new "Frame"
|
||||||
LoadoutsList.RobloxLocked = true
|
LoadoutsList.RobloxLocked = true
|
||||||
LoadoutsList.Name = "LoadoutsList"
|
LoadoutsList.Name = "LoadoutsList"
|
||||||
LoadoutsList.Position = UDim2.new(0, 0, 0.15, 2)
|
LoadoutsList.Position = UDim2.new(0, 0, 0.15, 2)
|
||||||
|
|
@ -522,7 +519,7 @@ Backpack.Active = true
|
||||||
LoadoutsList.Style = Enum.FrameStyle.RobloxSquare
|
LoadoutsList.Style = Enum.FrameStyle.RobloxSquare
|
||||||
LoadoutsList.Parent = GearLoadouts
|
LoadoutsList.Parent = GearLoadouts
|
||||||
|
|
||||||
local GearPreview = Instance.new("Frame")
|
local GearPreview = Instance.new "Frame"
|
||||||
GearPreview.RobloxLocked = true
|
GearPreview.RobloxLocked = true
|
||||||
GearPreview.Name = "GearPreview"
|
GearPreview.Name = "GearPreview"
|
||||||
GearPreview.Position = UDim2.new(0.7, 23, 0, 0)
|
GearPreview.Position = UDim2.new(0.7, 23, 0, 0)
|
||||||
|
|
@ -532,7 +529,7 @@ Backpack.Active = true
|
||||||
GearPreview.Parent = Gear
|
GearPreview.Parent = Gear
|
||||||
|
|
||||||
-- GearPreview Children
|
-- GearPreview Children
|
||||||
local GearStats = Instance.new("Frame")
|
local GearStats = Instance.new "Frame"
|
||||||
GearStats.RobloxLocked = true
|
GearStats.RobloxLocked = true
|
||||||
GearStats.Name = "GearStats"
|
GearStats.Name = "GearStats"
|
||||||
GearStats.BackgroundTransparency = 1
|
GearStats.BackgroundTransparency = 1
|
||||||
|
|
@ -542,7 +539,7 @@ Backpack.Active = true
|
||||||
GearStats.Parent = GearPreview
|
GearStats.Parent = GearPreview
|
||||||
|
|
||||||
-- GearStats Children
|
-- GearStats Children
|
||||||
local GearName = Instance.new("TextLabel")
|
local GearName = Instance.new "TextLabel"
|
||||||
GearName.RobloxLocked = true
|
GearName.RobloxLocked = true
|
||||||
GearName.Name = "GearName"
|
GearName.Name = "GearName"
|
||||||
GearName.BackgroundTransparency = 1
|
GearName.BackgroundTransparency = 1
|
||||||
|
|
@ -556,7 +553,7 @@ Backpack.Active = true
|
||||||
GearName.ZIndex = 9
|
GearName.ZIndex = 9
|
||||||
GearName.Parent = GearStats
|
GearName.Parent = GearStats
|
||||||
|
|
||||||
local GearImage = Instance.new("ImageLabel")
|
local GearImage = Instance.new "ImageLabel"
|
||||||
GearImage.RobloxLocked = true
|
GearImage.RobloxLocked = true
|
||||||
GearImage.Name = "GearImage"
|
GearImage.Name = "GearImage"
|
||||||
GearImage.Image = ""
|
GearImage.Image = ""
|
||||||
|
|
@ -567,7 +564,7 @@ Backpack.Active = true
|
||||||
GearImage.Parent = GearPreview
|
GearImage.Parent = GearPreview
|
||||||
|
|
||||||
--GearImage Children
|
--GearImage Children
|
||||||
local GearIcons = Instance.new("Frame")
|
local GearIcons = Instance.new "Frame"
|
||||||
GearIcons.BackgroundColor3 = Color3.new(0, 0, 0)
|
GearIcons.BackgroundColor3 = Color3.new(0, 0, 0)
|
||||||
GearIcons.BackgroundTransparency = 0.5
|
GearIcons.BackgroundTransparency = 0.5
|
||||||
GearIcons.BorderSizePixel = 0
|
GearIcons.BorderSizePixel = 0
|
||||||
|
|
@ -580,7 +577,7 @@ Backpack.Active = true
|
||||||
GearIcons.Parent = GearImage
|
GearIcons.Parent = GearImage
|
||||||
|
|
||||||
-- GearIcons Children
|
-- GearIcons Children
|
||||||
local GenreImage = Instance.new("ImageLabel")
|
local GenreImage = Instance.new "ImageLabel"
|
||||||
GenreImage.RobloxLocked = true
|
GenreImage.RobloxLocked = true
|
||||||
GenreImage.Name = "GenreImage"
|
GenreImage.Name = "GenreImage"
|
||||||
GenreImage.BackgroundColor3 = Color3.new(102 / 255, 153 / 255, 1)
|
GenreImage.BackgroundColor3 = Color3.new(102 / 255, 153 / 255, 1)
|
||||||
|
|
@ -618,7 +615,7 @@ Backpack.Active = true
|
||||||
end
|
end
|
||||||
|
|
||||||
local function makeCharFrame(frameName, parent)
|
local function makeCharFrame(frameName, parent)
|
||||||
local frame = Instance.new("Frame")
|
local frame = Instance.new "Frame"
|
||||||
frame.RobloxLocked = true
|
frame.RobloxLocked = true
|
||||||
frame.Size = UDim2.new(1, 0, 1, -70)
|
frame.Size = UDim2.new(1, 0, 1, -70)
|
||||||
frame.Position = UDim2.new(0, 0, 0, 20)
|
frame.Position = UDim2.new(0, 0, 0, 20)
|
||||||
|
|
@ -629,7 +626,7 @@ Backpack.Active = true
|
||||||
return frame
|
return frame
|
||||||
end
|
end
|
||||||
local function makeZone(zoneName, image, size, position, parent)
|
local function makeZone(zoneName, image, size, position, parent)
|
||||||
local zone = Instance.new("ImageLabel")
|
local zone = Instance.new "ImageLabel"
|
||||||
zone.RobloxLocked = true
|
zone.RobloxLocked = true
|
||||||
zone.Name = zoneName
|
zone.Name = zoneName
|
||||||
zone.Image = image
|
zone.Image = image
|
||||||
|
|
@ -640,7 +637,7 @@ Backpack.Active = true
|
||||||
return zone
|
return zone
|
||||||
end
|
end
|
||||||
local function makeStyledButton(buttonName, size, position, parent, buttonStyle)
|
local function makeStyledButton(buttonName, size, position, parent, buttonStyle)
|
||||||
local button = Instance.new("ImageButton")
|
local button = Instance.new "ImageButton"
|
||||||
button.RobloxLocked = true
|
button.RobloxLocked = true
|
||||||
button.Name = buttonName
|
button.Name = buttonName
|
||||||
button.Size = size
|
button.Size = size
|
||||||
|
|
@ -655,7 +652,7 @@ Backpack.Active = true
|
||||||
return button
|
return button
|
||||||
end
|
end
|
||||||
local function makeTextLabel(TextLabelName, text, position, parent)
|
local function makeTextLabel(TextLabelName, text, position, parent)
|
||||||
local label = Instance.new("TextLabel")
|
local label = Instance.new "TextLabel"
|
||||||
label.RobloxLocked = true
|
label.RobloxLocked = true
|
||||||
label.BackgroundTransparency = 1
|
label.BackgroundTransparency = 1
|
||||||
label.Size = UDim2.new(0, 32, 0, 14)
|
label.Size = UDim2.new(0, 32, 0, 14)
|
||||||
|
|
@ -668,8 +665,7 @@ Backpack.Active = true
|
||||||
label.Parent = parent
|
label.Parent = parent
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local Wardrobe = Instance.new "Frame"
|
||||||
local Wardrobe = Instance.new("Frame")
|
|
||||||
Wardrobe.Name = "Wardrobe"
|
Wardrobe.Name = "Wardrobe"
|
||||||
Wardrobe.RobloxLocked = true
|
Wardrobe.RobloxLocked = true
|
||||||
Wardrobe.BackgroundTransparency = 1
|
Wardrobe.BackgroundTransparency = 1
|
||||||
|
|
@ -677,7 +673,7 @@ Backpack.Active = true
|
||||||
Wardrobe.Size = UDim2.new(1, 0, 1, 0)
|
Wardrobe.Size = UDim2.new(1, 0, 1, 0)
|
||||||
Wardrobe.Parent = Backpack
|
Wardrobe.Parent = Backpack
|
||||||
|
|
||||||
local AssetList = Instance.new("Frame")
|
local AssetList = Instance.new "Frame"
|
||||||
AssetList.RobloxLocked = true
|
AssetList.RobloxLocked = true
|
||||||
AssetList.Name = "AssetList"
|
AssetList.Name = "AssetList"
|
||||||
AssetList.Position = UDim2.new(0, 4, 0, 5)
|
AssetList.Position = UDim2.new(0, 4, 0, 5)
|
||||||
|
|
@ -686,7 +682,7 @@ Backpack.Active = true
|
||||||
AssetList.Visible = true
|
AssetList.Visible = true
|
||||||
AssetList.Parent = Wardrobe
|
AssetList.Parent = Wardrobe
|
||||||
|
|
||||||
local PreviewAssetFrame = Instance.new("Frame")
|
local PreviewAssetFrame = Instance.new "Frame"
|
||||||
PreviewAssetFrame.RobloxLocked = true
|
PreviewAssetFrame.RobloxLocked = true
|
||||||
PreviewAssetFrame.Name = "PreviewAssetFrame"
|
PreviewAssetFrame.Name = "PreviewAssetFrame"
|
||||||
PreviewAssetFrame.BackgroundTransparency = 1
|
PreviewAssetFrame.BackgroundTransparency = 1
|
||||||
|
|
@ -694,7 +690,7 @@ Backpack.Active = true
|
||||||
PreviewAssetFrame.Size = UDim2.new(0, 250, 0, 250)
|
PreviewAssetFrame.Size = UDim2.new(0, 250, 0, 250)
|
||||||
PreviewAssetFrame.Parent = Wardrobe
|
PreviewAssetFrame.Parent = Wardrobe
|
||||||
|
|
||||||
local PreviewAssetBacking = Instance.new("TextButton")
|
local PreviewAssetBacking = Instance.new "TextButton"
|
||||||
PreviewAssetBacking.RobloxLocked = true
|
PreviewAssetBacking.RobloxLocked = true
|
||||||
PreviewAssetBacking.Name = "PreviewAssetBacking"
|
PreviewAssetBacking.Name = "PreviewAssetBacking"
|
||||||
PreviewAssetBacking.Active = false
|
PreviewAssetBacking.Active = false
|
||||||
|
|
@ -706,7 +702,7 @@ Backpack.Active = true
|
||||||
PreviewAssetBacking.ZIndex = 9
|
PreviewAssetBacking.ZIndex = 9
|
||||||
PreviewAssetBacking.Parent = PreviewAssetFrame
|
PreviewAssetBacking.Parent = PreviewAssetFrame
|
||||||
|
|
||||||
local PreviewAssetImage = Instance.new("ImageLabel")
|
local PreviewAssetImage = Instance.new "ImageLabel"
|
||||||
PreviewAssetImage.RobloxLocked = true
|
PreviewAssetImage.RobloxLocked = true
|
||||||
PreviewAssetImage.Name = "PreviewAssetImage"
|
PreviewAssetImage.Name = "PreviewAssetImage"
|
||||||
PreviewAssetImage.BackgroundTransparency = 0.8
|
PreviewAssetImage.BackgroundTransparency = 0.8
|
||||||
|
|
@ -716,7 +712,7 @@ Backpack.Active = true
|
||||||
PreviewAssetImage.ZIndex = 10
|
PreviewAssetImage.ZIndex = 10
|
||||||
PreviewAssetImage.Parent = PreviewAssetBacking
|
PreviewAssetImage.Parent = PreviewAssetBacking
|
||||||
|
|
||||||
local AssetNameLabel = Instance.new("TextLabel")
|
local AssetNameLabel = Instance.new "TextLabel"
|
||||||
AssetNameLabel.Name = "AssetNameLabel"
|
AssetNameLabel.Name = "AssetNameLabel"
|
||||||
AssetNameLabel.RobloxLocked = true
|
AssetNameLabel.RobloxLocked = true
|
||||||
AssetNameLabel.BackgroundTransparency = 1
|
AssetNameLabel.BackgroundTransparency = 1
|
||||||
|
|
@ -737,9 +733,7 @@ Backpack.Active = true
|
||||||
AssetTypeLabel.Position = UDim2.new(0.5, 3, 1, -20)
|
AssetTypeLabel.Position = UDim2.new(0.5, 3, 1, -20)
|
||||||
AssetTypeLabel.Parent = PreviewAssetBacking
|
AssetTypeLabel.Parent = PreviewAssetBacking
|
||||||
|
|
||||||
|
local PreviewButton = Instance.new "TextButton"
|
||||||
|
|
||||||
local PreviewButton = Instance.new("TextButton")
|
|
||||||
PreviewButton.RobloxLocked = true
|
PreviewButton.RobloxLocked = true
|
||||||
PreviewButton.Name = "PreviewButton"
|
PreviewButton.Name = "PreviewButton"
|
||||||
PreviewButton.Text = "Rotate"
|
PreviewButton.Text = "Rotate"
|
||||||
|
|
@ -755,7 +749,7 @@ Backpack.Active = true
|
||||||
PreviewButton.TextStrokeTransparency = 0
|
PreviewButton.TextStrokeTransparency = 0
|
||||||
PreviewButton.Parent = Wardrobe
|
PreviewButton.Parent = Wardrobe
|
||||||
|
|
||||||
local CharacterPane = Instance.new("Frame")
|
local CharacterPane = Instance.new "Frame"
|
||||||
CharacterPane.RobloxLocked = true
|
CharacterPane.RobloxLocked = true
|
||||||
CharacterPane.Name = "CharacterPane"
|
CharacterPane.Name = "CharacterPane"
|
||||||
CharacterPane.Position = UDim2.new(1, -220, 0, 32)
|
CharacterPane.Position = UDim2.new(1, -220, 0, 32)
|
||||||
|
|
@ -766,26 +760,68 @@ Backpack.Active = true
|
||||||
|
|
||||||
--CharacterPane Children
|
--CharacterPane Children
|
||||||
local FaceFrame = makeCharFrame("FacesFrame", CharacterPane)
|
local FaceFrame = makeCharFrame("FacesFrame", CharacterPane)
|
||||||
game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=75460621")
|
game:GetService("ContentProvider"):Preload "http://www.roblox.com/asset/?id=75460621"
|
||||||
makeZone("FaceZone","http://www.roblox.com/asset/?id=75460621",UDim2.new(0,157,0,137),UDim2.new(0.5,-78,0.5,-68),FaceFrame)
|
makeZone(
|
||||||
|
"FaceZone",
|
||||||
|
"http://www.roblox.com/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)
|
local HeadFrame = makeCharFrame("HeadsFrame", CharacterPane)
|
||||||
makeZone("FaceZone","http://www.roblox.com/asset/?id=75460621",UDim2.new(0,157,0,137),UDim2.new(0.5,-78,0.5,-68),HeadFrame)
|
makeZone(
|
||||||
|
"FaceZone",
|
||||||
|
"http://www.roblox.com/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)
|
local HatsFrame = makeCharFrame("HatsFrame", CharacterPane)
|
||||||
game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=75457888")
|
game:GetService("ContentProvider"):Preload "http://www.roblox.com/asset/?id=75457888"
|
||||||
local HatsZone = makeZone("HatsZone","http://www.roblox.com/asset/?id=75457888",UDim2.new(0,186,0,184),UDim2.new(0.5,-93,0.5,-100), HatsFrame)
|
local HatsZone = makeZone(
|
||||||
makeStyledButton("Hat1Button",UDim2.new(0,64,0,64),UDim2.new(0,-1,0,-1),HatsZone,Enum.ButtonStyle.RobloxButton)
|
"HatsZone",
|
||||||
makeStyledButton("Hat2Button",UDim2.new(0,64,0,64),UDim2.new(0,63,0,-1),HatsZone,Enum.ButtonStyle.RobloxButton)
|
"http://www.roblox.com/asset/?id=75457888",
|
||||||
makeStyledButton("Hat3Button",UDim2.new(0,64,0,64),UDim2.new(0,127,0,-1),HatsZone,Enum.ButtonStyle.RobloxButton)
|
UDim2.new(0, 186, 0, 184),
|
||||||
|
UDim2.new(0.5, -93, 0.5, -100),
|
||||||
|
HatsFrame
|
||||||
|
)
|
||||||
|
makeStyledButton(
|
||||||
|
"Hat1Button",
|
||||||
|
UDim2.new(0, 64, 0, 64),
|
||||||
|
UDim2.new(0, -1, 0, -1),
|
||||||
|
HatsZone,
|
||||||
|
Enum.ButtonStyle.RobloxButton
|
||||||
|
)
|
||||||
|
makeStyledButton(
|
||||||
|
"Hat2Button",
|
||||||
|
UDim2.new(0, 64, 0, 64),
|
||||||
|
UDim2.new(0, 63, 0, -1),
|
||||||
|
HatsZone,
|
||||||
|
Enum.ButtonStyle.RobloxButton
|
||||||
|
)
|
||||||
|
makeStyledButton(
|
||||||
|
"Hat3Button",
|
||||||
|
UDim2.new(0, 64, 0, 64),
|
||||||
|
UDim2.new(0, 127, 0, -1),
|
||||||
|
HatsZone,
|
||||||
|
Enum.ButtonStyle.RobloxButton
|
||||||
|
)
|
||||||
|
|
||||||
local PantsFrame = makeCharFrame("PantsFrame", CharacterPane)
|
local PantsFrame = makeCharFrame("PantsFrame", CharacterPane)
|
||||||
game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=75457920")
|
game:GetService("ContentProvider"):Preload "http://www.roblox.com/asset/?id=75457920"
|
||||||
makeZone("PantsZone","http://www.roblox.com/asset/?id=75457920",UDim2.new(0,121,0,99),UDim2.new(0.5,-60,0.5,-100),PantsFrame)
|
makeZone(
|
||||||
|
"PantsZone",
|
||||||
|
"http://www.roblox.com/asset/?id=75457920",
|
||||||
|
UDim2.new(0, 121, 0, 99),
|
||||||
|
UDim2.new(0.5, -60, 0.5, -100),
|
||||||
|
PantsFrame
|
||||||
|
)
|
||||||
|
|
||||||
local pantFrame = Instance.new("Frame")
|
local pantFrame = Instance.new "Frame"
|
||||||
pantFrame.RobloxLocked = true
|
pantFrame.RobloxLocked = true
|
||||||
pantFrame.Size = UDim2.new(0, 25, 0, 56)
|
pantFrame.Size = UDim2.new(0, 25, 0, 56)
|
||||||
pantFrame.Position = UDim2.new(0.5, -26, 0.5, 0)
|
pantFrame.Position = UDim2.new(0.5, -26, 0.5, 0)
|
||||||
|
|
@ -799,7 +835,7 @@ Backpack.Active = true
|
||||||
otherPantFrame.RobloxLocked = true
|
otherPantFrame.RobloxLocked = true
|
||||||
otherPantFrame.Parent = PantsFrame
|
otherPantFrame.Parent = PantsFrame
|
||||||
|
|
||||||
local CurrentPants = Instance.new("ImageButton")
|
local CurrentPants = Instance.new "ImageButton"
|
||||||
CurrentPants.RobloxLocked = true
|
CurrentPants.RobloxLocked = true
|
||||||
CurrentPants.BackgroundTransparency = 1
|
CurrentPants.BackgroundTransparency = 1
|
||||||
CurrentPants.ZIndex = 2
|
CurrentPants.ZIndex = 2
|
||||||
|
|
@ -809,40 +845,89 @@ Backpack.Active = true
|
||||||
CurrentPants.Parent = PantsFrame
|
CurrentPants.Parent = PantsFrame
|
||||||
|
|
||||||
local MeshFrame = makeCharFrame("PackagesFrame", CharacterPane)
|
local MeshFrame = makeCharFrame("PackagesFrame", CharacterPane)
|
||||||
local torsoButton = makeStyledButton("TorsoMeshButton", UDim2.new(0,64,0,64),UDim2.new(0.5,-32,0.5,-110),MeshFrame,Enum.ButtonStyle.RobloxButton)
|
local torsoButton = makeStyledButton(
|
||||||
|
"TorsoMeshButton",
|
||||||
|
UDim2.new(0, 64, 0, 64),
|
||||||
|
UDim2.new(0.5, -32, 0.5, -110),
|
||||||
|
MeshFrame,
|
||||||
|
Enum.ButtonStyle.RobloxButton
|
||||||
|
)
|
||||||
makeTextLabel("TorsoLabel", "Torso", UDim2.new(0.5, -16, 0, -25), torsoButton)
|
makeTextLabel("TorsoLabel", "Torso", UDim2.new(0.5, -16, 0, -25), torsoButton)
|
||||||
local leftLegButton = makeStyledButton("LeftLegMeshButton", UDim2.new(0,64,0,64),UDim2.new(0.5,0,0.5,-25),MeshFrame,Enum.ButtonStyle.RobloxButton)
|
local leftLegButton = makeStyledButton(
|
||||||
|
"LeftLegMeshButton",
|
||||||
|
UDim2.new(0, 64, 0, 64),
|
||||||
|
UDim2.new(0.5, 0, 0.5, -25),
|
||||||
|
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),UDim2.new(0.5,-64,0.5,-25),MeshFrame,Enum.ButtonStyle.RobloxButton)
|
local rightLegButton = makeStyledButton(
|
||||||
|
"RightLegMeshButton",
|
||||||
|
UDim2.new(0, 64, 0, 64),
|
||||||
|
UDim2.new(0.5, -64, 0.5, -25),
|
||||||
|
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),UDim2.new(0.5,-96,0.5,-110),MeshFrame,Enum.ButtonStyle.RobloxButton)
|
local rightArmButton = makeStyledButton(
|
||||||
|
"RightArmMeshButton",
|
||||||
|
UDim2.new(0, 64, 0, 64),
|
||||||
|
UDim2.new(0.5, -96, 0.5, -110),
|
||||||
|
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),UDim2.new(0.5,32,0.5,-110),MeshFrame,Enum.ButtonStyle.RobloxButton)
|
local leftArmButton = makeStyledButton(
|
||||||
|
"LeftArmMeshButton",
|
||||||
|
UDim2.new(0, 64, 0, 64),
|
||||||
|
UDim2.new(0.5, 32, 0.5, -110),
|
||||||
|
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)
|
local TShirtFrame = makeCharFrame("T-ShirtsFrame", CharacterPane)
|
||||||
game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=75460642")
|
game:GetService("ContentProvider"):Preload "http://www.roblox.com/asset/?id=75460642"
|
||||||
makeZone("TShirtZone","http://www.roblox.com/asset/?id=75460642",UDim2.new(0,121,0,154),UDim2.new(0.5,-60,0.5,-100),TShirtFrame)
|
makeZone(
|
||||||
|
"TShirtZone",
|
||||||
|
"http://www.roblox.com/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)
|
local ShirtFrame = makeCharFrame("ShirtsFrame", CharacterPane)
|
||||||
makeZone("ShirtZone","http://www.roblox.com/asset/?id=75460642",UDim2.new(0,121,0,154),UDim2.new(0.5,-60,0.5,-100),ShirtFrame)
|
makeZone(
|
||||||
|
"ShirtZone",
|
||||||
|
"http://www.roblox.com/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)
|
local ColorFrame = makeCharFrame("ColorFrame", CharacterPane)
|
||||||
game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=76049888")
|
game:GetService("ContentProvider"):Preload "http://www.roblox.com/asset/?id=76049888"
|
||||||
local ColorZone = makeZone("ColorZone","http://www.roblox.com/asset/?id=76049888", UDim2.new(0,120,0,150),UDim2.new(0.5,-60,0.5,-100),ColorFrame)
|
local ColorZone = makeZone(
|
||||||
|
"ColorZone",
|
||||||
|
"http://www.roblox.com/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("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("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 = false
|
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("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("RightLeg", UDim2.new(0.19, 0, 0.31, 0), UDim2.new(0.275, 0, 0.67, 0), ColorZone).AutoButtonColor =
|
||||||
makeStyledButton("LeftLeg",UDim2.new(0.19,0,0.31,0),UDim2.new(0.525,0,0.67,0),ColorZone).AutoButtonColor = false
|
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)
|
-- Character Panel label (shows what category we are currently browsing)
|
||||||
local CategoryLabel = Instance.new("TextLabel")
|
local CategoryLabel = Instance.new "TextLabel"
|
||||||
CategoryLabel.RobloxLocked = true
|
CategoryLabel.RobloxLocked = true
|
||||||
CategoryLabel.Name = "CategoryLabel"
|
CategoryLabel.Name = "CategoryLabel"
|
||||||
CategoryLabel.BackgroundTransparency = 1
|
CategoryLabel.BackgroundTransparency = 1
|
||||||
|
|
@ -856,7 +941,7 @@ Backpack.Active = true
|
||||||
CategoryLabel.Parent = CharacterPane
|
CategoryLabel.Parent = CharacterPane
|
||||||
|
|
||||||
--Save Button
|
--Save Button
|
||||||
local SaveButton = Instance.new("TextButton")
|
local SaveButton = Instance.new "TextButton"
|
||||||
SaveButton.RobloxLocked = true
|
SaveButton.RobloxLocked = true
|
||||||
SaveButton.Name = "SaveButton"
|
SaveButton.Name = "SaveButton"
|
||||||
SaveButton.Size = UDim2.new(0.6, 0, 0, 50)
|
SaveButton.Size = UDim2.new(0.6, 0, 0, 50)
|
||||||
|
|
|
||||||
461
53878057.lua
461
53878057.lua
|
|
@ -1,4 +1,6 @@
|
||||||
if game.CoreGui.Version < 3 then return end -- peace out if we aren't using the right client
|
if game.CoreGui.Version < 3 then
|
||||||
|
return
|
||||||
|
end -- peace out if we aren't using the right client
|
||||||
|
|
||||||
-- A couple of necessary functions
|
-- A couple of necessary functions
|
||||||
local function waitForChild(instance, name)
|
local function waitForChild(instance, name)
|
||||||
|
|
@ -17,51 +19,54 @@ local currentLoadout = script.Parent
|
||||||
local StaticTabName = "gear"
|
local StaticTabName = "gear"
|
||||||
local backpackEnabled = true
|
local backpackEnabled = true
|
||||||
|
|
||||||
local robloxGui = game:GetService("CoreGui"):FindFirstChild("RobloxGui")
|
local robloxGui = game:GetService("CoreGui"):FindFirstChild "RobloxGui"
|
||||||
assert(robloxGui)
|
assert(robloxGui)
|
||||||
local controlFrame = waitForChild(robloxGui, 'ControlFrame')
|
local controlFrame = waitForChild(robloxGui, "ControlFrame")
|
||||||
local backpackButton = waitForChild(controlFrame, 'BackpackButton')
|
local backpackButton = waitForChild(controlFrame, "BackpackButton")
|
||||||
local backpack = waitForChild(robloxGui, 'Backpack')
|
local backpack = waitForChild(robloxGui, "Backpack")
|
||||||
waitForChild(robloxGui, "CurrentLoadout")
|
waitForChild(robloxGui, "CurrentLoadout")
|
||||||
waitForChild(robloxGui.CurrentLoadout, "TempSlot")
|
waitForChild(robloxGui.CurrentLoadout, "TempSlot")
|
||||||
waitForChild(robloxGui.CurrentLoadout.TempSlot, "SlotNumber")
|
waitForChild(robloxGui.CurrentLoadout.TempSlot, "SlotNumber")
|
||||||
|
|
||||||
waitForChild(currentLoadout, 'Background')
|
waitForChild(currentLoadout, "Background")
|
||||||
local clBackground = currentLoadout.Background
|
local clBackground = currentLoadout.Background
|
||||||
|
|
||||||
local function IsTouchDevice()
|
local function IsTouchDevice()
|
||||||
local touchEnabled = false
|
local touchEnabled = false
|
||||||
pcall(function() touchEnabled = Game:GetService('UserInputService').TouchEnabled end)
|
pcall(function()
|
||||||
|
touchEnabled = Game:GetService("UserInputService").TouchEnabled
|
||||||
|
end)
|
||||||
return touchEnabled
|
return touchEnabled
|
||||||
end
|
end
|
||||||
|
|
||||||
local function moveHealthBar(pGui)
|
local function moveHealthBar(pGui)
|
||||||
waitForChild(pGui, 'HealthGUI')
|
waitForChild(pGui, "HealthGUI")
|
||||||
waitForChild(pGui['HealthGUI'], 'tray')
|
waitForChild(pGui["HealthGUI"], "tray")
|
||||||
local tray = pGui['HealthGUI']['tray']
|
local tray = pGui["HealthGUI"]["tray"]
|
||||||
tray.Position = UDim2.new(0.5, -85, 1, -26)
|
tray.Position = UDim2.new(0.5, -85, 1, -26)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function setHealthBarVisible(pGui, visible)
|
local function setHealthBarVisible(pGui, visible)
|
||||||
waitForChild(pGui, 'HealthGUI')
|
waitForChild(pGui, "HealthGUI")
|
||||||
waitForChild(pGui['HealthGUI'], 'tray')
|
waitForChild(pGui["HealthGUI"], "tray")
|
||||||
local tray = pGui['HealthGUI']['tray']
|
local tray = pGui["HealthGUI"]["tray"]
|
||||||
tray.Visible = visible
|
tray.Visible = visible
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Begin Locals
|
--- Begin Locals
|
||||||
waitForChild(game, "Players")
|
waitForChild(game, "Players")
|
||||||
waitForProperty(game.Players, "LocalPlayer")
|
waitForProperty(game.Players, "LocalPlayer")
|
||||||
local player = game.Players.LocalPlayer
|
local player = game.Players.LocalPlayer
|
||||||
|
|
||||||
waitForChild(player, 'PlayerGui')
|
waitForChild(player, "PlayerGui")
|
||||||
Spawn(function()
|
Spawn(function()
|
||||||
moveHealthBar(player.PlayerGui)
|
moveHealthBar(player.PlayerGui)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
while player.Character == nil do wait(0.03) end
|
while player.Character == nil do
|
||||||
local humanoid = waitForChild(player.Character, 'Humanoid')
|
wait(0.03)
|
||||||
|
end
|
||||||
|
local humanoid = waitForChild(player.Character, "Humanoid")
|
||||||
humanoid.Died:connect(function()
|
humanoid.Died:connect(function()
|
||||||
backpackButton.Visible = false
|
backpackButton.Visible = false
|
||||||
end)
|
end)
|
||||||
|
|
@ -85,7 +90,6 @@ if robloxGui.AbsoluteSize.Y <= 320 then
|
||||||
maxNumLoadoutItems = 4
|
maxNumLoadoutItems = 4
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local characterChildAddedCon = nil
|
local characterChildAddedCon = nil
|
||||||
local backpackChildCon = nil
|
local backpackChildCon = nil
|
||||||
|
|
||||||
|
|
@ -109,11 +113,6 @@ end
|
||||||
local backpackWasOpened = false
|
local backpackWasOpened = false
|
||||||
--- End Locals
|
--- End Locals
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Begin Functions
|
-- Begin Functions
|
||||||
local function backpackIsOpen()
|
local function backpackIsOpen()
|
||||||
if guiBackpack then
|
if guiBackpack then
|
||||||
|
|
@ -122,9 +121,10 @@ local function backpackIsOpen()
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function kill(prop, con, gear)
|
local function kill(prop, con, gear)
|
||||||
if con then con:disconnect() end
|
if con then
|
||||||
|
con:disconnect()
|
||||||
|
end
|
||||||
if prop == true and gear then
|
if prop == true and gear then
|
||||||
reorganizeLoadout(gear, false)
|
reorganizeLoadout(gear, false)
|
||||||
end
|
end
|
||||||
|
|
@ -172,7 +172,10 @@ function removeGear(gear)
|
||||||
gearSlots[emptySlot].GearReference.Value.Parent = game.Players.LocalPlayer.Backpack
|
gearSlots[emptySlot].GearReference.Value.Parent = game.Players.LocalPlayer.Backpack
|
||||||
end
|
end
|
||||||
|
|
||||||
if gearSlots[emptySlot].GearReference.Value:IsA("HopperBin") and gearSlots[emptySlot].GearReference.Value.Active then -- this is an active hopperbin
|
if
|
||||||
|
gearSlots[emptySlot].GearReference.Value:IsA "HopperBin"
|
||||||
|
and gearSlots[emptySlot].GearReference.Value.Active
|
||||||
|
then -- this is an active hopperbin
|
||||||
gearSlots[emptySlot].GearReference.Value:Disable()
|
gearSlots[emptySlot].GearReference.Value:Disable()
|
||||||
gearSlots[emptySlot].GearReference.Value.Active = false
|
gearSlots[emptySlot].GearReference.Value.Active = false
|
||||||
end
|
end
|
||||||
|
|
@ -185,17 +188,18 @@ function removeGear(gear)
|
||||||
--[[gear:TweenSizeAndPosition(UDim2.new(0,0,0,0),
|
--[[gear:TweenSizeAndPosition(UDim2.new(0,0,0,0),
|
||||||
UDim2.new(gear.Position.X.Scale + centerizeX,gear.Position.X.Offset,gear.Position.Y.Scale + centerizeY,gear.Position.Y.Offset),
|
UDim2.new(gear.Position.X.Scale + centerizeX,gear.Position.X.Offset,gear.Position.Y.Scale + centerizeY,gear.Position.Y.Offset),
|
||||||
Enum.EasingDirection.Out, Enum.EasingStyle.Quad,guiTweenSpeed/4,true)]]
|
Enum.EasingDirection.Out, Enum.EasingStyle.Quad,guiTweenSpeed/4,true)]]
|
||||||
delay(0,
|
delay(0, function()
|
||||||
function()
|
|
||||||
gear:remove()
|
gear:remove()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Spawn(function()
|
Spawn(function()
|
||||||
while backpackIsOpen() do wait(0.03) end
|
while backpackIsOpen() do
|
||||||
waitForChild(player, 'Backpack')
|
wait(0.03)
|
||||||
|
end
|
||||||
|
waitForChild(player, "Backpack")
|
||||||
local allEmpty = true
|
local allEmpty = true
|
||||||
for i = 1, #gearSlots do
|
for i = 1, #gearSlots do
|
||||||
if gearSlots[i] ~= 'empty' then
|
if gearSlots[i] ~= "empty" then
|
||||||
allEmpty = false
|
allEmpty = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -222,7 +226,10 @@ function insertGear(gear, addToSlot)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if pos == 1 and gearSlots[1] ~= "empty" then gear:remove() return end -- we are currently full, can't add in
|
if pos == 1 and gearSlots[1] ~= "empty" then
|
||||||
|
gear:remove()
|
||||||
|
return
|
||||||
|
end -- we are currently full, can't add in
|
||||||
else
|
else
|
||||||
pos = addToSlot
|
pos = addToSlot
|
||||||
-- push all gear down one slot
|
-- push all gear down one slot
|
||||||
|
|
@ -249,7 +256,7 @@ function insertGear(gear, addToSlot)
|
||||||
|
|
||||||
gearSlots[pos] = gear
|
gearSlots[pos] = gear
|
||||||
if pos ~= maxNumLoadoutItems then
|
if pos ~= maxNumLoadoutItems then
|
||||||
if(type(tostring(pos)) == "string") then
|
if type(tostring(pos)) == "string" then
|
||||||
local posString = tostring(pos)
|
local posString = tostring(pos)
|
||||||
gear.SlotNumber.Text = posString
|
gear.SlotNumber.Text = posString
|
||||||
gear.SlotNumberDownShadow.Text = posString
|
gear.SlotNumberDownShadow.Text = posString
|
||||||
|
|
@ -263,22 +270,27 @@ function insertGear(gear, addToSlot)
|
||||||
gear.Visible = true
|
gear.Visible = true
|
||||||
|
|
||||||
local con = nil
|
local con = nil
|
||||||
con = gear.Kill.Changed:connect(function(prop) kill(prop,con,gear) end)
|
con = gear.Kill.Changed:connect(function(prop)
|
||||||
|
kill(prop, con, gear)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function reorganizeLoadout(gear, inserting, equipped, addToSlot)
|
function reorganizeLoadout(gear, inserting, equipped, addToSlot)
|
||||||
if inserting then -- add in gear
|
if inserting then -- add in gear
|
||||||
insertGear(gear, addToSlot)
|
insertGear(gear, addToSlot)
|
||||||
else
|
else
|
||||||
removeGear(gear)
|
removeGear(gear)
|
||||||
end
|
end
|
||||||
if gear ~= "empty" then gear.ZIndex = 1 end
|
if gear ~= "empty" then
|
||||||
|
gear.ZIndex = 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function checkToolAncestry(child, parent)
|
function checkToolAncestry(child, parent)
|
||||||
if child:FindFirstChild("RobloxBuildTool") then return end -- don't show roblox build tools
|
if child:FindFirstChild "RobloxBuildTool" then
|
||||||
if child:IsA("Tool") or child:IsA("HopperBin") then
|
return
|
||||||
|
end -- don't show roblox build tools
|
||||||
|
if child:IsA "Tool" or child:IsA "HopperBin" then
|
||||||
for i = 1, #gearSlots do
|
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
|
if parent == nil then
|
||||||
|
|
@ -288,7 +300,9 @@ function checkToolAncestry(child,parent)
|
||||||
gearSlots[i].Selected = true
|
gearSlots[i].Selected = true
|
||||||
return true
|
return true
|
||||||
elseif child.Parent == player.Backpack then
|
elseif child.Parent == player.Backpack then
|
||||||
if child:IsA("Tool") or child:IsA("HopperBin") then gearSlots[i].Selected = false end
|
if child:IsA "Tool" or child:IsA "HopperBin" then
|
||||||
|
gearSlots[i].Selected = false
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
gearSlots[i].Kill.Value = true
|
gearSlots[i].Kill.Value = true
|
||||||
|
|
@ -303,9 +317,11 @@ end
|
||||||
function removeAllEquippedGear(physGear)
|
function removeAllEquippedGear(physGear)
|
||||||
local stuff = player.Character:GetChildren()
|
local stuff = player.Character:GetChildren()
|
||||||
for i = 1, #stuff do
|
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
|
if stuff[i]:IsA "Tool" then
|
||||||
if stuff[i]:IsA("HopperBin") then
|
stuff[i].Parent = player.Backpack
|
||||||
|
end
|
||||||
|
if stuff[i]:IsA "HopperBin" then
|
||||||
stuff[i]:Disable()
|
stuff[i]:Disable()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -313,11 +329,15 @@ function removeAllEquippedGear(physGear)
|
||||||
end
|
end
|
||||||
|
|
||||||
function hopperBinSwitcher(numKey, physGear)
|
function hopperBinSwitcher(numKey, physGear)
|
||||||
if not physGear then return end
|
if not physGear then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
physGear:ToggleSelect()
|
physGear:ToggleSelect()
|
||||||
|
|
||||||
if gearSlots[numKey] == "empty" then return end
|
if gearSlots[numKey] == "empty" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if not physGear.Active then
|
if not physGear.Active then
|
||||||
gearSlots[numKey].Selected = false
|
gearSlots[numKey].Selected = false
|
||||||
|
|
@ -329,27 +349,37 @@ function hopperBinSwitcher(numKey, physGear)
|
||||||
end
|
end
|
||||||
|
|
||||||
function toolSwitcher(numKey)
|
function toolSwitcher(numKey)
|
||||||
|
if not gearSlots[numKey] then
|
||||||
if not gearSlots[numKey] then return end
|
return
|
||||||
|
end
|
||||||
local physGear = gearSlots[numKey].GearReference.Value
|
local physGear = gearSlots[numKey].GearReference.Value
|
||||||
if physGear == nil then return end
|
if physGear == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
removeAllEquippedGear(physGear) -- we don't remove this gear, as then we get a double switcheroo
|
removeAllEquippedGear(physGear) -- we don't remove this gear, as then we get a double switcheroo
|
||||||
|
|
||||||
local key = numKey
|
local key = numKey
|
||||||
if numKey == 0 then key = 10 end
|
if numKey == 0 then
|
||||||
|
key = 10
|
||||||
|
end
|
||||||
|
|
||||||
for i = 1, #gearSlots do
|
for i = 1, #gearSlots do
|
||||||
if gearSlots[i] and gearSlots[i] ~= "empty" and i ~= key then
|
if gearSlots[i] and gearSlots[i] ~= "empty" and i ~= key then
|
||||||
normalizeButton(gearSlots[i])
|
normalizeButton(gearSlots[i])
|
||||||
gearSlots[i].Selected = false
|
gearSlots[i].Selected = false
|
||||||
if gearSlots[i].GearReference and gearSlots[i].GearReference.Value and gearSlots[i].GearReference.Value:IsA("HopperBin") and gearSlots[i].GearReference.Value.Active then
|
if
|
||||||
|
gearSlots[i].GearReference
|
||||||
|
and gearSlots[i].GearReference.Value
|
||||||
|
and gearSlots[i].GearReference.Value:IsA "HopperBin"
|
||||||
|
and gearSlots[i].GearReference.Value.Active
|
||||||
|
then
|
||||||
gearSlots[i].GearReference.Value:ToggleSelect()
|
gearSlots[i].GearReference.Value:ToggleSelect()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if physGear:IsA("HopperBin") then
|
if physGear:IsA "HopperBin" then
|
||||||
hopperBinSwitcher(numKey, physGear)
|
hopperBinSwitcher(numKey, physGear)
|
||||||
else
|
else
|
||||||
if physGear.Parent == player.Character then
|
if physGear.Parent == player.Character then
|
||||||
|
|
@ -370,7 +400,6 @@ function toolSwitcher(numKey)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function activateGear(num)
|
function activateGear(num)
|
||||||
local numKey = nil
|
local numKey = nil
|
||||||
if num == "0" then
|
if num == "0" then
|
||||||
|
|
@ -379,21 +408,30 @@ function activateGear(num)
|
||||||
numKey = tonumber(num)
|
numKey = tonumber(num)
|
||||||
end
|
end
|
||||||
|
|
||||||
if(numKey == nil) then return end
|
if numKey == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if gearSlots[numKey] ~= "empty" then
|
if gearSlots[numKey] ~= "empty" then
|
||||||
toolSwitcher(numKey)
|
toolSwitcher(numKey)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
enlargeButton = function(button)
|
enlargeButton = function(button)
|
||||||
if button.Size.Y.Scale > 1 then return end
|
if button.Size.Y.Scale > 1 then
|
||||||
if not button.Parent then return end
|
return
|
||||||
if not button.Selected then return end
|
end
|
||||||
|
if not button.Parent then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not button.Selected then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
for i = 1, #gearSlots do
|
for i = 1, #gearSlots do
|
||||||
if gearSlots[i] == "empty" then break end
|
if gearSlots[i] == "empty" then
|
||||||
|
break
|
||||||
|
end
|
||||||
if gearSlots[i] ~= button then
|
if gearSlots[i] ~= button then
|
||||||
normalizeButton(gearSlots[i])
|
normalizeButton(gearSlots[i])
|
||||||
end
|
end
|
||||||
|
|
@ -403,51 +441,82 @@ enlargeButton = function(button)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if button:FindFirstChild('Highlight') then
|
if button:FindFirstChild "Highlight" then
|
||||||
button.Highlight.Visible = true
|
button.Highlight.Visible = true
|
||||||
end
|
end
|
||||||
|
|
||||||
if button:IsA("ImageButton") or button:IsA("TextButton") then
|
if button:IsA "ImageButton" or button:IsA "TextButton" then
|
||||||
button.ZIndex = 5
|
button.ZIndex = 5
|
||||||
local centerizeX = -(buttonSizeEnlarge.X.Scale - button.Size.X.Scale) / 2
|
local centerizeX = -(buttonSizeEnlarge.X.Scale - button.Size.X.Scale) / 2
|
||||||
local centerizeY = -(buttonSizeEnlarge.Y.Scale - button.Size.Y.Scale) / 2
|
local centerizeY = -(buttonSizeEnlarge.Y.Scale - button.Size.Y.Scale) / 2
|
||||||
button:TweenSizeAndPosition(buttonSizeEnlarge,
|
button:TweenSizeAndPosition(
|
||||||
UDim2.new(button.Position.X.Scale + centerizeX,button.Position.X.Offset,button.Position.Y.Scale + centerizeY,button.Position.Y.Offset),
|
buttonSizeEnlarge,
|
||||||
Enum.EasingDirection.Out, Enum.EasingStyle.Quad,guiTweenSpeed/5,enlargeOverride)
|
UDim2.new(
|
||||||
|
button.Position.X.Scale + centerizeX,
|
||||||
|
button.Position.X.Offset,
|
||||||
|
button.Position.Y.Scale + centerizeY,
|
||||||
|
button.Position.Y.Offset
|
||||||
|
),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quad,
|
||||||
|
guiTweenSpeed / 5,
|
||||||
|
enlargeOverride
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
normalizeAllButtons = function()
|
normalizeAllButtons = function()
|
||||||
for i = 1, #gearSlots do
|
for i = 1, #gearSlots do
|
||||||
if gearSlots[i] == "empty" then break end
|
if gearSlots[i] == "empty" then
|
||||||
|
break
|
||||||
|
end
|
||||||
if gearSlots[i] ~= button then
|
if gearSlots[i] ~= button then
|
||||||
normalizeButton(gearSlots[i], 0.1)
|
normalizeButton(gearSlots[i], 0.1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
normalizeButton = function(button, speed)
|
normalizeButton = function(button, speed)
|
||||||
if not button then return end
|
if not button then
|
||||||
if button.Size.Y.Scale <= 1 then return end
|
return
|
||||||
if button.Selected then return end
|
end
|
||||||
if not button.Parent then return end
|
if button.Size.Y.Scale <= 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if button.Selected then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not button.Parent then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local moveSpeed = speed
|
local moveSpeed = speed
|
||||||
if moveSpeed == nil or type(moveSpeed) ~= "number" then moveSpeed = guiTweenSpeed/5 end
|
if moveSpeed == nil or type(moveSpeed) ~= "number" then
|
||||||
|
moveSpeed = guiTweenSpeed / 5
|
||||||
|
end
|
||||||
|
|
||||||
if button:FindFirstChild('Highlight') then
|
if button:FindFirstChild "Highlight" then
|
||||||
button.Highlight.Visible = false
|
button.Highlight.Visible = false
|
||||||
end
|
end
|
||||||
|
|
||||||
if button:IsA("ImageButton") or button:IsA("TextButton") then
|
if button:IsA "ImageButton" or button:IsA "TextButton" then
|
||||||
button.ZIndex = 1
|
button.ZIndex = 1
|
||||||
local inverseEnlarge = 1 / enlargeFactor
|
local inverseEnlarge = 1 / enlargeFactor
|
||||||
local centerizeX = -(buttonSizeNormal.X.Scale - button.Size.X.Scale) / 2
|
local centerizeX = -(buttonSizeNormal.X.Scale - button.Size.X.Scale) / 2
|
||||||
local centerizeY = -(buttonSizeNormal.Y.Scale - button.Size.Y.Scale) / 2
|
local centerizeY = -(buttonSizeNormal.Y.Scale - button.Size.Y.Scale) / 2
|
||||||
button:TweenSizeAndPosition(buttonSizeNormal,
|
button:TweenSizeAndPosition(
|
||||||
UDim2.new(button.Position.X.Scale + centerizeX,button.Position.X.Offset,button.Position.Y.Scale + centerizeY,button.Position.Y.Offset),
|
buttonSizeNormal,
|
||||||
Enum.EasingDirection.Out, Enum.EasingStyle.Quad,moveSpeed,enlargeOverride)
|
UDim2.new(
|
||||||
|
button.Position.X.Scale + centerizeX,
|
||||||
|
button.Position.X.Offset,
|
||||||
|
button.Position.Y.Scale + centerizeY,
|
||||||
|
button.Position.Y.Offset
|
||||||
|
),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quad,
|
||||||
|
moveSpeed,
|
||||||
|
enlargeOverride
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -469,12 +538,15 @@ end
|
||||||
function swapGear(gearClone, toFrame)
|
function swapGear(gearClone, toFrame)
|
||||||
local toFrameChildren = toFrame:GetChildren()
|
local toFrameChildren = toFrame:GetChildren()
|
||||||
if #toFrameChildren == 1 then
|
if #toFrameChildren == 1 then
|
||||||
if toFrameChildren[1]:FindFirstChild("SlotNumber") then
|
if toFrameChildren[1]:FindFirstChild "SlotNumber" then
|
||||||
|
|
||||||
local toSlot = tonumber(toFrameChildren[1].SlotNumber.Text)
|
local toSlot = tonumber(toFrameChildren[1].SlotNumber.Text)
|
||||||
local gearCloneSlot = tonumber(gearClone.SlotNumber.Text)
|
local gearCloneSlot = tonumber(gearClone.SlotNumber.Text)
|
||||||
if toSlot == 0 then toSlot = 10 end
|
if toSlot == 0 then
|
||||||
if gearCloneSlot == 0 then gearCloneSlot = 10 end
|
toSlot = 10
|
||||||
|
end
|
||||||
|
if gearCloneSlot == 0 then
|
||||||
|
gearCloneSlot = 10
|
||||||
|
end
|
||||||
|
|
||||||
gearSlots[toSlot] = gearClone
|
gearSlots[toSlot] = gearClone
|
||||||
gearSlots[gearCloneSlot] = toFrameChildren[1]
|
gearSlots[gearCloneSlot] = toFrameChildren[1]
|
||||||
|
|
@ -489,14 +561,17 @@ function swapGear(gearClone,toFrame)
|
||||||
gearClone.SlotNumberUpShadow.Text = subString
|
gearClone.SlotNumberUpShadow.Text = subString
|
||||||
|
|
||||||
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)
|
||||||
toFrameChildren[1].Position = UDim2.new(toFrameChildren[1].Position.X.Scale,0,toFrameChildren[1].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
|
toFrameChildren[1].Parent = gearClone.Parent
|
||||||
gearClone.Parent = toFrame
|
gearClone.Parent = toFrame
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local slotNum = tonumber(gearClone.SlotNumber.Text)
|
local slotNum = tonumber(gearClone.SlotNumber.Text)
|
||||||
if slotNum == 0 then slotNum = 10 end
|
if slotNum == 0 then
|
||||||
|
slotNum = 10
|
||||||
|
end
|
||||||
gearSlots[slotNum] = "empty" -- reset this gear slot
|
gearSlots[slotNum] = "empty" -- reset this gear slot
|
||||||
|
|
||||||
local subString = string.sub(toFrame.Name, 5)
|
local subString = string.sub(toFrame.Name, 5)
|
||||||
|
|
@ -505,7 +580,9 @@ function swapGear(gearClone,toFrame)
|
||||||
gearClone.SlotNumberUpShadow.Text = subString
|
gearClone.SlotNumberUpShadow.Text = subString
|
||||||
|
|
||||||
local toSlotNum = tonumber(gearClone.SlotNumber.Text)
|
local toSlotNum = tonumber(gearClone.SlotNumber.Text)
|
||||||
if toSlotNum == 0 then toSlotNum = 10 end
|
if toSlotNum == 0 then
|
||||||
|
toSlotNum = 10
|
||||||
|
end
|
||||||
gearSlots[toSlotNum] = gearClone
|
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
|
gearClone.Parent = toFrame
|
||||||
|
|
@ -519,7 +596,7 @@ function resolveDrag(gearClone,x,y)
|
||||||
local frames = frame.Parent:GetChildren()
|
local frames = frame.Parent:GetChildren()
|
||||||
|
|
||||||
for i = 1, #frames do
|
for i = 1, #frames do
|
||||||
if frames[i]:IsA("Frame") then
|
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])
|
swapGear(gearClone, frames[i])
|
||||||
return true
|
return true
|
||||||
|
|
@ -534,18 +611,22 @@ function resolveDrag(gearClone,x,y)
|
||||||
reorganizeLoadout(gearClone, false)
|
reorganizeLoadout(gearClone, false)
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
if dragBeginPos then gearClone.Position = dragBeginPos end
|
if dragBeginPos then
|
||||||
|
gearClone.Position = dragBeginPos
|
||||||
|
end
|
||||||
return -1
|
return -1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function unequipAllItems(dontEquipThis)
|
function unequipAllItems(dontEquipThis)
|
||||||
for i = 1, #gearSlots do
|
for i = 1, #gearSlots do
|
||||||
if gearSlots[i] == "empty" then break end
|
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
|
if gearSlots[i].GearReference.Value:IsA "HopperBin" then
|
||||||
gearSlots[i].GearReference.Value:Disable()
|
gearSlots[i].GearReference.Value:Disable()
|
||||||
elseif gearSlots[i].GearReference.Value:IsA("Tool") then
|
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
|
end
|
||||||
gearSlots[i].Selected = false
|
gearSlots[i].Selected = false
|
||||||
|
|
@ -554,7 +635,12 @@ function unequipAllItems(dontEquipThis)
|
||||||
end
|
end
|
||||||
|
|
||||||
function showToolTip(button, tip)
|
function showToolTip(button, tip)
|
||||||
if button and button:FindFirstChild("ToolTipLabel") and button.ToolTipLabel:IsA("TextLabel") and not IsTouchDevice() then
|
if
|
||||||
|
button
|
||||||
|
and button:FindFirstChild "ToolTipLabel"
|
||||||
|
and button.ToolTipLabel:IsA "TextLabel"
|
||||||
|
and not IsTouchDevice()
|
||||||
|
then
|
||||||
button.ToolTipLabel.Text = tostring(tip)
|
button.ToolTipLabel.Text = tostring(tip)
|
||||||
local xSize = button.ToolTipLabel.TextBounds.X + 6
|
local xSize = button.ToolTipLabel.TextBounds.X + 6
|
||||||
button.ToolTipLabel.Size = UDim2.new(0, xSize, 0, 20)
|
button.ToolTipLabel.Size = UDim2.new(0, xSize, 0, 20)
|
||||||
|
|
@ -564,7 +650,7 @@ function showToolTip(button, tip)
|
||||||
end
|
end
|
||||||
|
|
||||||
function hideToolTip(button, tip)
|
function hideToolTip(button, tip)
|
||||||
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
|
button.ToolTipLabel.Visible = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -573,9 +659,12 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt
|
||||||
waitForDebounce()
|
waitForDebounce()
|
||||||
debounce = true
|
debounce = true
|
||||||
|
|
||||||
if child:FindFirstChild("RobloxBuildTool") then debounce = false return end -- don't show roblox build tools
|
if child:FindFirstChild "RobloxBuildTool" then
|
||||||
if not child:IsA("Tool") then
|
debounce = false
|
||||||
if not child:IsA("HopperBin") then
|
return
|
||||||
|
end -- don't show roblox build tools
|
||||||
|
if not child:IsA "Tool" then
|
||||||
|
if not child:IsA "HopperBin" then
|
||||||
debounce = false
|
debounce = false
|
||||||
return -- we don't care about anything besides tools (sigh...)
|
return -- we don't care about anything besides tools (sigh...)
|
||||||
end
|
end
|
||||||
|
|
@ -599,13 +688,21 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt
|
||||||
gearClone.GearReference.Value = child
|
gearClone.GearReference.Value = child
|
||||||
|
|
||||||
gearClone.MouseEnter:connect(function()
|
gearClone.MouseEnter:connect(function()
|
||||||
if gearClone.GearReference and gearClone.GearReference.Value["ToolTip"] and gearClone.GearReference.Value.ToolTip ~= "" then
|
if
|
||||||
|
gearClone.GearReference
|
||||||
|
and gearClone.GearReference.Value["ToolTip"]
|
||||||
|
and gearClone.GearReference.Value.ToolTip ~= ""
|
||||||
|
then
|
||||||
showToolTip(gearClone, gearClone.GearReference.Value.ToolTip)
|
showToolTip(gearClone, gearClone.GearReference.Value.ToolTip)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
gearClone.MouseLeave:connect(function()
|
gearClone.MouseLeave:connect(function()
|
||||||
if gearClone.GearReference and gearClone.GearReference.Value["ToolTip"] and gearClone.GearReference.Value.ToolTip ~= "" then
|
if
|
||||||
|
gearClone.GearReference
|
||||||
|
and gearClone.GearReference.Value["ToolTip"]
|
||||||
|
and gearClone.GearReference.Value.ToolTip ~= ""
|
||||||
|
then
|
||||||
hideToolTip(gearClone, gearClone.GearReference.Value.ToolTip)
|
hideToolTip(gearClone, gearClone.GearReference.Value.ToolTip)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
@ -648,14 +745,25 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt
|
||||||
reorganizeLoadout(gearClone, true)
|
reorganizeLoadout(gearClone, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
if gearClone.Parent == nil then debounce = false return end -- couldn't fit in (hopper is full!)
|
if gearClone.Parent == nil then
|
||||||
|
debounce = false
|
||||||
|
return
|
||||||
|
end -- couldn't fit in (hopper is full!)
|
||||||
|
|
||||||
if equipped then
|
if equipped then
|
||||||
gearClone.Selected = true
|
gearClone.Selected = true
|
||||||
unequipAllItems(child)
|
unequipAllItems(child)
|
||||||
delay(guiTweenSpeed + 0.01, function() -- if our gear is equipped, we will want to enlarge it when done moving
|
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
|
if
|
||||||
(gearClone.GearReference.Value:IsA("HopperBin") and gearClone.GearReference.Value.Active == true) ) then
|
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)
|
||||||
|
)
|
||||||
|
then
|
||||||
enlargeButton(gearClone)
|
enlargeButton(gearClone)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
@ -680,13 +788,13 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt
|
||||||
gearClone.ZIndex = 7
|
gearClone.ZIndex = 7
|
||||||
local children = gearClone:GetChildren()
|
local children = gearClone:GetChildren()
|
||||||
for i = 1, #children do
|
for i = 1, #children do
|
||||||
if children[i]:IsA("TextLabel") then
|
if children[i]:IsA "TextLabel" then
|
||||||
if string.find(children[i].Name, "Shadow") then
|
if string.find(children[i].Name, "Shadow") then
|
||||||
children[i].ZIndex = 8
|
children[i].ZIndex = 8
|
||||||
else
|
else
|
||||||
children[i].ZIndex = 9
|
children[i].ZIndex = 9
|
||||||
end
|
end
|
||||||
elseif children[i]:IsA("Frame") or children[i]:IsA("ImageLabel") then
|
elseif children[i]:IsA "Frame" or children[i]:IsA "ImageLabel" then
|
||||||
children[i].ZIndex = 7
|
children[i].ZIndex = 7
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -699,13 +807,13 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt
|
||||||
end
|
end
|
||||||
local children = gearClone:GetChildren()
|
local children = gearClone:GetChildren()
|
||||||
for i = 1, #children do
|
for i = 1, #children do
|
||||||
if children[i]:IsA("TextLabel") then
|
if children[i]:IsA "TextLabel" then
|
||||||
if string.find(children[i].Name, "Shadow") then
|
if string.find(children[i].Name, "Shadow") then
|
||||||
children[i].ZIndex = 3
|
children[i].ZIndex = 3
|
||||||
else
|
else
|
||||||
children[i].ZIndex = 4
|
children[i].ZIndex = 4
|
||||||
end
|
end
|
||||||
elseif children[i]:IsA("Frame") or children[i]:IsA("ImageLabel") then
|
elseif children[i]:IsA "Frame" or children[i]:IsA "ImageLabel" then
|
||||||
children[i].ZIndex = 2
|
children[i].ZIndex = 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -715,21 +823,39 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt
|
||||||
gearClone.Draggable = false
|
gearClone.Draggable = false
|
||||||
end)
|
end)
|
||||||
buttonDeleteCon = gearClone.AncestryChanged:connect(function()
|
buttonDeleteCon = gearClone.AncestryChanged:connect(function()
|
||||||
if gearClone.Parent and gearClone.Parent.Parent == currentLoadout then return end
|
if gearClone.Parent and gearClone.Parent.Parent == currentLoadout then
|
||||||
if clickCon then clickCon:disconnect() end
|
return
|
||||||
if buttonDeleteCon then buttonDeleteCon:disconnect() end
|
end
|
||||||
if mouseEnterCon then mouseEnterCon:disconnect() end
|
if clickCon then
|
||||||
if mouseLeaveCon then mouseLeaveCon:disconnect() end
|
clickCon:disconnect()
|
||||||
if dragStop then dragStop:disconnect() end
|
end
|
||||||
if dragBegin then dragBegin:disconnect() end
|
if buttonDeleteCon then
|
||||||
|
buttonDeleteCon:disconnect()
|
||||||
|
end
|
||||||
|
if mouseEnterCon then
|
||||||
|
mouseEnterCon:disconnect()
|
||||||
|
end
|
||||||
|
if mouseLeaveCon then
|
||||||
|
mouseLeaveCon:disconnect()
|
||||||
|
end
|
||||||
|
if dragStop then
|
||||||
|
dragStop:disconnect()
|
||||||
|
end
|
||||||
|
if dragBegin then
|
||||||
|
dragBegin:disconnect()
|
||||||
|
end
|
||||||
end) -- this probably isn't necessary since objects are being deleted (probably), but this might still leak just in case
|
end) -- this probably isn't necessary since objects are being deleted (probably), but this might still leak just in case
|
||||||
|
|
||||||
local childCon = nil
|
local childCon = nil
|
||||||
local childChangeCon = nil
|
local childChangeCon = nil
|
||||||
childCon = child.AncestryChanged:connect(function(newChild, parent)
|
childCon = child.AncestryChanged:connect(function(newChild, parent)
|
||||||
if not checkToolAncestry(newChild, parent) then
|
if not checkToolAncestry(newChild, parent) then
|
||||||
if childCon then childCon:disconnect() end
|
if childCon then
|
||||||
if childChangeCon then childChangeCon:disconnect() end
|
childCon:disconnect()
|
||||||
|
end
|
||||||
|
if childChangeCon then
|
||||||
|
childChangeCon:disconnect()
|
||||||
|
end
|
||||||
removeFromInventory(child)
|
removeFromInventory(child)
|
||||||
elseif parent == game.Players.LocalPlayer.Backpack then
|
elseif parent == game.Players.LocalPlayer.Backpack then
|
||||||
normalizeButton(gearClone)
|
normalizeButton(gearClone)
|
||||||
|
|
@ -742,7 +868,7 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt
|
||||||
gearClone.GearText.Text = child.Name
|
gearClone.GearText.Text = child.Name
|
||||||
end
|
end
|
||||||
elseif prop == "Active" then
|
elseif prop == "Active" then
|
||||||
if child and child:IsA("HopperBin") then
|
if child and child:IsA "HopperBin" then
|
||||||
if not child.Active then
|
if not child.Active then
|
||||||
gearClone.Selected = false
|
gearClone.Selected = false
|
||||||
normalizeButton(gearClone)
|
normalizeButton(gearClone)
|
||||||
|
|
@ -756,9 +882,11 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt
|
||||||
debounce = false
|
debounce = false
|
||||||
|
|
||||||
Spawn(function()
|
Spawn(function()
|
||||||
while backpackIsOpen() do wait(0.03) end
|
while backpackIsOpen() do
|
||||||
|
wait(0.03)
|
||||||
|
end
|
||||||
for i = 1, #gearSlots do
|
for i = 1, #gearSlots do
|
||||||
if gearSlots[i] ~= 'empty' then
|
if gearSlots[i] ~= "empty" then
|
||||||
backpackButton.Position = UDim2.new(0.5, -60, 1, -108)
|
backpackButton.Position = UDim2.new(0.5, -60, 1, -108)
|
||||||
if backpackEnabled then
|
if backpackEnabled then
|
||||||
backpackButton.Visible = true
|
backpackButton.Visible = true
|
||||||
|
|
@ -770,12 +898,18 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt
|
||||||
end
|
end
|
||||||
|
|
||||||
function addToInventory(child)
|
function addToInventory(child)
|
||||||
if not child:IsA("Tool") or not child:IsA("HopperBin") then return end
|
if not child:IsA "Tool" or not child:IsA "HopperBin" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local slot = nil
|
local slot = nil
|
||||||
for i = 1, #inventory do
|
for i = 1, #inventory do
|
||||||
if inventory[i] and inventory[i] == child then return end
|
if inventory[i] and inventory[i] == child then
|
||||||
if not inventory[i] then slot = i end
|
return
|
||||||
|
end
|
||||||
|
if not inventory[i] then
|
||||||
|
slot = i
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if slot then
|
if slot then
|
||||||
inventory[slot] = child
|
inventory[slot] = child
|
||||||
|
|
@ -799,14 +933,28 @@ local spreadOutGear = function()
|
||||||
loadoutChildren = currentLoadout:GetChildren()
|
loadoutChildren = currentLoadout:GetChildren()
|
||||||
|
|
||||||
for i = 1, #loadoutChildren do
|
for i = 1, #loadoutChildren do
|
||||||
if loadoutChildren[i]:IsA("Frame") then
|
if loadoutChildren[i]:IsA "Frame" then
|
||||||
loadoutChildren[i].BackgroundTransparency = 0.5
|
loadoutChildren[i].BackgroundTransparency = 0.5
|
||||||
local slot = tonumber(string.sub(loadoutChildren[i].Name, 5))
|
local slot = tonumber(string.sub(loadoutChildren[i].Name, 5))
|
||||||
if slot == 0 then slot = 10 end
|
if slot == 0 then
|
||||||
|
slot = 10
|
||||||
|
end
|
||||||
if robloxGui.AbsoluteSize.Y <= 320 then
|
if robloxGui.AbsoluteSize.Y <= 320 then
|
||||||
loadoutChildren[i]:TweenPosition(UDim2.new(0,(slot-1) * 60,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, true)
|
loadoutChildren[i]:TweenPosition(
|
||||||
|
UDim2.new(0, (slot - 1) * 60, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quad,
|
||||||
|
0.25,
|
||||||
|
true
|
||||||
|
)
|
||||||
else
|
else
|
||||||
loadoutChildren[i]:TweenPosition(UDim2.new((slot - 1)/10,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, true)
|
loadoutChildren[i]:TweenPosition(
|
||||||
|
UDim2.new((slot - 1) / 10, 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quad,
|
||||||
|
0.25,
|
||||||
|
true
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -818,7 +966,7 @@ local centerGear = function()
|
||||||
local lastSlotAdd = nil
|
local lastSlotAdd = nil
|
||||||
|
|
||||||
for i = 1, #loadoutChildren do
|
for i = 1, #loadoutChildren do
|
||||||
if loadoutChildren[i]:IsA("Frame") then
|
if loadoutChildren[i]:IsA "Frame" then
|
||||||
if #loadoutChildren[i]:GetChildren() > 0 then
|
if #loadoutChildren[i]:GetChildren() > 0 then
|
||||||
if loadoutChildren[i].Name == "Slot0" then
|
if loadoutChildren[i].Name == "Slot0" then
|
||||||
lastSlotAdd = loadoutChildren[i]
|
lastSlotAdd = loadoutChildren[i]
|
||||||
|
|
@ -829,15 +977,29 @@ local centerGear = function()
|
||||||
loadoutChildren[i].BackgroundTransparency = 1
|
loadoutChildren[i].BackgroundTransparency = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if lastSlotAdd then table.insert(gearButtons,lastSlotAdd) end
|
if lastSlotAdd then
|
||||||
|
table.insert(gearButtons, lastSlotAdd)
|
||||||
|
end
|
||||||
|
|
||||||
local startPos = (1 - (#gearButtons * 0.1)) / 2
|
local startPos = (1 - (#gearButtons * 0.1)) / 2
|
||||||
for i = 1, #gearButtons do
|
for i = 1, #gearButtons do
|
||||||
if robloxGui.AbsoluteSize.Y <= 320 then
|
if robloxGui.AbsoluteSize.Y <= 320 then
|
||||||
startPos = (0.5 - (#gearButtons * 0.333) / 2)
|
startPos = (0.5 - (#gearButtons * 0.333) / 2)
|
||||||
gearButtons[i]:TweenPosition(UDim2.new(startPos + (i-1) * 0.33, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, true)
|
gearButtons[i]:TweenPosition(
|
||||||
|
UDim2.new(startPos + (i - 1) * 0.33, 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quad,
|
||||||
|
0.25,
|
||||||
|
true
|
||||||
|
)
|
||||||
else
|
else
|
||||||
gearButtons[i]:TweenPosition(UDim2.new(startPos + ((i - 1) * 0.1),0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, true)
|
gearButtons[i]:TweenPosition(
|
||||||
|
UDim2.new(startPos + ((i - 1) * 0.1), 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quad,
|
||||||
|
0.25,
|
||||||
|
true
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -856,7 +1018,10 @@ function readonlyLoadout()
|
||||||
end
|
end
|
||||||
|
|
||||||
function setupBackpackListener()
|
function setupBackpackListener()
|
||||||
if backpackChildCon then backpackChildCon:disconnect() backpackChildCon = nil end
|
if backpackChildCon then
|
||||||
|
backpackChildCon:disconnect()
|
||||||
|
backpackChildCon = nil
|
||||||
|
end
|
||||||
backpackChildCon = player.Backpack.ChildAdded:connect(function(child)
|
backpackChildCon = player.Backpack.ChildAdded:connect(function(child)
|
||||||
if not firstInstanceOfLoadout then
|
if not firstInstanceOfLoadout then
|
||||||
firstInstanceOfLoadout = true
|
firstInstanceOfLoadout = true
|
||||||
|
|
@ -911,11 +1076,6 @@ function coreGuiChanged(coreGuiType,enabled)
|
||||||
end
|
end
|
||||||
-- End Functions
|
-- End Functions
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Begin Script
|
-- Begin Script
|
||||||
registerNumberKeys()
|
registerNumberKeys()
|
||||||
|
|
||||||
|
|
@ -951,7 +1111,7 @@ delay(2, function()
|
||||||
local cChildren = currentLoadout:GetChildren()
|
local cChildren = currentLoadout:GetChildren()
|
||||||
for i = 1, #cChildren do
|
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
|
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
|
end
|
||||||
|
|
@ -962,7 +1122,7 @@ delay(2, function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
player.ChildAdded:connect(function(child)
|
player.ChildAdded:connect(function(child)
|
||||||
if child:IsA('PlayerGui') then
|
if child:IsA "PlayerGui" then
|
||||||
moveHealthBar(child)
|
moveHealthBar(child)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
@ -971,13 +1131,21 @@ waitForProperty(player,"Character")
|
||||||
for i, v in ipairs(player.Character:GetChildren()) do
|
for i, v in ipairs(player.Character:GetChildren()) do
|
||||||
playerCharacterChildAdded(v)
|
playerCharacterChildAdded(v)
|
||||||
end
|
end
|
||||||
characterChildAddedCon = player.Character.ChildAdded:connect(function(child) playerCharacterChildAdded(child) end)
|
characterChildAddedCon = player.Character.ChildAdded:connect(function(child)
|
||||||
|
playerCharacterChildAdded(child)
|
||||||
|
end)
|
||||||
|
|
||||||
waitForChild(player.Character, "Humanoid")
|
waitForChild(player.Character, "Humanoid")
|
||||||
humanoidDiedCon = player.Character.Humanoid.Died:connect(function()
|
humanoidDiedCon = player.Character.Humanoid.Died:connect(function()
|
||||||
if humanoidDiedCon then humanoidDiedCon:disconnect() humanoidDiedCon = nil end
|
if humanoidDiedCon then
|
||||||
|
humanoidDiedCon:disconnect()
|
||||||
|
humanoidDiedCon = nil
|
||||||
|
end
|
||||||
deactivateLoadout()
|
deactivateLoadout()
|
||||||
if backpackChildCon then backpackChildCon:disconnect() backpackChildCon = nil end
|
if backpackChildCon then
|
||||||
|
backpackChildCon:disconnect()
|
||||||
|
backpackChildCon = nil
|
||||||
|
end
|
||||||
backpackWasOpened = false
|
backpackWasOpened = false
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
@ -995,7 +1163,6 @@ player.CharacterAdded:connect(function()
|
||||||
player = game.Players.LocalPlayer -- make sure we are still looking at the correct character
|
player = game.Players.LocalPlayer -- make sure we are still looking at the correct character
|
||||||
waitForChild(player, "Backpack")
|
waitForChild(player, "Backpack")
|
||||||
|
|
||||||
|
|
||||||
delay(1, function()
|
delay(1, function()
|
||||||
local backpackChildren = player.Backpack:GetChildren()
|
local backpackChildren = player.Backpack:GetChildren()
|
||||||
local size = math.min(10, #backpackChildren)
|
local size = math.min(10, #backpackChildren)
|
||||||
|
|
@ -1016,8 +1183,7 @@ player.CharacterAdded:connect(function()
|
||||||
characterChildAddedCon = nil
|
characterChildAddedCon = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
characterChildAddedCon =
|
characterChildAddedCon = player.Character.ChildAdded:connect(function(child)
|
||||||
player.Character.ChildAdded:connect(function(child)
|
|
||||||
addingPlayerChild(child, true)
|
addingPlayerChild(child, true)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
@ -1025,8 +1191,7 @@ player.CharacterAdded:connect(function()
|
||||||
if backpack.Visible then
|
if backpack.Visible then
|
||||||
backpackOpenEvent:Fire()
|
backpackOpenEvent:Fire()
|
||||||
end
|
end
|
||||||
humanoidDiedCon =
|
humanoidDiedCon = player.Character.Humanoid.Died:connect(function()
|
||||||
player.Character.Humanoid.Died:connect(function()
|
|
||||||
if backpackEnabled then
|
if backpackEnabled then
|
||||||
backpackButton.Visible = false
|
backpackButton.Visible = false
|
||||||
clBackground.Visible = false
|
clBackground.Visible = false
|
||||||
|
|
@ -1034,10 +1199,16 @@ player.CharacterAdded:connect(function()
|
||||||
firstInstanceOfLoadout = false
|
firstInstanceOfLoadout = false
|
||||||
deactivateLoadout()
|
deactivateLoadout()
|
||||||
|
|
||||||
if humanoidDiedCon then humanoidDiedCon:disconnect() humanoidDiedCon = nil end
|
if humanoidDiedCon then
|
||||||
if backpackChildCon then backpackChildCon:disconnect() backpackChildCon = nil end
|
humanoidDiedCon:disconnect()
|
||||||
|
humanoidDiedCon = nil
|
||||||
|
end
|
||||||
|
if backpackChildCon then
|
||||||
|
backpackChildCon:disconnect()
|
||||||
|
backpackChildCon = nil
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
waitForChild(player, 'PlayerGui')
|
waitForChild(player, "PlayerGui")
|
||||||
moveHealthBar(player.PlayerGui)
|
moveHealthBar(player.PlayerGui)
|
||||||
delay(2, function()
|
delay(2, function()
|
||||||
--while true do
|
--while true do
|
||||||
|
|
@ -1046,7 +1217,7 @@ player.CharacterAdded:connect(function()
|
||||||
local cChildren = currentLoadout:GetChildren()
|
local cChildren = currentLoadout:GetChildren()
|
||||||
for i = 1, #cChildren do
|
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
|
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
|
end
|
||||||
|
|
@ -1062,7 +1233,9 @@ guiBackpack.SwapSlot.Changed:connect(function()
|
||||||
if guiBackpack.SwapSlot.Value then
|
if guiBackpack.SwapSlot.Value then
|
||||||
local swapSlot = guiBackpack.SwapSlot
|
local swapSlot = guiBackpack.SwapSlot
|
||||||
local pos = swapSlot.Slot.Value
|
local pos = swapSlot.Slot.Value
|
||||||
if pos == 0 then pos = 10 end
|
if pos == 0 then
|
||||||
|
pos = 10
|
||||||
|
end
|
||||||
if gearSlots[pos] then
|
if gearSlots[pos] then
|
||||||
reorganizeLoadout(gearSlots[pos], false)
|
reorganizeLoadout(gearSlots[pos], false)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
|
|
||||||
432
60595411.lua
432
60595411.lua
|
|
@ -1,7 +1,5 @@
|
||||||
local t = {}
|
local t = {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
@ -47,9 +45,8 @@ local ipairs = ipairs
|
||||||
local assert = assert
|
local assert = assert
|
||||||
local Chipmunk = Chipmunk
|
local Chipmunk = Chipmunk
|
||||||
|
|
||||||
|
|
||||||
local StringBuilder = {
|
local StringBuilder = {
|
||||||
buffer = {}
|
buffer = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
function StringBuilder:New()
|
function StringBuilder:New()
|
||||||
|
|
@ -70,15 +67,15 @@ end
|
||||||
|
|
||||||
local JsonWriter = {
|
local JsonWriter = {
|
||||||
backslashes = {
|
backslashes = {
|
||||||
['\b'] = "\\b",
|
["\b"] = "\\b",
|
||||||
['\t'] = "\\t",
|
["\t"] = "\\t",
|
||||||
['\n'] = "\\n",
|
["\n"] = "\\n",
|
||||||
['\f'] = "\\f",
|
["\f"] = "\\f",
|
||||||
['\r'] = "\\r",
|
["\r"] = "\\r",
|
||||||
['"'] = "\\\"",
|
['"'] = '\\"',
|
||||||
['\\'] = "\\\\",
|
["\\"] = "\\\\",
|
||||||
['/'] = "\\/"
|
["/"] = "\\/",
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function JsonWriter:New()
|
function JsonWriter:New()
|
||||||
|
|
@ -119,7 +116,7 @@ function JsonWriter:Write(o)
|
||||||
end
|
end
|
||||||
|
|
||||||
function JsonWriter:WriteNil()
|
function JsonWriter:WriteNil()
|
||||||
self:Append("null")
|
self:Append "null"
|
||||||
end
|
end
|
||||||
|
|
||||||
function JsonWriter:WriteString(o)
|
function JsonWriter:WriteString(o)
|
||||||
|
|
@ -127,13 +124,15 @@ function JsonWriter:WriteString(o)
|
||||||
end
|
end
|
||||||
|
|
||||||
function JsonWriter:ParseString(s)
|
function JsonWriter:ParseString(s)
|
||||||
self:Append('"')
|
self:Append '"'
|
||||||
self:Append(string.gsub(s, "[%z%c\\\"/]", function(n)
|
self:Append(string.gsub(s, '[%z%c\\"/]', function(n)
|
||||||
local c = self.backslashes[n]
|
local c = self.backslashes[n]
|
||||||
if c then return c end
|
if c then
|
||||||
|
return c
|
||||||
|
end
|
||||||
return string.format("\\u%.4X", string.byte(n))
|
return string.format("\\u%.4X", string.byte(n))
|
||||||
end))
|
end))
|
||||||
self:Append('"')
|
self:Append '"'
|
||||||
end
|
end
|
||||||
|
|
||||||
function JsonWriter:IsArray(t)
|
function JsonWriter:IsArray(t)
|
||||||
|
|
@ -148,12 +147,12 @@ function JsonWriter:IsArray(t)
|
||||||
end
|
end
|
||||||
for k, v in pairs(t) do
|
for k, v in pairs(t) do
|
||||||
if not isindex(k) then
|
if not isindex(k) then
|
||||||
return false, '{', '}'
|
return false, "{", "}"
|
||||||
else
|
else
|
||||||
count = math.max(count, k)
|
count = math.max(count, k)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return true, '[', ']', count
|
return true, "[", "]", count
|
||||||
end
|
end
|
||||||
|
|
||||||
function JsonWriter:WriteTable(t)
|
function JsonWriter:WriteTable(t)
|
||||||
|
|
@ -163,18 +162,18 @@ function JsonWriter:WriteTable(t)
|
||||||
for i = 1, n do
|
for i = 1, n do
|
||||||
self:Write(t[i])
|
self:Write(t[i])
|
||||||
if i < n then
|
if i < n then
|
||||||
self:Append(',')
|
self:Append ","
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local first = true;
|
local first = true
|
||||||
for k, v in pairs(t) do
|
for k, v in pairs(t) do
|
||||||
if not first then
|
if not first then
|
||||||
self:Append(',')
|
self:Append ","
|
||||||
end
|
end
|
||||||
first = false;
|
first = false
|
||||||
self:ParseString(k)
|
self:ParseString(k)
|
||||||
self:Append(':')
|
self:Append ":"
|
||||||
self:Write(v)
|
self:Write(v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -182,9 +181,7 @@ function JsonWriter:WriteTable(t)
|
||||||
end
|
end
|
||||||
|
|
||||||
function JsonWriter:WriteError(o)
|
function JsonWriter:WriteError(o)
|
||||||
error(string.format(
|
error(string.format("Encoding of %s unsupported", tostring(o)))
|
||||||
"Encoding of %s unsupported",
|
|
||||||
tostring(o)))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function JsonWriter:WriteFunction(o)
|
function JsonWriter:WriteFunction(o)
|
||||||
|
|
@ -197,7 +194,7 @@ end
|
||||||
|
|
||||||
local StringReader = {
|
local StringReader = {
|
||||||
s = "",
|
s = "",
|
||||||
i = 0
|
i = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
function StringReader:New(s)
|
function StringReader:New(s)
|
||||||
|
|
@ -230,12 +227,12 @@ end
|
||||||
|
|
||||||
local JsonReader = {
|
local JsonReader = {
|
||||||
escapes = {
|
escapes = {
|
||||||
['t'] = '\t',
|
["t"] = "\t",
|
||||||
['n'] = '\n',
|
["n"] = "\n",
|
||||||
['f'] = '\f',
|
["f"] = "\f",
|
||||||
['r'] = '\r',
|
["r"] = "\r",
|
||||||
['b'] = '\b',
|
["b"] = "\b",
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function JsonReader:New(s)
|
function JsonReader:New(s)
|
||||||
|
|
@ -243,31 +240,29 @@ function JsonReader:New(s)
|
||||||
o.reader = StringReader:New(s)
|
o.reader = StringReader:New(s)
|
||||||
setmetatable(o, self)
|
setmetatable(o, self)
|
||||||
self.__index = self
|
self.__index = self
|
||||||
return o;
|
return o
|
||||||
end
|
end
|
||||||
|
|
||||||
function JsonReader:Read()
|
function JsonReader:Read()
|
||||||
self:SkipWhiteSpace()
|
self:SkipWhiteSpace()
|
||||||
local peek = self:Peek()
|
local peek = self:Peek()
|
||||||
if peek == nil then
|
if peek == nil then
|
||||||
error(string.format(
|
error(string.format("Nil string: '%s'", self:All()))
|
||||||
"Nil string: '%s'",
|
elseif peek == "{" then
|
||||||
self:All()))
|
|
||||||
elseif peek == '{' then
|
|
||||||
return self:ReadObject()
|
return self:ReadObject()
|
||||||
elseif peek == '[' then
|
elseif peek == "[" then
|
||||||
return self:ReadArray()
|
return self:ReadArray()
|
||||||
elseif peek == '"' then
|
elseif peek == '"' then
|
||||||
return self:ReadString()
|
return self:ReadString()
|
||||||
elseif string.find(peek, "[%+%-%d]") then
|
elseif string.find(peek, "[%+%-%d]") then
|
||||||
return self:ReadNumber()
|
return self:ReadNumber()
|
||||||
elseif peek == 't' then
|
elseif peek == "t" then
|
||||||
return self:ReadTrue()
|
return self:ReadTrue()
|
||||||
elseif peek == 'f' then
|
elseif peek == "f" then
|
||||||
return self:ReadFalse()
|
return self:ReadFalse()
|
||||||
elseif peek == 'n' then
|
elseif peek == "n" then
|
||||||
return self:ReadNull()
|
return self:ReadNull()
|
||||||
elseif peek == '/' then
|
elseif peek == "/" then
|
||||||
self:ReadComment()
|
self:ReadComment()
|
||||||
return self:Read()
|
return self:Read()
|
||||||
else
|
else
|
||||||
|
|
@ -276,27 +271,24 @@ function JsonReader:Read()
|
||||||
end
|
end
|
||||||
|
|
||||||
function JsonReader:ReadTrue()
|
function JsonReader:ReadTrue()
|
||||||
self:TestReservedWord{'t','r','u','e'}
|
self:TestReservedWord { "t", "r", "u", "e" }
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function JsonReader:ReadFalse()
|
function JsonReader:ReadFalse()
|
||||||
self:TestReservedWord{'f','a','l','s','e'}
|
self:TestReservedWord { "f", "a", "l", "s", "e" }
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function JsonReader:ReadNull()
|
function JsonReader:ReadNull()
|
||||||
self:TestReservedWord{'n','u','l','l'}
|
self:TestReservedWord { "n", "u", "l", "l" }
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function JsonReader:TestReservedWord(t)
|
function JsonReader:TestReservedWord(t)
|
||||||
for i, v in ipairs(t) do
|
for i, v in ipairs(t) do
|
||||||
if self:Next() ~= v then
|
if self:Next() ~= v then
|
||||||
error(string.format(
|
error(string.format("Error reading '%s': %s", table.concat(t), self:All()))
|
||||||
"Error reading '%s': %s",
|
|
||||||
table.concat(t),
|
|
||||||
self:All()))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -304,17 +296,13 @@ end
|
||||||
function JsonReader:ReadNumber()
|
function JsonReader:ReadNumber()
|
||||||
local result = self:Next()
|
local result = self:Next()
|
||||||
local peek = self:Peek()
|
local peek = self:Peek()
|
||||||
while peek ~= nil and string.find(
|
while peek ~= nil and string.find(peek, "[%+%-%d%.eE]") do
|
||||||
peek,
|
|
||||||
"[%+%-%d%.eE]") do
|
|
||||||
result = result .. self:Next()
|
result = result .. self:Next()
|
||||||
peek = self:Peek()
|
peek = self:Peek()
|
||||||
end
|
end
|
||||||
result = tonumber(result)
|
result = tonumber(result)
|
||||||
if result == nil then
|
if result == nil then
|
||||||
error(string.format(
|
error(string.format("Invalid number: '%s'", result))
|
||||||
"Invalid number: '%s'",
|
|
||||||
result))
|
|
||||||
else
|
else
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
@ -325,7 +313,7 @@ function JsonReader:ReadString()
|
||||||
assert(self:Next() == '"')
|
assert(self:Next() == '"')
|
||||||
while self:Peek() ~= '"' do
|
while self:Peek() ~= '"' do
|
||||||
local ch = self:Next()
|
local ch = self:Next()
|
||||||
if ch == '\\' then
|
if ch == "\\" then
|
||||||
ch = self:Next()
|
ch = self:Next()
|
||||||
if self.escapes[ch] then
|
if self.escapes[ch] then
|
||||||
ch = self.escapes[ch]
|
ch = self.escapes[ch]
|
||||||
|
|
@ -337,23 +325,18 @@ function JsonReader:ReadString()
|
||||||
local fromunicode = function(m)
|
local fromunicode = function(m)
|
||||||
return string.char(tonumber(m, 16))
|
return string.char(tonumber(m, 16))
|
||||||
end
|
end
|
||||||
return string.gsub(
|
return string.gsub(result, "u%x%x(%x%x)", fromunicode)
|
||||||
result,
|
|
||||||
"u%x%x(%x%x)",
|
|
||||||
fromunicode)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function JsonReader:ReadComment()
|
function JsonReader:ReadComment()
|
||||||
assert(self:Next() == '/')
|
assert(self:Next() == "/")
|
||||||
local second = self:Next()
|
local second = self:Next()
|
||||||
if second == '/' then
|
if second == "/" then
|
||||||
self:ReadSingleLineComment()
|
self:ReadSingleLineComment()
|
||||||
elseif second == '*' then
|
elseif second == "*" then
|
||||||
self:ReadBlockComment()
|
self:ReadBlockComment()
|
||||||
else
|
else
|
||||||
error(string.format(
|
error(string.format("Invalid comment: %s", self:All()))
|
||||||
"Invalid comment: %s",
|
|
||||||
self:All()))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -361,15 +344,11 @@ function JsonReader:ReadBlockComment()
|
||||||
local done = false
|
local done = false
|
||||||
while not done do
|
while not done do
|
||||||
local ch = self:Next()
|
local ch = self:Next()
|
||||||
if ch == '*' and self:Peek() == '/' then
|
if ch == "*" and self:Peek() == "/" then
|
||||||
done = true
|
done = true
|
||||||
end
|
end
|
||||||
if not done and
|
if not done and ch == "/" and self:Peek() == "*" then
|
||||||
ch == '/' and
|
error(string.format("Invalid comment: %s, '/*' illegal.", self:All()))
|
||||||
self:Peek() == "*" then
|
|
||||||
error(string.format(
|
|
||||||
"Invalid comment: %s, '/*' illegal.",
|
|
||||||
self:All()))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self:Next()
|
self:Next()
|
||||||
|
|
@ -377,74 +356,64 @@ end
|
||||||
|
|
||||||
function JsonReader:ReadSingleLineComment()
|
function JsonReader:ReadSingleLineComment()
|
||||||
local ch = self:Next()
|
local ch = self:Next()
|
||||||
while ch ~= '\r' and ch ~= '\n' do
|
while ch ~= "\r" and ch ~= "\n" do
|
||||||
ch = self:Next()
|
ch = self:Next()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function JsonReader:ReadArray()
|
function JsonReader:ReadArray()
|
||||||
local result = {}
|
local result = {}
|
||||||
assert(self:Next() == '[')
|
assert(self:Next() == "[")
|
||||||
local done = false
|
local done = false
|
||||||
if self:Peek() == ']' then
|
if self:Peek() == "]" then
|
||||||
done = true;
|
done = true
|
||||||
end
|
end
|
||||||
while not done do
|
while not done do
|
||||||
local item = self:Read()
|
local item = self:Read()
|
||||||
result[#result + 1] = item
|
result[#result + 1] = item
|
||||||
self:SkipWhiteSpace()
|
self:SkipWhiteSpace()
|
||||||
if self:Peek() == ']' then
|
if self:Peek() == "]" then
|
||||||
done = true
|
done = true
|
||||||
end
|
end
|
||||||
if not done then
|
if not done then
|
||||||
local ch = self:Next()
|
local ch = self:Next()
|
||||||
if ch ~= ',' then
|
if ch ~= "," then
|
||||||
error(string.format(
|
error(string.format("Invalid array: '%s' due to: '%s'", self:All(), ch))
|
||||||
"Invalid array: '%s' due to: '%s'",
|
|
||||||
self:All(), ch))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
assert(']' == self:Next())
|
assert("]" == self:Next())
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function JsonReader:ReadObject()
|
function JsonReader:ReadObject()
|
||||||
local result = {}
|
local result = {}
|
||||||
assert(self:Next() == '{')
|
assert(self:Next() == "{")
|
||||||
local done = false
|
local done = false
|
||||||
if self:Peek() == '}' then
|
if self:Peek() == "}" then
|
||||||
done = true
|
done = true
|
||||||
end
|
end
|
||||||
while not done do
|
while not done do
|
||||||
local key = self:Read()
|
local key = self:Read()
|
||||||
if type(key) ~= "string" then
|
if type(key) ~= "string" then
|
||||||
error(string.format(
|
error(string.format("Invalid non-string object key: %s", key))
|
||||||
"Invalid non-string object key: %s",
|
|
||||||
key))
|
|
||||||
end
|
end
|
||||||
self:SkipWhiteSpace()
|
self:SkipWhiteSpace()
|
||||||
local ch = self:Next()
|
local ch = self:Next()
|
||||||
if ch ~= ':' then
|
if ch ~= ":" then
|
||||||
error(string.format(
|
error(string.format("Invalid object: '%s' due to: '%s'", self:All(), ch))
|
||||||
"Invalid object: '%s' due to: '%s'",
|
|
||||||
self:All(),
|
|
||||||
ch))
|
|
||||||
end
|
end
|
||||||
self:SkipWhiteSpace()
|
self:SkipWhiteSpace()
|
||||||
local val = self:Read()
|
local val = self:Read()
|
||||||
result[key] = val
|
result[key] = val
|
||||||
self:SkipWhiteSpace()
|
self:SkipWhiteSpace()
|
||||||
if self:Peek() == '}' then
|
if self:Peek() == "}" then
|
||||||
done = true
|
done = true
|
||||||
end
|
end
|
||||||
if not done then
|
if not done then
|
||||||
ch = self:Next()
|
ch = self:Next()
|
||||||
if ch ~= ',' then
|
if ch ~= "," then
|
||||||
error(string.format(
|
error(string.format("Invalid array: '%s' near: '%s'", self:All(), ch))
|
||||||
"Invalid array: '%s' near: '%s'",
|
|
||||||
self:All(),
|
|
||||||
ch))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -455,7 +424,7 @@ end
|
||||||
function JsonReader:SkipWhiteSpace()
|
function JsonReader:SkipWhiteSpace()
|
||||||
local p = self:Peek()
|
local p = self:Peek()
|
||||||
while p ~= nil and string.find(p, "[%s/]") do
|
while p ~= nil and string.find(p, "[%s/]") do
|
||||||
if p == '/' then
|
if p == "/" then
|
||||||
self:ReadComment()
|
self:ReadComment()
|
||||||
else
|
else
|
||||||
self:Next()
|
self:Next()
|
||||||
|
|
@ -492,12 +461,11 @@ function Null()
|
||||||
end
|
end
|
||||||
-------------------- End JSON Parser ------------------------
|
-------------------- End JSON Parser ------------------------
|
||||||
|
|
||||||
|
|
||||||
t.DecodeJSON = function(jsonString)
|
t.DecodeJSON = function(jsonString)
|
||||||
if type(jsonString) == "string" then
|
if type(jsonString) == "string" then
|
||||||
return Decode(jsonString)
|
return Decode(jsonString)
|
||||||
end
|
end
|
||||||
print("RbxUtil.DecodeJSON expects string argument!")
|
print "RbxUtil.DecodeJSON expects string argument!"
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -505,13 +473,6 @@ t.EncodeJSON = function(jsonTable)
|
||||||
return Encode(jsonTable)
|
return Encode(jsonTable)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
@ -527,8 +488,10 @@ t.MakeWedge = function(x, y, z, defaultmaterial)
|
||||||
end
|
end
|
||||||
|
|
||||||
t.SelectTerrainRegion = function(regionToSelect, color, selectEmptyCells, selectionParent)
|
t.SelectTerrainRegion = function(regionToSelect, color, selectEmptyCells, selectionParent)
|
||||||
local terrain = game.Workspace:FindFirstChild("Terrain")
|
local terrain = game.Workspace:FindFirstChild "Terrain"
|
||||||
if not terrain then return end
|
if not terrain then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
assert(regionToSelect)
|
assert(regionToSelect)
|
||||||
assert(color)
|
assert(color)
|
||||||
|
|
@ -547,7 +510,7 @@ t.SelectTerrainRegion = function(regionToSelect, color, selectEmptyCells, select
|
||||||
local emptyMaterial = Enum.CellMaterial.Empty
|
local emptyMaterial = Enum.CellMaterial.Empty
|
||||||
|
|
||||||
-- container for all adornments, passed back to user
|
-- container for all adornments, passed back to user
|
||||||
local selectionContainer = Instance.new("Model")
|
local selectionContainer = Instance.new "Model"
|
||||||
selectionContainer.Name = "SelectionContainer"
|
selectionContainer.Name = "SelectionContainer"
|
||||||
selectionContainer.Archivable = false
|
selectionContainer.Archivable = false
|
||||||
if selectionParent then
|
if selectionParent then
|
||||||
|
|
@ -563,7 +526,7 @@ t.SelectTerrainRegion = function(regionToSelect, color, selectEmptyCells, select
|
||||||
local adornments = {} -- contains all adornments
|
local adornments = {} -- contains all adornments
|
||||||
local reusableAdorns = {}
|
local reusableAdorns = {}
|
||||||
|
|
||||||
local selectionPart = Instance.new("Part")
|
local selectionPart = Instance.new "Part"
|
||||||
selectionPart.Name = "SelectionPart"
|
selectionPart.Name = "SelectionPart"
|
||||||
selectionPart.Transparency = 1
|
selectionPart.Transparency = 1
|
||||||
selectionPart.Anchored = true
|
selectionPart.Anchored = true
|
||||||
|
|
@ -572,7 +535,7 @@ t.SelectTerrainRegion = function(regionToSelect, color, selectEmptyCells, select
|
||||||
selectionPart.FormFactor = Enum.FormFactor.Custom
|
selectionPart.FormFactor = Enum.FormFactor.Custom
|
||||||
selectionPart.Size = Vector3.new(4.2, 4.2, 4.2)
|
selectionPart.Size = Vector3.new(4.2, 4.2, 4.2)
|
||||||
|
|
||||||
local selectionBox = Instance.new("SelectionBox")
|
local selectionBox = Instance.new "SelectionBox"
|
||||||
|
|
||||||
-- srs translation from region3 to region3int16
|
-- srs translation from region3 to region3int16
|
||||||
function Region3ToRegion3int16(region3)
|
function Region3ToRegion3int16(region3)
|
||||||
|
|
@ -624,7 +587,6 @@ t.SelectTerrainRegion = function(regionToSelect, color, selectEmptyCells, select
|
||||||
-- iterates through all current adornments and deletes any that don't have latest tag
|
-- iterates through all current adornments and deletes any that don't have latest tag
|
||||||
function cleanUpAdornments()
|
function cleanUpAdornments()
|
||||||
for cellPos, adornTable in pairs(adornments) do
|
for cellPos, adornTable in pairs(adornments) do
|
||||||
|
|
||||||
if adornTable.KeepAlive ~= currentKeepAliveTag then -- old news, we should get rid of this
|
if adornTable.KeepAlive ~= currentKeepAliveTag then -- old news, we should get rid of this
|
||||||
adornTable.SelectionBox.Visible = false
|
adornTable.SelectionBox.Visible = false
|
||||||
table.insert(reusableAdorns, { part = adornTable.SelectionPart, box = adornTable.SelectionBox })
|
table.insert(reusableAdorns, { part = adornTable.SelectionPart, box = adornTable.SelectionBox })
|
||||||
|
|
@ -676,7 +638,11 @@ t.SelectTerrainRegion = function(regionToSelect, color, selectEmptyCells, select
|
||||||
local selectionPart, selectionBox = createAdornment(color)
|
local selectionPart, selectionBox = createAdornment(color)
|
||||||
selectionPart.Size = Vector3.new(4, 4, 4)
|
selectionPart.Size = Vector3.new(4, 4, 4)
|
||||||
selectionPart.CFrame = CFrame.new(cframePos)
|
selectionPart.CFrame = CFrame.new(cframePos)
|
||||||
local adornTable = {SelectionPart = selectionPart, SelectionBox = selectionBox, KeepAlive = currentKeepAliveTag}
|
local adornTable = {
|
||||||
|
SelectionPart = selectionPart,
|
||||||
|
SelectionBox = selectionBox,
|
||||||
|
KeepAlive = currentKeepAliveTag,
|
||||||
|
}
|
||||||
adornments[cellPos] = adornTable
|
adornments[cellPos] = adornTable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -686,7 +652,6 @@ t.SelectTerrainRegion = function(regionToSelect, color, selectEmptyCells, select
|
||||||
cleanUpAdornments()
|
cleanUpAdornments()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
------------------------------------- setup code ------------------------------
|
------------------------------------- setup code ------------------------------
|
||||||
lastRegion = regionToSelect
|
lastRegion = regionToSelect
|
||||||
|
|
||||||
|
|
@ -699,8 +664,7 @@ t.SelectTerrainRegion = function(regionToSelect, color, selectEmptyCells, select
|
||||||
adornments.SelectionPart = selectionPart
|
adornments.SelectionPart = selectionPart
|
||||||
adornments.SelectionBox = selectionBox
|
adornments.SelectionBox = selectionBox
|
||||||
|
|
||||||
updateSelection =
|
updateSelection = function(newRegion, color)
|
||||||
function (newRegion, color)
|
|
||||||
if newRegion and newRegion ~= lastRegion then
|
if newRegion and newRegion ~= lastRegion then
|
||||||
lastRegion = newRegion
|
lastRegion = newRegion
|
||||||
selectionPart.Size = newRegion.Size
|
selectionPart.Size = newRegion.Size
|
||||||
|
|
@ -712,19 +676,19 @@ t.SelectTerrainRegion = function(regionToSelect, color, selectEmptyCells, select
|
||||||
end
|
end
|
||||||
else -- use individual cell adorns to represent the area selected
|
else -- use individual cell adorns to represent the area selected
|
||||||
adornFullCellsInRegion(regionToSelect, color)
|
adornFullCellsInRegion(regionToSelect, color)
|
||||||
updateSelection =
|
updateSelection = function(newRegion, color)
|
||||||
function (newRegion, color)
|
|
||||||
if newRegion and newRegion ~= lastRegion then
|
if newRegion and newRegion ~= lastRegion then
|
||||||
lastRegion = newRegion
|
lastRegion = newRegion
|
||||||
adornFullCellsInRegion(newRegion, color)
|
adornFullCellsInRegion(newRegion, color)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local destroyFunc = function()
|
local destroyFunc = function()
|
||||||
updateSelection = nil
|
updateSelection = nil
|
||||||
if selectionContainer then selectionContainer:Destroy() end
|
if selectionContainer then
|
||||||
|
selectionContainer:Destroy()
|
||||||
|
end
|
||||||
adornments = nil
|
adornments = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -733,12 +697,6 @@ end
|
||||||
|
|
||||||
-----------------------------Terrain Utilities End-----------------------------
|
-----------------------------Terrain Utilities End-----------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
@ -777,13 +735,15 @@ Method :wait()
|
||||||
function t.CreateSignal()
|
function t.CreateSignal()
|
||||||
local this = {}
|
local this = {}
|
||||||
|
|
||||||
local mBindableEvent = Instance.new('BindableEvent')
|
local mBindableEvent = Instance.new "BindableEvent"
|
||||||
local mAllCns = {} --all connection objects returned by mBindableEvent::connect
|
local mAllCns = {} --all connection objects returned by mBindableEvent::connect
|
||||||
|
|
||||||
--main functions
|
--main functions
|
||||||
function this:connect(func)
|
function this:connect(func)
|
||||||
if self ~= this then error("connect must be called with `:`, not `.`", 2) end
|
if self ~= this then
|
||||||
if type(func) ~= 'function' then
|
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
|
end
|
||||||
local cn = mBindableEvent.Event:connect(func)
|
local cn = mBindableEvent.Event:connect(func)
|
||||||
|
|
@ -796,18 +756,24 @@ function t.CreateSignal()
|
||||||
return pubCn
|
return pubCn
|
||||||
end
|
end
|
||||||
function this:disconnect()
|
function this:disconnect()
|
||||||
if self ~= this then error("disconnect must be called with `:`, not `.`", 2) end
|
if self ~= this then
|
||||||
|
error("disconnect must be called with `:`, not `.`", 2)
|
||||||
|
end
|
||||||
for cn, _ in pairs(mAllCns) do
|
for cn, _ in pairs(mAllCns) do
|
||||||
cn:disconnect()
|
cn:disconnect()
|
||||||
mAllCns[cn] = nil
|
mAllCns[cn] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function this:wait()
|
function this:wait()
|
||||||
if self ~= this then error("wait must be called with `:`, not `.`", 2) end
|
if self ~= this then
|
||||||
|
error("wait must be called with `:`, not `.`", 2)
|
||||||
|
end
|
||||||
return mBindableEvent.Event:wait()
|
return mBindableEvent.Event:wait()
|
||||||
end
|
end
|
||||||
function this:fire(...)
|
function this:fire(...)
|
||||||
if self ~= this then error("fire must be called with `:`, not `.`", 2) end
|
if self ~= this then
|
||||||
|
error("fire must be called with `:`, not `.`", 2)
|
||||||
|
end
|
||||||
mBindableEvent:Fire(...)
|
mBindableEvent:Fire(...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -816,9 +782,6 @@ end
|
||||||
|
|
||||||
------------------------------------------------- Sigal class End ------------------------------------------------------
|
------------------------------------------------- Sigal class End ------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
@ -913,7 +876,7 @@ Note: It is also perfectly legal to save a reference to the function returned by
|
||||||
--the Create function need to be created as a functor, not a function, in order to support the Create.E syntax, so it
|
--the Create function need to be created as a functor, not a function, in order to support the Create.E syntax, so it
|
||||||
--will be created in several steps rather than as a single function declaration.
|
--will be created in several steps rather than as a single function declaration.
|
||||||
local function Create_PrivImpl(objectType)
|
local function Create_PrivImpl(objectType)
|
||||||
if type(objectType) ~= 'string' then
|
if type(objectType) ~= "string" then
|
||||||
error("Argument of Create must be a string", 2)
|
error("Argument of Create must be a string", 2)
|
||||||
end
|
end
|
||||||
--return the proxy function that gives us the nice Create'string'{data} syntax
|
--return the proxy function that gives us the nice Create'string'{data} syntax
|
||||||
|
|
@ -932,39 +895,42 @@ local function Create_PrivImpl(objectType)
|
||||||
|
|
||||||
for k, v in pairs(dat) do
|
for k, v in pairs(dat) do
|
||||||
--add property
|
--add property
|
||||||
if type(k) == 'string' then
|
if type(k) == "string" then
|
||||||
obj[k] = v
|
obj[k] = v
|
||||||
|
|
||||||
|
|
||||||
--add child
|
--add child
|
||||||
elseif type(k) == 'number' then
|
elseif type(k) == "number" then
|
||||||
if type(v) ~= 'userdata' 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
|
end
|
||||||
v.Parent = obj
|
v.Parent = obj
|
||||||
|
|
||||||
|
|
||||||
--event connect
|
--event connect
|
||||||
elseif type(k) == 'table' and k.__eventname then
|
elseif type(k) == "table" and k.__eventname then
|
||||||
if type(v) ~= 'function' then
|
if type(v) ~= "function" then
|
||||||
error("Bad entry in Create body: Key `[Create.E\'"..k.__eventname.."\']` must have a function value\
|
error(
|
||||||
got: "..tostring(v), 2)
|
"Bad entry in Create body: Key `[Create.E'"
|
||||||
|
.. k.__eventname
|
||||||
|
.. "']` must have a function value, got: "
|
||||||
|
.. tostring(v),
|
||||||
|
2
|
||||||
|
)
|
||||||
end
|
end
|
||||||
obj[k.__eventname]:connect(v)
|
obj[k.__eventname]:connect(v)
|
||||||
|
|
||||||
|
|
||||||
--define constructor function
|
--define constructor function
|
||||||
elseif k == t.Create then
|
elseif k == t.Create then
|
||||||
if type(v) ~= 'function' then
|
if type(v) ~= "function" then
|
||||||
error("Bad entry in Create body: Key `[Create]` should be paired with a constructor function, \
|
error(
|
||||||
got: "..tostring(v), 2)
|
"Bad entry in Create body: Key `[Create]` should be paired with a constructor function, got: "
|
||||||
|
.. tostring(v),
|
||||||
|
2
|
||||||
|
)
|
||||||
elseif ctor then
|
elseif ctor then
|
||||||
--ctor already exists, only one allowed
|
--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
|
end
|
||||||
ctor = v
|
ctor = v
|
||||||
|
|
||||||
|
|
||||||
else
|
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
|
||||||
|
|
@ -981,7 +947,11 @@ local function Create_PrivImpl(objectType)
|
||||||
end
|
end
|
||||||
|
|
||||||
--now, create the functor:
|
--now, create the functor:
|
||||||
t.Create = setmetatable({}, {__call = function(tb, ...) return Create_PrivImpl(...) end})
|
t.Create = setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return Create_PrivImpl(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
--and create the "Event.E" syntax stub. Really it's just a stub to construct a table which our Create
|
--and create the "Event.E" syntax stub. Really it's just a stub to construct a table which our Create
|
||||||
--function can recognize as special.
|
--function can recognize as special.
|
||||||
|
|
@ -991,9 +961,6 @@ end
|
||||||
|
|
||||||
-------------------------------------------------Create function End----------------------------------------------------
|
-------------------------------------------------Create function End----------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
@ -1002,114 +969,87 @@ end
|
||||||
------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
t.Help =
|
t.Help = function(funcNameOrFunc)
|
||||||
function(funcNameOrFunc)
|
|
||||||
--input argument can be a string or a function. Should return a description (of arguments and expected side effects)
|
--input argument can be a string or a function. Should return a description (of arguments and expected side effects)
|
||||||
if funcNameOrFunc == "DecodeJSON" or funcNameOrFunc == t.DecodeJSON then
|
if funcNameOrFunc == "DecodeJSON" or funcNameOrFunc == t.DecodeJSON then
|
||||||
return "Function DecodeJSON. " ..
|
return "Function DecodeJSON. "
|
||||||
"Arguments: (string). " ..
|
.. "Arguments: (string). "
|
||||||
"Side effect: returns a table with all parsed JSON values"
|
.. "Side effect: returns a table with all parsed JSON values"
|
||||||
end
|
end
|
||||||
if funcNameOrFunc == "EncodeJSON" or funcNameOrFunc == t.EncodeJSON then
|
if funcNameOrFunc == "EncodeJSON" or funcNameOrFunc == t.EncodeJSON then
|
||||||
return "Function EncodeJSON. " ..
|
return "Function EncodeJSON. "
|
||||||
"Arguments: (table). " ..
|
.. "Arguments: (table). "
|
||||||
"Side effect: returns a string composed of argument table in JSON data format"
|
.. "Side effect: returns a string composed of argument table in JSON data format"
|
||||||
end
|
end
|
||||||
if funcNameOrFunc == "MakeWedge" or funcNameOrFunc == t.MakeWedge then
|
if funcNameOrFunc == "MakeWedge" or funcNameOrFunc == t.MakeWedge then
|
||||||
return "Function MakeWedge. " ..
|
return "Function MakeWedge. "
|
||||||
"Arguments: (x, y, z, [default material]). " ..
|
.. "Arguments: (x, y, z, [default material]). "
|
||||||
"Description: Makes a wedge at location x, y, z. Sets cell x, y, z to default material if "..
|
.. "Description: Makes a wedge at location x, y, z. Sets cell x, y, z to default material if "
|
||||||
"parameter is provided, if not sets cell x, y, z to be whatever material it previously was. "..
|
.. "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 "
|
.. "Returns true if made a wedge, false if the cell remains a block "
|
||||||
end
|
end
|
||||||
if funcNameOrFunc == "SelectTerrainRegion" or funcNameOrFunc == t.SelectTerrainRegion then
|
if funcNameOrFunc == "SelectTerrainRegion" or funcNameOrFunc == t.SelectTerrainRegion then
|
||||||
return "Function SelectTerrainRegion. " ..
|
return "Function SelectTerrainRegion. "
|
||||||
"Arguments: (regionToSelect, color, selectEmptyCells, selectionParent). " ..
|
.. "Arguments: (regionToSelect, color, selectEmptyCells, selectionParent). "
|
||||||
"Description: Selects all terrain via a series of selection boxes within the regionToSelect " ..
|
.. "Description: Selects all terrain via a series of selection boxes within the regionToSelect "
|
||||||
"(this should be a region3 value). The selection box color is detemined by the color argument " ..
|
.. "(this should be a region3 value). The selection box color is detemined by the color argument "
|
||||||
"(should be a brickcolor value). SelectionParent is the parent that the selection model gets placed to (optional)." ..
|
.. "(should be a brickcolor value). SelectionParent is the parent that the selection model gets placed to (optional)."
|
||||||
"SelectEmptyCells is bool, when true will select all cells in the " ..
|
.. "SelectEmptyCells is bool, when true will select all cells in the "
|
||||||
"region, otherwise we only select non-empty cells. Returns a function that can update the selection," ..
|
.. "region, otherwise we only select non-empty cells. Returns a function that can update the selection,"
|
||||||
"arguments to said function are a new region3 to select, and the adornment color (color arg is optional). " ..
|
.. "arguments to said function are a new region3 to select, and the adornment color (color arg is optional). "
|
||||||
"Also returns a second function that takes no arguments and destroys the selection"
|
.. "Also returns a second function that takes no arguments and destroys the selection"
|
||||||
end
|
end
|
||||||
if funcNameOrFunc == "CreateSignal" or funcNameOrFunc == t.CreateSignal then
|
if funcNameOrFunc == "CreateSignal" or funcNameOrFunc == t.CreateSignal then
|
||||||
return "Function CreateSignal. "..
|
return "Function CreateSignal. "
|
||||||
"Arguments: None. "..
|
.. "Arguments: None. "
|
||||||
"Returns: The newly created Signal object. This object is identical to the RBXScriptSignal class "..
|
.. "Returns: The newly created Signal object. This object is identical to the RBXScriptSignal class "
|
||||||
"used for events in Objects, but is a Lua-side object so it can be used to create custom events in"..
|
.. "used for events in Objects, but is a Lua-side object so it can be used to create custom events in"
|
||||||
"Lua code. "..
|
.. "Lua code. "
|
||||||
"Methods of the Signal object: :connect, :wait, :fire, :disconnect. "..
|
.. "Methods of the Signal object: :connect, :wait, :fire, :disconnect. "
|
||||||
"For more info you can pass the method name to the Help function, or view the wiki page "..
|
.. "For more info you can pass the method name to the Help function, or view the wiki page "
|
||||||
"for this library. EG: Help('Signal:connect')."
|
.. "for this library. EG: Help('Signal:connect')."
|
||||||
end
|
end
|
||||||
if funcNameOrFunc == "Signal:connect" then
|
if funcNameOrFunc == "Signal:connect" then
|
||||||
return "Method Signal:connect. "..
|
return "Method Signal:connect. "
|
||||||
"Arguments: (function handler). "..
|
.. "Arguments: (function handler). "
|
||||||
"Return: A connection object which can be used to disconnect the connection to this handler. "..
|
.. "Return: A connection object which can be used to disconnect the connection to this handler. "
|
||||||
"Description: Connectes a handler function to this Signal, so that when |fire| is called the "..
|
.. "Description: Connectes a handler function to this Signal, so that when |fire| is called the "
|
||||||
"handler function will be called with the arguments passed to |fire|."
|
.. "handler function will be called with the arguments passed to |fire|."
|
||||||
end
|
end
|
||||||
if funcNameOrFunc == "Signal:wait" then
|
if funcNameOrFunc == "Signal:wait" then
|
||||||
return "Method Signal:wait. "..
|
return "Method Signal:wait. "
|
||||||
"Arguments: None. "..
|
.. "Arguments: None. "
|
||||||
"Returns: The arguments passed to the next call to |fire|. "..
|
.. "Returns: The arguments passed to the next call to |fire|. "
|
||||||
"Description: This call does not return until the next call to |fire| is made, at which point it "..
|
.. "Description: This call does not return until the next call to |fire| is made, at which point it "
|
||||||
"will return the values which were passed as arguments to that |fire| call."
|
.. "will return the values which were passed as arguments to that |fire| call."
|
||||||
end
|
end
|
||||||
if funcNameOrFunc == "Signal:fire" then
|
if funcNameOrFunc == "Signal:fire" then
|
||||||
return "Method Signal:fire. "..
|
return "Method Signal:fire. "
|
||||||
"Arguments: Any number of arguments of any type. "..
|
.. "Arguments: Any number of arguments of any type. "
|
||||||
"Returns: None. "..
|
.. "Returns: None. "
|
||||||
"Description: This call will invoke any connected handler functions, and notify any waiting code "..
|
.. "Description: This call will invoke any connected handler functions, and notify any waiting code "
|
||||||
"attached to this Signal to continue, with the arguments passed to this function. Note: The calls "..
|
.. "attached to this Signal to continue, with the arguments passed to this function. Note: The calls "
|
||||||
"to handlers are made asynchronously, so this call will return immediately regardless of how long "..
|
.. "to handlers are made asynchronously, so this call will return immediately regardless of how long "
|
||||||
"it takes the connected handler functions to complete."
|
.. "it takes the connected handler functions to complete."
|
||||||
end
|
end
|
||||||
if funcNameOrFunc == "Signal:disconnect" then
|
if funcNameOrFunc == "Signal:disconnect" then
|
||||||
return "Method Signal:disconnect. "..
|
return "Method Signal:disconnect. "
|
||||||
"Arguments: None. "..
|
.. "Arguments: None. "
|
||||||
"Returns: None. "..
|
.. "Returns: None. "
|
||||||
"Description: This call disconnects all handlers attacched to this function, note however, it "..
|
.. "Description: This call disconnects all handlers attacched to this function, note however, it "
|
||||||
"does NOT make waiting code continue, as is the behavior of normal Roblox events. This method "..
|
.. "does NOT make waiting code continue, as is the behavior of normal Roblox events. This method "
|
||||||
"can also be called on the connection object which is returned from Signal:connect to only "..
|
.. "can also be called on the connection object which is returned from Signal:connect to only "
|
||||||
"disconnect a single handler, as opposed to this method, which will disconnect all handlers."
|
.. "disconnect a single handler, as opposed to this method, which will disconnect all handlers."
|
||||||
end
|
end
|
||||||
if funcNameOrFunc == "Create" then
|
if funcNameOrFunc == "Create" then
|
||||||
return "Function Create. "..
|
return "Function Create. "
|
||||||
"Arguments: A table containing information about how to construct a collection of objects. "..
|
.. "Arguments: A table containing information about how to construct a collection of objects. "
|
||||||
"Returns: The constructed objects. "..
|
.. "Returns: The constructed objects. "
|
||||||
"Descrition: Create is a very powerfull function, whose description is too long to fit here, and "..
|
.. "Descrition: Create is a very powerfull function, whose description is too long to fit here, and "
|
||||||
"is best described via example, please see the wiki page for a description of how to use it."
|
.. "is best described via example, please see the wiki page for a description of how to use it."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------Documentation Ends----------------------------------------------------------
|
--------------------------------------------Documentation Ends----------------------------------------------------------
|
||||||
|
|
||||||
return t
|
return t
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@
|
||||||
-- access to all of the libraries (otherwise only local scripts do)
|
-- access to all of the libraries (otherwise only local scripts do)
|
||||||
|
|
||||||
local deepakTestingPlace = 3569749
|
local deepakTestingPlace = 3569749
|
||||||
local sc = game:GetService("ScriptContext")
|
local sc = game:GetService "ScriptContext"
|
||||||
local tries = 0
|
local tries = 0
|
||||||
|
|
||||||
while not sc and tries < 3 do
|
while not sc and tries < 3 do
|
||||||
tries = tries + 1
|
tries = tries + 1
|
||||||
sc = game:GetService("ScriptContext")
|
sc = game:GetService "ScriptContext"
|
||||||
wait(0.2)
|
wait(0.2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -22,5 +22,5 @@ if sc then
|
||||||
sc:RegisterLibrary("Libraries/RbxStamper", "73157242")
|
sc:RegisterLibrary("Libraries/RbxStamper", "73157242")
|
||||||
sc:LibraryRegistrationComplete()
|
sc:LibraryRegistrationComplete()
|
||||||
else
|
else
|
||||||
print("failed to find script context, libraries did not load")
|
print "failed to find script context, libraries did not load"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
1011
73157242.lua
1011
73157242.lua
File diff suppressed because it is too large
Load Diff
265
89449008.lua
265
89449008.lua
|
|
@ -3,7 +3,7 @@ local function waitForChild(instance, name)
|
||||||
assert(instance)
|
assert(instance)
|
||||||
assert(name)
|
assert(name)
|
||||||
while not instance:FindFirstChild(name) do
|
while not instance:FindFirstChild(name) do
|
||||||
print('Waiting for ...', instance, name)
|
print("Waiting for ...", instance, name)
|
||||||
instance.ChildAdded:wait()
|
instance.ChildAdded:wait()
|
||||||
end
|
end
|
||||||
return instance:FindFirstChild(name)
|
return instance:FindFirstChild(name)
|
||||||
|
|
@ -18,23 +18,26 @@ end
|
||||||
|
|
||||||
local function IsTouchDevice()
|
local function IsTouchDevice()
|
||||||
local touchEnabled = false
|
local touchEnabled = false
|
||||||
pcall(function() touchEnabled = Game:GetService('UserInputService').TouchEnabled end)
|
pcall(function()
|
||||||
|
touchEnabled = Game:GetService("UserInputService").TouchEnabled
|
||||||
|
end)
|
||||||
return touchEnabled
|
return touchEnabled
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
waitForChild(game, "Players")
|
waitForChild(game, "Players")
|
||||||
waitForProperty(game.Players, "LocalPlayer")
|
waitForProperty(game.Players, "LocalPlayer")
|
||||||
local player = game.Players.LocalPlayer
|
local player = game.Players.LocalPlayer
|
||||||
|
|
||||||
local RbxGui, msg = LoadLibrary("RbxGui")
|
local RbxGui, _ = LoadLibrary "RbxGui"
|
||||||
if not RbxGui then print("could not find RbxGui!") return end
|
if not RbxGui then
|
||||||
|
print "could not find RbxGui!"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
--- Begin Locals
|
--- Begin Locals
|
||||||
local StaticTabName = "gear"
|
local StaticTabName = "gear"
|
||||||
|
|
||||||
local backpack = script.Parent
|
local backpack = script.Parent
|
||||||
local screen = script.Parent.Parent
|
|
||||||
|
|
||||||
local backpackItems = {}
|
local backpackItems = {}
|
||||||
local buttons = {}
|
local buttons = {}
|
||||||
|
|
@ -80,7 +83,7 @@ scrollFrame.Position = UDim2.new(0,0,0,30)
|
||||||
scrollFrame.Size = UDim2.new(1, 0, 1, -30)
|
scrollFrame.Size = UDim2.new(1, 0, 1, -30)
|
||||||
scrollFrame.Parent = backpack.Gear.GearGrid
|
scrollFrame.Parent = backpack.Gear.GearGrid
|
||||||
|
|
||||||
local scrollBar = Instance.new("Frame")
|
local scrollBar = Instance.new "Frame"
|
||||||
scrollBar.Name = "ScrollBar"
|
scrollBar.Name = "ScrollBar"
|
||||||
scrollBar.BackgroundTransparency = 0.9
|
scrollBar.BackgroundTransparency = 0.9
|
||||||
scrollBar.BackgroundColor3 = Color3.new(1, 1, 1)
|
scrollBar.BackgroundColor3 = Color3.new(1, 1, 1)
|
||||||
|
|
@ -100,7 +103,7 @@ scrollFrameLoadout.Position = UDim2.new(0,0,0,0)
|
||||||
scrollFrameLoadout.Size = UDim2.new(1, 0, 1, 0)
|
scrollFrameLoadout.Size = UDim2.new(1, 0, 1, 0)
|
||||||
scrollFrameLoadout.Parent = backpack.Gear.GearLoadouts.LoadoutsList
|
scrollFrameLoadout.Parent = backpack.Gear.GearLoadouts.LoadoutsList
|
||||||
|
|
||||||
local LoadoutButton = Instance.new("TextButton")
|
local LoadoutButton = Instance.new "TextButton"
|
||||||
LoadoutButton.RobloxLocked = true
|
LoadoutButton.RobloxLocked = true
|
||||||
LoadoutButton.Name = "LoadoutButton"
|
LoadoutButton.Name = "LoadoutButton"
|
||||||
LoadoutButton.Font = Enum.Font.ArialBold
|
LoadoutButton.Font = Enum.Font.ArialBold
|
||||||
|
|
@ -124,7 +127,7 @@ local LoadoutButtonFour = LoadoutButton:clone()
|
||||||
LoadoutButtonFour.Text = "Loadout #4"
|
LoadoutButtonFour.Text = "Loadout #4"
|
||||||
LoadoutButtonFour.Parent = scrollFrameLoadout
|
LoadoutButtonFour.Parent = scrollFrameLoadout
|
||||||
|
|
||||||
local scrollBarLoadout = Instance.new("Frame")
|
local scrollBarLoadout = Instance.new "Frame"
|
||||||
scrollBarLoadout.Name = "ScrollBarLoadout"
|
scrollBarLoadout.Name = "ScrollBarLoadout"
|
||||||
scrollBarLoadout.BackgroundTransparency = 0.9
|
scrollBarLoadout.BackgroundTransparency = 0.9
|
||||||
scrollBarLoadout.BackgroundColor3 = Color3.new(1, 1, 1)
|
scrollBarLoadout.BackgroundColor3 = Color3.new(1, 1, 1)
|
||||||
|
|
@ -138,7 +141,6 @@ scrollDownLoadout.Position = UDim2.new(0,0,1,-17)
|
||||||
scrollUpLoadout.Parent = backpack.Gear.GearLoadouts.GearLoadoutsScrollingArea
|
scrollUpLoadout.Parent = backpack.Gear.GearLoadouts.GearLoadoutsScrollingArea
|
||||||
scrollDownLoadout.Parent = backpack.Gear.GearLoadouts.GearLoadoutsScrollingArea
|
scrollDownLoadout.Parent = backpack.Gear.GearLoadouts.GearLoadoutsScrollingArea
|
||||||
|
|
||||||
|
|
||||||
-- Begin Functions
|
-- Begin Functions
|
||||||
function removeFromMap(map, object)
|
function removeFromMap(map, object)
|
||||||
for i = 1, #map do
|
for i = 1, #map do
|
||||||
|
|
@ -153,7 +155,7 @@ function robloxLock(instance)
|
||||||
instance.RobloxLocked = true
|
instance.RobloxLocked = true
|
||||||
children = instance:GetChildren()
|
children = instance:GetChildren()
|
||||||
if children then
|
if children then
|
||||||
for i, child in ipairs(children) do
|
for _, child in ipairs(children) do
|
||||||
robloxLock(child)
|
robloxLock(child)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -175,15 +177,19 @@ function resize()
|
||||||
end
|
end
|
||||||
|
|
||||||
function addToGrid(child)
|
function addToGrid(child)
|
||||||
if not child:IsA("Tool") then
|
if not child:IsA "Tool" then
|
||||||
if not child:IsA("HopperBin") then
|
if not child:IsA "HopperBin" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if child:FindFirstChild("RobloxBuildTool") then return end
|
if child:FindFirstChild "RobloxBuildTool" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
for i, v in pairs(backpackItems) do -- check to see if we already have this gear registered
|
for i, v in pairs(backpackItems) do -- check to see if we already have this gear registered
|
||||||
if v == child then return end
|
if v == child then
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(backpackItems, child)
|
table.insert(backpackItems, child)
|
||||||
|
|
@ -209,14 +215,22 @@ function addToGrid(child)
|
||||||
|
|
||||||
waitForProperty(player, "Character")
|
waitForProperty(player, "Character")
|
||||||
waitForChild(player, "Backpack")
|
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
|
if ancestryCon then
|
||||||
if changeCon then changeCon:disconnect() end
|
ancestryCon:disconnect()
|
||||||
|
end
|
||||||
|
if changeCon then
|
||||||
|
changeCon:disconnect()
|
||||||
|
end
|
||||||
|
|
||||||
for k, v in pairs(backpackItems) do
|
for k, v in pairs(backpackItems) do
|
||||||
if v == thisObject then
|
if v == thisObject then
|
||||||
if mouseEnterCons[buttons[v]] then mouseEnterCons[buttons[v]]:disconnect() end
|
if mouseEnterCons[buttons[v]] then
|
||||||
if mouseClickCons[buttons[v]] then mouseClickCons[buttons[v]]:disconnect() end
|
mouseEnterCons[buttons[v]]:disconnect()
|
||||||
|
end
|
||||||
|
if mouseClickCons[buttons[v]] then
|
||||||
|
mouseClickCons[buttons[v]]:disconnect()
|
||||||
|
end
|
||||||
buttons[v].Parent = nil
|
buttons[v].Parent = nil
|
||||||
buttons[v] = nil
|
buttons[v] = nil
|
||||||
break
|
break
|
||||||
|
|
@ -235,7 +249,7 @@ function addToGrid(child)
|
||||||
end
|
end
|
||||||
|
|
||||||
function buttonClick(button)
|
function buttonClick(button)
|
||||||
if button:FindFirstChild("UnequipContextMenu") and not button.Active then
|
if button:FindFirstChild "UnequipContextMenu" and not button.Active then
|
||||||
button.UnequipContextMenu.Visible = true
|
button.UnequipContextMenu.Visible = true
|
||||||
browsingMenu = true
|
browsingMenu = true
|
||||||
end
|
end
|
||||||
|
|
@ -253,24 +267,34 @@ function findEmptySlot()
|
||||||
local smallestNum = nil
|
local smallestNum = nil
|
||||||
local loadout = currentLoadout:GetChildren()
|
local loadout = currentLoadout:GetChildren()
|
||||||
for i = 1, #loadout do
|
for i = 1, #loadout do
|
||||||
if loadout[i]:IsA("Frame") and #loadout[i]:GetChildren() <= 0 then
|
if loadout[i]:IsA "Frame" and #loadout[i]:GetChildren() <= 0 then
|
||||||
local frameNum = tonumber(string.sub(loadout[i].Name, 5))
|
local frameNum = tonumber(string.sub(loadout[i].Name, 5))
|
||||||
if frameNum == 0 then frameNum = 10 end
|
if frameNum == 0 then
|
||||||
|
frameNum = 10
|
||||||
|
end
|
||||||
if not smallestNum or (smallestNum > frameNum) then
|
if not smallestNum or (smallestNum > frameNum) then
|
||||||
smallestNum = frameNum
|
smallestNum = frameNum
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if smallestNum == 10 then smallestNum = 0 end
|
if smallestNum == 10 then
|
||||||
|
smallestNum = 0
|
||||||
|
end
|
||||||
return smallestNum
|
return smallestNum
|
||||||
end
|
end
|
||||||
|
|
||||||
function checkForSwap(button, x, y)
|
function checkForSwap(button, x, y)
|
||||||
local loadoutChildren = currentLoadout:GetChildren()
|
local loadoutChildren = currentLoadout:GetChildren()
|
||||||
for i = 1, #loadoutChildren do
|
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) then
|
if
|
||||||
if y >= loadoutChildren[i].AbsolutePosition.y and y <= (loadoutChildren[i].AbsolutePosition.y + loadoutChildren[i].AbsoluteSize.y) then
|
x >= loadoutChildren[i].AbsolutePosition.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)
|
||||||
|
then
|
||||||
local slot = tonumber(string.sub(loadoutChildren[i].Name, 5))
|
local slot = tonumber(string.sub(loadoutChildren[i].Name, 5))
|
||||||
swapGearSlot(slot, button)
|
swapGearSlot(slot, button)
|
||||||
return true
|
return true
|
||||||
|
|
@ -283,7 +307,7 @@ end
|
||||||
|
|
||||||
function resizeGrid()
|
function resizeGrid()
|
||||||
for k, v in pairs(backpackItems) do
|
for k, v in pairs(backpackItems) do
|
||||||
if not v:FindFirstChild("RobloxBuildTool") then
|
if not v:FindFirstChild "RobloxBuildTool" then
|
||||||
if not buttons[v] then
|
if not buttons[v] then
|
||||||
local buttonClone = gearButton:clone()
|
local buttonClone = gearButton:clone()
|
||||||
buttonClone.Parent = grid.ScrollingFrame
|
buttonClone.Parent = grid.ScrollingFrame
|
||||||
|
|
@ -297,29 +321,33 @@ function resizeGrid()
|
||||||
buttonClone.Draggable = true
|
buttonClone.Draggable = true
|
||||||
buttons[v] = buttonClone
|
buttons[v] = buttonClone
|
||||||
|
|
||||||
|
|
||||||
if not IsTouchDevice() then
|
if not IsTouchDevice() then
|
||||||
local unequipMenu = getGearContextMenu()
|
local unequipMenu = getGearContextMenu()
|
||||||
|
|
||||||
|
|
||||||
unequipMenu.Visible = false
|
unequipMenu.Visible = false
|
||||||
unequipMenu.Parent = buttonClone
|
unequipMenu.Parent = buttonClone
|
||||||
end
|
end
|
||||||
|
|
||||||
local beginPos = nil
|
local beginPos = nil
|
||||||
buttonClone.DragBegin:connect(function(value)
|
buttonClone.DragBegin:connect(function(value)
|
||||||
waitForChild(buttonClone, 'Background')
|
waitForChild(buttonClone, "Background")
|
||||||
buttonClone['Background'].ZIndex = 10
|
buttonClone["Background"].ZIndex = 10
|
||||||
buttonClone.ZIndex = 10
|
buttonClone.ZIndex = 10
|
||||||
beginPos = value
|
beginPos = value
|
||||||
end)
|
end)
|
||||||
buttonClone.DragStopped:connect(function(x, y)
|
buttonClone.DragStopped:connect(function(x, y)
|
||||||
waitForChild(buttonClone, 'Background')
|
waitForChild(buttonClone, "Background")
|
||||||
buttonClone['Background'].ZIndex = 1.0
|
buttonClone["Background"].ZIndex = 1
|
||||||
buttonClone.ZIndex = 2
|
buttonClone.ZIndex = 2
|
||||||
if beginPos ~= buttonClone.Position then
|
if beginPos ~= buttonClone.Position then
|
||||||
if not checkForSwap(buttonClone, x, y) then
|
if not checkForSwap(buttonClone, x, y) then
|
||||||
buttonClone:TweenPosition(beginPos,Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true)
|
buttonClone:TweenPosition(
|
||||||
|
beginPos,
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quad,
|
||||||
|
0.5,
|
||||||
|
true
|
||||||
|
)
|
||||||
buttonClone.Draggable = false
|
buttonClone.Draggable = false
|
||||||
delay(0.5, function()
|
delay(0.5, function()
|
||||||
buttonClone.Draggable = true
|
buttonClone.Draggable = true
|
||||||
|
|
@ -330,7 +358,9 @@ function resizeGrid()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
local clickTime = tick()
|
local clickTime = tick()
|
||||||
mouseEnterCons[buttonClone] = buttonClone.MouseEnter:connect(function() previewGear(buttonClone) end)
|
mouseEnterCons[buttonClone] = buttonClone.MouseEnter:connect(function()
|
||||||
|
previewGear(buttonClone)
|
||||||
|
end)
|
||||||
mouseClickCons[buttonClone] = buttonClone.MouseButton1Click:connect(function()
|
mouseClickCons[buttonClone] = buttonClone.MouseButton1Click:connect(function()
|
||||||
local newClickTime = tick()
|
local newClickTime = tick()
|
||||||
if buttonClone.Active and (newClickTime - clickTime) < 0.5 then
|
if buttonClone.Active and (newClickTime - clickTime) < 0.5 then
|
||||||
|
|
@ -351,11 +381,11 @@ function resizeGrid()
|
||||||
end
|
end
|
||||||
|
|
||||||
function showPartialGrid(subset)
|
function showPartialGrid(subset)
|
||||||
for k,v in pairs(buttons) do
|
for _, v in pairs(buttons) do
|
||||||
v.Parent = nil
|
v.Parent = nil
|
||||||
end
|
end
|
||||||
if subset then
|
if subset then
|
||||||
for k,v in pairs(subset) do
|
for _, v in pairs(subset) do
|
||||||
v.Parent = grid.ScrollingFrame
|
v.Parent = grid.ScrollingFrame
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -363,7 +393,7 @@ function showPartialGrid(subset)
|
||||||
end
|
end
|
||||||
|
|
||||||
function showEntireGrid()
|
function showEntireGrid()
|
||||||
for k,v in pairs(buttons) do
|
for _, v in pairs(buttons) do
|
||||||
v.Parent = grid.ScrollingFrame
|
v.Parent = grid.ScrollingFrame
|
||||||
end
|
end
|
||||||
recalculateScroll()
|
recalculateScroll()
|
||||||
|
|
@ -372,7 +402,7 @@ end
|
||||||
function inLoadout(gear)
|
function inLoadout(gear)
|
||||||
local children = currentLoadout:GetChildren()
|
local children = currentLoadout:GetChildren()
|
||||||
for i = 1, #children do
|
for i = 1, #children do
|
||||||
if children[i]:IsA("Frame") then
|
if children[i]:IsA "Frame" then
|
||||||
local button = children[i]:GetChildren()
|
local button = children[i]:GetChildren()
|
||||||
if #button > 0 then
|
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
|
||||||
|
|
@ -385,16 +415,16 @@ function inLoadout(gear)
|
||||||
end
|
end
|
||||||
|
|
||||||
function updateGridActive()
|
function updateGridActive()
|
||||||
for k,v in pairs(backpackItems) do
|
for _, v in pairs(backpackItems) do
|
||||||
if buttons[v] then
|
if buttons[v] then
|
||||||
local gear = nil
|
local gear = nil
|
||||||
local gearRef = buttons[v]:FindFirstChild("GearReference")
|
local gearRef = buttons[v]:FindFirstChild "GearReference"
|
||||||
|
|
||||||
if gearRef then gear = gearRef.Value end
|
if gearRef then
|
||||||
|
gear = gearRef.Value
|
||||||
|
end
|
||||||
|
|
||||||
if not gear then
|
if (not gear) or inLoadout(gear) then
|
||||||
buttons[v].Active = false
|
|
||||||
elseif inLoadout(gear) then
|
|
||||||
buttons[v].Active = false
|
buttons[v].Active = false
|
||||||
else
|
else
|
||||||
buttons[v].Active = true
|
buttons[v].Active = true
|
||||||
|
|
@ -407,7 +437,7 @@ function centerGear(loadoutChildren)
|
||||||
local gearButtons = {}
|
local gearButtons = {}
|
||||||
local lastSlotAdd = nil
|
local lastSlotAdd = nil
|
||||||
for i = 1, #loadoutChildren do
|
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
|
if loadoutChildren[i].Name == "Slot0" then
|
||||||
lastSlotAdd = loadoutChildren[i]
|
lastSlotAdd = loadoutChildren[i]
|
||||||
else
|
else
|
||||||
|
|
@ -415,11 +445,19 @@ function centerGear(loadoutChildren)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if lastSlotAdd then table.insert(gearButtons,lastSlotAdd) end
|
if lastSlotAdd then
|
||||||
|
table.insert(gearButtons, lastSlotAdd)
|
||||||
|
end
|
||||||
|
|
||||||
local startPos = (1 - (#gearButtons * 0.1)) / 2
|
local startPos = (1 - (#gearButtons * 0.1)) / 2
|
||||||
for i = 1, #gearButtons do
|
for i = 1, #gearButtons do
|
||||||
gearButtons[i]:TweenPosition(UDim2.new(startPos + ((i - 1) * 0.1),0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, true)
|
gearButtons[i]:TweenPosition(
|
||||||
|
UDim2.new(startPos + ((i - 1) * 0.1), 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quad,
|
||||||
|
0.25,
|
||||||
|
true
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -459,10 +497,12 @@ function backpackCloseHandler(currentTab)
|
||||||
end
|
end
|
||||||
|
|
||||||
function loadoutCheck(child, selectState)
|
function loadoutCheck(child, selectState)
|
||||||
if not child:IsA("ImageButton") then return end
|
if not child:IsA "ImageButton" then
|
||||||
|
return
|
||||||
|
end
|
||||||
for k, v in pairs(backpackItems) do
|
for k, v in pairs(backpackItems) do
|
||||||
if buttons[v] then
|
if buttons[v] then
|
||||||
if child:FindFirstChild("GearReference") and buttons[v]:FindFirstChild("GearReference") then
|
if child:FindFirstChild "GearReference" and buttons[v]:FindFirstChild "GearReference" then
|
||||||
if buttons[v].GearReference.Value == child.GearReference.Value then
|
if buttons[v].GearReference.Value == child.GearReference.Value then
|
||||||
buttons[v].Active = selectState
|
buttons[v].Active = selectState
|
||||||
break
|
break
|
||||||
|
|
@ -480,7 +520,7 @@ end
|
||||||
function removeAllEquippedGear(physGear)
|
function removeAllEquippedGear(physGear)
|
||||||
local stuff = player.Character:GetChildren()
|
local stuff = player.Character:GetChildren()
|
||||||
for i = 1, #stuff do
|
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
|
||||||
stuff[i].Parent = playerBackpack
|
stuff[i].Parent = playerBackpack
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -515,9 +555,10 @@ function swapGearSlot(slot,gearButton)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local UnequipGearMenuClick = function(element, menu)
|
local UnequipGearMenuClick = function(element, menu)
|
||||||
if type(element.Action) ~= "number" then return end
|
if type(element.Action) ~= "number" then
|
||||||
|
return
|
||||||
|
end
|
||||||
local num = element.Action
|
local num = element.Action
|
||||||
if num == 1 then -- remove from loadout
|
if num == 1 then -- remove from loadout
|
||||||
unequipGear(menu.Parent.GearReference.Value)
|
unequipGear(menu.Parent.GearReference.Value)
|
||||||
|
|
@ -526,7 +567,7 @@ local UnequipGearMenuClick = function(element, menu)
|
||||||
local loadoutChildren = currentLoadout:GetChildren()
|
local loadoutChildren = currentLoadout:GetChildren()
|
||||||
local slot = -1
|
local slot = -1
|
||||||
for i = 1, #loadoutChildren do
|
for i = 1, #loadoutChildren do
|
||||||
if loadoutChildren[i]:IsA("Frame") then
|
if loadoutChildren[i]:IsA "Frame" then
|
||||||
local button = loadoutChildren[i]:GetChildren()
|
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
|
slot = button[1].SlotNumber.Text
|
||||||
|
|
@ -539,9 +580,12 @@ local UnequipGearMenuClick = function(element, menu)
|
||||||
end
|
end
|
||||||
|
|
||||||
function setupCharacterConnections()
|
function setupCharacterConnections()
|
||||||
|
if backpackAddCon then
|
||||||
if backpackAddCon then backpackAddCon:disconnect() end
|
backpackAddCon:disconnect()
|
||||||
backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded:connect(function(child) addToGrid(child) end)
|
end
|
||||||
|
backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded:connect(function(child)
|
||||||
|
addToGrid(child)
|
||||||
|
end)
|
||||||
|
|
||||||
-- make sure we get all the children
|
-- make sure we get all the children
|
||||||
local backpackChildren = game.Players.LocalPlayer.Backpack:GetChildren()
|
local backpackChildren = game.Players.LocalPlayer.Backpack:GetChildren()
|
||||||
|
|
@ -549,16 +593,18 @@ function setupCharacterConnections()
|
||||||
addToGrid(backpackChildren[i])
|
addToGrid(backpackChildren[i])
|
||||||
end
|
end
|
||||||
|
|
||||||
if characterChildAddedCon then characterChildAddedCon:disconnect() end
|
if characterChildAddedCon then
|
||||||
characterChildAddedCon =
|
characterChildAddedCon:disconnect()
|
||||||
game.Players.LocalPlayer.Character.ChildAdded:connect(function(child)
|
end
|
||||||
|
characterChildAddedCon = game.Players.LocalPlayer.Character.ChildAdded:connect(function(child)
|
||||||
addToGrid(child)
|
addToGrid(child)
|
||||||
updateGridActive()
|
updateGridActive()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if characterChildRemovedCon then characterChildRemovedCon:disconnect() end
|
if characterChildRemovedCon then
|
||||||
characterChildRemovedCon =
|
characterChildRemovedCon:disconnect()
|
||||||
game.Players.LocalPlayer.Character.ChildRemoved:connect(function(child)
|
end
|
||||||
|
characterChildRemovedCon = game.Players.LocalPlayer.Character.ChildRemoved:connect(function(_)
|
||||||
updateGridActive()
|
updateGridActive()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
@ -567,9 +613,15 @@ function setupCharacterConnections()
|
||||||
end
|
end
|
||||||
|
|
||||||
function removeCharacterConnections()
|
function removeCharacterConnections()
|
||||||
if characterChildAddedCon then characterChildAddedCon:disconnect() end
|
if characterChildAddedCon then
|
||||||
if characterChildRemovedCon then characterChildRemovedCon:disconnect() end
|
characterChildAddedCon:disconnect()
|
||||||
if backpackAddCon then backpackAddCon:disconnect() end
|
end
|
||||||
|
if characterChildRemovedCon then
|
||||||
|
characterChildRemovedCon:disconnect()
|
||||||
|
end
|
||||||
|
if backpackAddCon then
|
||||||
|
backpackAddCon:disconnect()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function trim(s)
|
function trim(s)
|
||||||
|
|
@ -594,7 +646,9 @@ function filterGear(terms)
|
||||||
return filteredGear
|
return filteredGear
|
||||||
end
|
end
|
||||||
function splitByWhitespace(text)
|
function splitByWhitespace(text)
|
||||||
if type(text) ~= "string" then return nil end
|
if type(text) ~= "string" then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
local terms = {}
|
local terms = {}
|
||||||
for token in string.gmatch(text, "[^%s]+") do
|
for token in string.gmatch(text, "[^%s]+") do
|
||||||
|
|
@ -605,7 +659,9 @@ function splitByWhitespace(text)
|
||||||
return terms
|
return terms
|
||||||
end
|
end
|
||||||
function showSearchGear(searchTerms)
|
function showSearchGear(searchTerms)
|
||||||
if not backpack.Gear.Visible then return end -- currently not active tab
|
if not backpack.Gear.Visible then
|
||||||
|
return
|
||||||
|
end -- currently not active tab
|
||||||
|
|
||||||
local searchTermTable = splitByWhitespace(searchTerms)
|
local searchTermTable = splitByWhitespace(searchTerms)
|
||||||
if searchTermTable and (#searchTermTable > 0) then
|
if searchTermTable and (#searchTermTable > 0) then
|
||||||
|
|
@ -639,7 +695,7 @@ function nukeBackpack()
|
||||||
end
|
end
|
||||||
|
|
||||||
function getGearContextMenu()
|
function getGearContextMenu()
|
||||||
local gearContextMenu = Instance.new("Frame")
|
local gearContextMenu = Instance.new "Frame"
|
||||||
gearContextMenu.Active = true
|
gearContextMenu.Active = true
|
||||||
gearContextMenu.Name = "UnequipContextMenu"
|
gearContextMenu.Name = "UnequipContextMenu"
|
||||||
gearContextMenu.Size = UDim2.new(0, 115, 0, 70)
|
gearContextMenu.Size = UDim2.new(0, 115, 0, 70)
|
||||||
|
|
@ -647,7 +703,7 @@ function getGearContextMenu()
|
||||||
gearContextMenu.BackgroundTransparency = 1
|
gearContextMenu.BackgroundTransparency = 1
|
||||||
gearContextMenu.Visible = false
|
gearContextMenu.Visible = false
|
||||||
|
|
||||||
local gearContextMenuButton = Instance.new("TextButton")
|
local gearContextMenuButton = Instance.new "TextButton"
|
||||||
gearContextMenuButton.Name = "UnequipContextMenuButton"
|
gearContextMenuButton.Name = "UnequipContextMenuButton"
|
||||||
gearContextMenuButton.Text = ""
|
gearContextMenuButton.Text = ""
|
||||||
gearContextMenuButton.Style = Enum.ButtonStyle.RobloxButtonDefault
|
gearContextMenuButton.Style = Enum.ButtonStyle.RobloxButtonDefault
|
||||||
|
|
@ -673,7 +729,7 @@ function getGearContextMenu()
|
||||||
for i, contextElement in ipairs(contextMenuElements) do
|
for i, contextElement in ipairs(contextMenuElements) do
|
||||||
local element = contextElement
|
local element = contextElement
|
||||||
if element.Type == "Button" then
|
if element.Type == "Button" then
|
||||||
local button = Instance.new("TextButton")
|
local button = Instance.new "TextButton"
|
||||||
button.Name = "UnequipContextButton" .. i
|
button.Name = "UnequipContextButton" .. i
|
||||||
button.BackgroundColor3 = Color3.new(0, 0, 0)
|
button.BackgroundColor3 = Color3.new(0, 0, 0)
|
||||||
button.BorderSizePixel = 0
|
button.BorderSizePixel = 0
|
||||||
|
|
@ -688,10 +744,11 @@ function getGearContextMenu()
|
||||||
button.Parent = gearContextMenuButton
|
button.Parent = gearContextMenuButton
|
||||||
|
|
||||||
if not IsTouchDevice() then
|
if not IsTouchDevice() then
|
||||||
|
|
||||||
button.MouseButton1Click:connect(function()
|
button.MouseButton1Click:connect(function()
|
||||||
if button.Active and not gearContextMenu.Parent.Active then
|
if button.Active and not gearContextMenu.Parent.Active then
|
||||||
local success, result = pcall(function() element.DoIt(element, gearContextMenu) end)
|
pcall(function()
|
||||||
|
element.DoIt(element, gearContextMenu)
|
||||||
|
end)
|
||||||
browsingMenu = false
|
browsingMenu = false
|
||||||
gearContextMenu.Visible = false
|
gearContextMenu.Visible = false
|
||||||
clearHighlight(button)
|
clearHighlight(button)
|
||||||
|
|
@ -714,12 +771,12 @@ function getGearContextMenu()
|
||||||
contextElement.Button = button
|
contextElement.Button = button
|
||||||
contextElement.Element = button
|
contextElement.Element = button
|
||||||
elseif element.Type == "Label" then
|
elseif element.Type == "Label" then
|
||||||
local frame = Instance.new("Frame")
|
local frame = Instance.new "Frame"
|
||||||
frame.Name = "ContextLabel" .. i
|
frame.Name = "ContextLabel" .. i
|
||||||
frame.BackgroundTransparency = 1
|
frame.BackgroundTransparency = 1
|
||||||
frame.Size = UDim2.new(1, 8, 0, elementHeight)
|
frame.Size = UDim2.new(1, 8, 0, elementHeight)
|
||||||
|
|
||||||
local label = Instance.new("TextLabel")
|
local label = Instance.new "TextLabel"
|
||||||
label.Name = "Text1"
|
label.Name = "Text1"
|
||||||
label.BackgroundTransparency = 1
|
label.BackgroundTransparency = 1
|
||||||
label.BackgroundColor3 = Color3.new(1, 1, 1)
|
label.BackgroundColor3 = Color3.new(1, 1, 1)
|
||||||
|
|
@ -727,7 +784,7 @@ function getGearContextMenu()
|
||||||
label.TextXAlignment = Enum.TextXAlignment.Left
|
label.TextXAlignment = Enum.TextXAlignment.Left
|
||||||
label.Font = Enum.Font.ArialBold
|
label.Font = Enum.Font.ArialBold
|
||||||
label.FontSize = Enum.FontSize.Size14
|
label.FontSize = Enum.FontSize.Size14
|
||||||
label.Position = UDim2.new(0.0, 0, 0, 0)
|
label.Position = UDim2.new(0, 0, 0, 0)
|
||||||
label.Size = UDim2.new(0.5, 0, 1, 0)
|
label.Size = UDim2.new(0.5, 0, 1, 0)
|
||||||
label.TextColor3 = Color3.new(1, 1, 1)
|
label.TextColor3 = Color3.new(1, 1, 1)
|
||||||
label.ZIndex = 9
|
label.ZIndex = 9
|
||||||
|
|
@ -735,7 +792,7 @@ function getGearContextMenu()
|
||||||
element.Label1 = label
|
element.Label1 = label
|
||||||
|
|
||||||
if element.GetText2 then
|
if element.GetText2 then
|
||||||
label = Instance.new("TextLabel")
|
label = Instance.new "TextLabel"
|
||||||
label.Name = "Text2"
|
label.Name = "Text2"
|
||||||
label.BackgroundTransparency = 1
|
label.BackgroundTransparency = 1
|
||||||
label.BackgroundColor3 = Color3.new(1, 1, 1)
|
label.BackgroundColor3 = Color3.new(1, 1, 1)
|
||||||
|
|
@ -775,7 +832,6 @@ function coreGuiChanged(coreGuiType,enabled)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local backpackChildren = player.Backpack:GetChildren()
|
local backpackChildren = player.Backpack:GetChildren()
|
||||||
for i = 1, #backpackChildren do
|
for i = 1, #backpackChildren do
|
||||||
addToGrid(backpackChildren[i])
|
addToGrid(backpackChildren[i])
|
||||||
|
|
@ -783,9 +839,10 @@ end
|
||||||
|
|
||||||
------------------------- Start Lifelong Connections -----------------------
|
------------------------- Start Lifelong Connections -----------------------
|
||||||
|
|
||||||
|
resizeEvent.Event:connect(function(_)
|
||||||
resizeEvent.Event:connect(function(absSize)
|
if debounce then
|
||||||
if debounce then return end
|
return
|
||||||
|
end
|
||||||
|
|
||||||
debounce = true
|
debounce = true
|
||||||
wait()
|
wait()
|
||||||
|
|
@ -794,35 +851,49 @@ resizeEvent.Event:connect(function(absSize)
|
||||||
debounce = false
|
debounce = false
|
||||||
end)
|
end)
|
||||||
|
|
||||||
currentLoadout.ChildAdded:connect(function(child) loadoutCheck(child, false) end)
|
currentLoadout.ChildAdded:connect(function(child)
|
||||||
currentLoadout.ChildRemoved:connect(function(child) loadoutCheck(child, true) end)
|
loadoutCheck(child, false)
|
||||||
|
end)
|
||||||
|
currentLoadout.ChildRemoved:connect(function(child)
|
||||||
|
loadoutCheck(child, true)
|
||||||
|
end)
|
||||||
|
|
||||||
currentLoadout.DescendantAdded:connect(function(descendant)
|
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())
|
centerGear(currentLoadout:GetChildren())
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
currentLoadout.DescendantRemoving:connect(function(descendant)
|
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()
|
wait()
|
||||||
centerGear(currentLoadout:GetChildren())
|
centerGear(currentLoadout:GetChildren())
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
grid.MouseEnter:connect(function() clearPreview() end)
|
grid.MouseEnter:connect(function()
|
||||||
grid.MouseLeave:connect(function() clearPreview() end)
|
clearPreview()
|
||||||
|
end)
|
||||||
|
grid.MouseLeave:connect(function()
|
||||||
|
clearPreview()
|
||||||
|
end)
|
||||||
|
|
||||||
player.CharacterRemoving:connect(function()
|
player.CharacterRemoving:connect(function()
|
||||||
removeCharacterConnections()
|
removeCharacterConnections()
|
||||||
nukeBackpack()
|
nukeBackpack()
|
||||||
end)
|
end)
|
||||||
player.CharacterAdded:connect(function() setupCharacterConnections() end)
|
player.CharacterAdded:connect(function()
|
||||||
|
setupCharacterConnections()
|
||||||
|
end)
|
||||||
|
|
||||||
player.ChildAdded:connect(function(child)
|
player.ChildAdded:connect(function(child)
|
||||||
if child:IsA("Backpack") then
|
if child:IsA "Backpack" then
|
||||||
playerBackpack = child
|
playerBackpack = child
|
||||||
if backpackAddCon then backpackAddCon:disconnect() end
|
if backpackAddCon then
|
||||||
backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded:connect(function(child) addToGrid(child) end)
|
backpackAddCon:disconnect()
|
||||||
|
end
|
||||||
|
backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded:connect(function(child)
|
||||||
|
addToGrid(child)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
@ -834,7 +905,7 @@ end)
|
||||||
|
|
||||||
local loadoutChildren = currentLoadout:GetChildren()
|
local loadoutChildren = currentLoadout:GetChildren()
|
||||||
for i = 1, #loadoutChildren do
|
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()
|
loadoutChildren[i].ChildRemoved:connect(function()
|
||||||
updateGridActive()
|
updateGridActive()
|
||||||
end)
|
end)
|
||||||
|
|
@ -858,14 +929,18 @@ local loadoutChildren = currentLoadout:GetChildren()
|
||||||
for i = 1, #loadoutChildren do
|
for i = 1, #loadoutChildren do
|
||||||
loadoutCheck(loadoutChildren[i], false)
|
loadoutCheck(loadoutChildren[i], false)
|
||||||
end
|
end
|
||||||
if not backpack.Visible then centerGear(currentLoadout:GetChildren()) end
|
if not backpack.Visible then
|
||||||
|
centerGear(currentLoadout:GetChildren())
|
||||||
|
end
|
||||||
|
|
||||||
-- make sure that inventory is listening to gear reparenting
|
-- make sure that inventory is listening to gear reparenting
|
||||||
if characterChildAddedCon == nil and game.Players.LocalPlayer["Character"] then
|
if characterChildAddedCon == nil and game.Players.LocalPlayer["Character"] then
|
||||||
setupCharacterConnections()
|
setupCharacterConnections()
|
||||||
end
|
end
|
||||||
if not backpackAddCon then
|
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
|
end
|
||||||
|
|
||||||
backpackOpenEvent.Event:connect(backpackOpenHandler)
|
backpackOpenEvent.Event:connect(backpackOpenHandler)
|
||||||
|
|
|
||||||
140
89449093.lua
140
89449093.lua
|
|
@ -1,5 +1,7 @@
|
||||||
-- 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)
|
-- 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 end -- peace out if we aren't using the right client
|
if game.CoreGui.Version < 7 then
|
||||||
|
return
|
||||||
|
end -- peace out if we aren't using the right client
|
||||||
|
|
||||||
-- basic functions
|
-- basic functions
|
||||||
local function waitForChild(instance, name)
|
local function waitForChild(instance, name)
|
||||||
|
|
@ -24,14 +26,12 @@ end
|
||||||
waitForProperty(game.Players, "LocalPlayer")
|
waitForProperty(game.Players, "LocalPlayer")
|
||||||
local player = game.Players.LocalPlayer
|
local player = game.Players.LocalPlayer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
------------------------ Locals ------------------------------
|
------------------------ Locals ------------------------------
|
||||||
local backpack = script.Parent
|
local backpack = script.Parent
|
||||||
waitForChild(backpack, "Gear")
|
waitForChild(backpack, "Gear")
|
||||||
|
|
||||||
local screen = script.Parent.Parent
|
local screen = script.Parent.Parent
|
||||||
assert(screen:IsA("ScreenGui"))
|
assert(screen:IsA "ScreenGui")
|
||||||
|
|
||||||
waitForChild(backpack, "Tabs")
|
waitForChild(backpack, "Tabs")
|
||||||
waitForChild(backpack.Tabs, "CloseButton")
|
waitForChild(backpack.Tabs, "CloseButton")
|
||||||
|
|
@ -53,9 +53,9 @@ local searchBox = waitForChild(backpack.SearchFrame.SearchBoxFrame,"SearchBox")
|
||||||
local searchButton = waitForChild(backpack.SearchFrame, "SearchButton")
|
local searchButton = waitForChild(backpack.SearchFrame, "SearchButton")
|
||||||
local resetButton = waitForChild(backpack.SearchFrame, "ResetButton")
|
local resetButton = waitForChild(backpack.SearchFrame, "ResetButton")
|
||||||
|
|
||||||
local robloxGui = waitForChild(Game.CoreGui, 'RobloxGui')
|
local robloxGui = waitForChild(Game.CoreGui, "RobloxGui")
|
||||||
local currentLoadout = waitForChild(robloxGui, 'CurrentLoadout')
|
local currentLoadout = waitForChild(robloxGui, "CurrentLoadout")
|
||||||
local loadoutBackground = waitForChild(currentLoadout, 'Background')
|
local loadoutBackground = waitForChild(currentLoadout, "Background")
|
||||||
|
|
||||||
local canToggle = true
|
local canToggle = true
|
||||||
local readyForNextEvent = true
|
local readyForNextEvent = true
|
||||||
|
|
@ -79,17 +79,15 @@ if robloxGui.AbsoluteSize.Y <= 320 then
|
||||||
backpackSize = UDim2.new(0, 200, 0, 140)
|
backpackSize = UDim2.new(0, 200, 0, 140)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
------------------------ End Locals ---------------------------
|
------------------------ End Locals ---------------------------
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------- Public Event Setup ----------------------------------------
|
---------------------------------------- Public Event Setup ----------------------------------------
|
||||||
|
|
||||||
function createPublicEvent(eventName)
|
function createPublicEvent(eventName)
|
||||||
assert(eventName, "eventName is nil")
|
assert(eventName, "eventName is nil")
|
||||||
assert(tostring(eventName), "eventName is not a string")
|
assert(tostring(eventName), "eventName is not a string")
|
||||||
|
|
||||||
local newEvent = Instance.new("BindableEvent")
|
local newEvent = Instance.new "BindableEvent"
|
||||||
newEvent.Name = tostring(eventName)
|
newEvent.Name = tostring(eventName)
|
||||||
newEvent.Parent = script
|
newEvent.Parent = script
|
||||||
|
|
||||||
|
|
@ -102,7 +100,7 @@ function createPublicFunction(funcName, invokeFunc)
|
||||||
assert(invokeFunc, "invokeFunc is nil")
|
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")
|
local newFunction = Instance.new "BindableFunction"
|
||||||
newFunction.Name = tostring(funcName)
|
newFunction.Name = tostring(funcName)
|
||||||
newFunction.OnInvoke = invokeFunc
|
newFunction.OnInvoke = invokeFunc
|
||||||
newFunction.Parent = script
|
newFunction.Parent = script
|
||||||
|
|
@ -111,15 +109,13 @@ function createPublicFunction(funcName, invokeFunc)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Events
|
-- Events
|
||||||
local resizeEvent = createPublicEvent("ResizeEvent")
|
local resizeEvent = createPublicEvent "ResizeEvent"
|
||||||
local backpackOpenEvent = createPublicEvent("BackpackOpenEvent")
|
local backpackOpenEvent = createPublicEvent "BackpackOpenEvent"
|
||||||
local backpackCloseEvent = createPublicEvent("BackpackCloseEvent")
|
local backpackCloseEvent = createPublicEvent "BackpackCloseEvent"
|
||||||
local tabClickedEvent = createPublicEvent("TabClickedEvent")
|
local tabClickedEvent = createPublicEvent "TabClickedEvent"
|
||||||
local searchRequestedEvent = createPublicEvent("SearchRequestedEvent")
|
local searchRequestedEvent = createPublicEvent "SearchRequestedEvent"
|
||||||
---------------------------------------- End Public Event Setup ----------------------------------------
|
---------------------------------------- End Public Event Setup ----------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------------------- Internal Functions ----------------------------------------
|
--------------------------- Internal Functions ----------------------------------------
|
||||||
|
|
||||||
function deactivateBackpack()
|
function deactivateBackpack()
|
||||||
|
|
@ -153,12 +149,19 @@ local hideBackpack = function()
|
||||||
backpackCloseEvent:Fire(currentTab)
|
backpackCloseEvent:Fire(currentTab)
|
||||||
backpack.Tabs.Visible = false
|
backpack.Tabs.Visible = false
|
||||||
searchFrame.Visible = false
|
searchFrame.Visible = false
|
||||||
backpack:TweenSizeAndPosition(UDim2.new(0, backpackSize.X.Offset,0, 0), UDim2.new(0.5, -backpackSize.X.Offset/2, 1, -85), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, guiTweenSpeed, true,
|
backpack:TweenSizeAndPosition(
|
||||||
|
UDim2.new(0, backpackSize.X.Offset, 0, 0),
|
||||||
|
UDim2.new(0.5, -backpackSize.X.Offset / 2, 1, -85),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quad,
|
||||||
|
guiTweenSpeed,
|
||||||
|
true,
|
||||||
function()
|
function()
|
||||||
game.GuiService:RemoveCenterDialog(backpack)
|
game.GuiService:RemoveCenterDialog(backpack)
|
||||||
backpack.Visible = false
|
backpack.Visible = false
|
||||||
backpackButton.Selected = false
|
backpackButton.Selected = false
|
||||||
end)
|
end
|
||||||
|
)
|
||||||
delay(guiTweenSpeed, function()
|
delay(guiTweenSpeed, function()
|
||||||
game.GuiService:RemoveCenterDialog(backpack)
|
game.GuiService:RemoveCenterDialog(backpack)
|
||||||
backpack.Visible = false
|
backpack.Visible = false
|
||||||
|
|
@ -169,41 +172,54 @@ local hideBackpack = function()
|
||||||
end
|
end
|
||||||
|
|
||||||
function showBackpack()
|
function showBackpack()
|
||||||
game.GuiService:AddCenterDialog(backpack, Enum.CenterDialogType.PlayerInitiatedDialog,
|
game.GuiService:AddCenterDialog(backpack, Enum.CenterDialogType.PlayerInitiatedDialog, function()
|
||||||
function()
|
|
||||||
backpack.Visible = true
|
backpack.Visible = true
|
||||||
backpackButton.Selected = true
|
backpackButton.Selected = true
|
||||||
end,
|
end, function()
|
||||||
function()
|
|
||||||
backpack.Visible = false
|
backpack.Visible = false
|
||||||
backpackButton.Selected = false
|
backpackButton.Selected = false
|
||||||
end)
|
end)
|
||||||
backpack.Visible = true
|
backpack.Visible = true
|
||||||
backpackButton.Selected = true
|
backpackButton.Selected = true
|
||||||
backpack:TweenSizeAndPosition(backpackSize, UDim2.new(0.5, -backpackSize.X.Offset/2, 1, -backpackSize.Y.Offset - 88), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, guiTweenSpeed, true)
|
backpack:TweenSizeAndPosition(
|
||||||
|
backpackSize,
|
||||||
|
UDim2.new(0.5, -backpackSize.X.Offset / 2, 1, -backpackSize.Y.Offset - 88),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quad,
|
||||||
|
guiTweenSpeed,
|
||||||
|
true
|
||||||
|
)
|
||||||
delay(guiTweenSpeed, function()
|
delay(guiTweenSpeed, function()
|
||||||
backpack.Tabs.Visible = false
|
backpack.Tabs.Visible = false
|
||||||
searchFrame.Visible = true
|
searchFrame.Visible = true
|
||||||
backpackOpenEvent:Fire(currentTab)
|
backpackOpenEvent:Fire(currentTab)
|
||||||
canToggle = true
|
canToggle = true
|
||||||
readyForNextEvent = true
|
readyForNextEvent = true
|
||||||
backpackButton.Image = 'http://www.roblox.com/asset/?id=97644093'
|
backpackButton.Image = "http://www.roblox.com/asset/?id=97644093"
|
||||||
backpackButton.Position = UDim2.new(0.5, -60, 1, -backpackSize.Y.Offset - 103)
|
backpackButton.Position = UDim2.new(0.5, -60, 1, -backpackSize.Y.Offset - 103)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function toggleBackpack()
|
function toggleBackpack()
|
||||||
if not game.Players.LocalPlayer then return end
|
if not game.Players.LocalPlayer then
|
||||||
if not game.Players.LocalPlayer["Character"] then return end
|
return
|
||||||
if not canToggle then return end
|
end
|
||||||
if not readyForNextEvent then return end
|
if not game.Players.LocalPlayer["Character"] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not canToggle then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not readyForNextEvent then
|
||||||
|
return
|
||||||
|
end
|
||||||
readyForNextEvent = false
|
readyForNextEvent = false
|
||||||
canToggle = false
|
canToggle = false
|
||||||
|
|
||||||
backpackIsOpen = not backpackIsOpen
|
backpackIsOpen = not backpackIsOpen
|
||||||
|
|
||||||
if backpackIsOpen then
|
if backpackIsOpen then
|
||||||
loadoutBackground.Image = 'http://www.roblox.com/asset/?id=97623721'
|
loadoutBackground.Image = "http://www.roblox.com/asset/?id=97623721"
|
||||||
loadoutBackground.Position = UDim2.new(-0.03, 0, -0.17, 0)
|
loadoutBackground.Position = UDim2.new(-0.03, 0, -0.17, 0)
|
||||||
loadoutBackground.Size = UDim2.new(1.05, 0, 1.25, 0)
|
loadoutBackground.Size = UDim2.new(1.05, 0, 1.25, 0)
|
||||||
loadoutBackground.ZIndex = 2.0
|
loadoutBackground.ZIndex = 2.0
|
||||||
|
|
@ -214,21 +230,20 @@ function toggleBackpack()
|
||||||
loadoutBackground.Visible = false
|
loadoutBackground.Visible = false
|
||||||
backpackButton.Selected = false
|
backpackButton.Selected = false
|
||||||
backpackButton.Image = "http://www.roblox.com/asset/?id=97617958"
|
backpackButton.Image = "http://www.roblox.com/asset/?id=97617958"
|
||||||
loadoutBackground.Image = 'http://www.roblox.com/asset/?id=96536002'
|
loadoutBackground.Image = "http://www.roblox.com/asset/?id=96536002"
|
||||||
loadoutBackground.Position = UDim2.new(-0.1, 0, -0.1, 0)
|
loadoutBackground.Position = UDim2.new(-0.1, 0, -0.1, 0)
|
||||||
loadoutBackground.Size = UDim2.new(1.2, 0, 1.2, 0)
|
loadoutBackground.Size = UDim2.new(1.2, 0, 1.2, 0)
|
||||||
hideBackpack()
|
hideBackpack()
|
||||||
|
|
||||||
|
|
||||||
local clChildren = currentLoadout:GetChildren()
|
local clChildren = currentLoadout:GetChildren()
|
||||||
for i = 1, #clChildren do
|
for i = 1, #clChildren do
|
||||||
if clChildren[i] and clChildren[i]:IsA('Frame') then
|
if clChildren[i] and clChildren[i]:IsA "Frame" then
|
||||||
local frame = clChildren[i]
|
local frame = clChildren[i]
|
||||||
if #frame:GetChildren() > 0 then
|
if #frame:GetChildren() > 0 then
|
||||||
backpackButton.Position = UDim2.new(0.5, -60, 1, -108)
|
backpackButton.Position = UDim2.new(0.5, -60, 1, -108)
|
||||||
backpackButton.Visible = true
|
backpackButton.Visible = true
|
||||||
loadoutBackground.Visible = true
|
loadoutBackground.Visible = true
|
||||||
if frame:GetChildren()[1]:IsA('ImageButton') then
|
if frame:GetChildren()[1]:IsA "ImageButton" then
|
||||||
local imgButton = frame:GetChildren()[1]
|
local imgButton = frame:GetChildren()[1]
|
||||||
imgButton.Active = true
|
imgButton.Active = true
|
||||||
imgButton.Draggable = false
|
imgButton.Draggable = false
|
||||||
|
|
@ -236,7 +251,6 @@ function toggleBackpack()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -248,7 +262,7 @@ end
|
||||||
|
|
||||||
function setSelected(tab)
|
function setSelected(tab)
|
||||||
assert(tab)
|
assert(tab)
|
||||||
assert(tab:IsA("TextButton"))
|
assert(tab:IsA "TextButton")
|
||||||
|
|
||||||
tab.BackgroundColor3 = Color3.new(1, 1, 1)
|
tab.BackgroundColor3 = Color3.new(1, 1, 1)
|
||||||
tab.TextColor3 = Color3.new(0, 0, 0)
|
tab.TextColor3 = Color3.new(0, 0, 0)
|
||||||
|
|
@ -258,7 +272,7 @@ end
|
||||||
|
|
||||||
function setUnselected(tab)
|
function setUnselected(tab)
|
||||||
assert(tab)
|
assert(tab)
|
||||||
assert(tab:IsA("TextButton"))
|
assert(tab:IsA "TextButton")
|
||||||
|
|
||||||
tab.BackgroundColor3 = Color3.new(0, 0, 0)
|
tab.BackgroundColor3 = Color3.new(0, 0, 0)
|
||||||
tab.TextColor3 = Color3.new(1, 1, 1)
|
tab.TextColor3 = Color3.new(1, 1, 1)
|
||||||
|
|
@ -280,18 +294,22 @@ end
|
||||||
|
|
||||||
function mouseLeaveTab(button)
|
function mouseLeaveTab(button)
|
||||||
assert(button)
|
assert(button)
|
||||||
assert(button:IsA("TextButton"))
|
assert(button:IsA "TextButton")
|
||||||
|
|
||||||
if button.Selected then return end
|
if button.Selected then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
button.BackgroundColor3 = Color3.new(0, 0, 0)
|
button.BackgroundColor3 = Color3.new(0, 0, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mouseOverTab(button)
|
function mouseOverTab(button)
|
||||||
assert(button)
|
assert(button)
|
||||||
assert(button:IsA("TextButton"))
|
assert(button:IsA "TextButton")
|
||||||
|
|
||||||
if button.Selected then return end
|
if button.Selected then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
button.BackgroundColor3 = Color3.new(39 / 255, 39 / 255, 39 / 255)
|
button.BackgroundColor3 = Color3.new(39 / 255, 39 / 255, 39 / 255)
|
||||||
end
|
end
|
||||||
|
|
@ -311,7 +329,9 @@ function trim(s)
|
||||||
end
|
end
|
||||||
|
|
||||||
function splitByWhitespace(text)
|
function splitByWhitespace(text)
|
||||||
if type(text) ~= "string" then return nil end
|
if type(text) ~= "string" then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
local terms = {}
|
local terms = {}
|
||||||
for token in string.gmatch(text, "[^%s]+") do
|
for token in string.gmatch(text, "[^%s]+") do
|
||||||
|
|
@ -374,13 +394,11 @@ end
|
||||||
|
|
||||||
--------------------------- End Internal Functions -------------------------------------
|
--------------------------- End Internal Functions -------------------------------------
|
||||||
|
|
||||||
|
|
||||||
------------------------------ Public Functions Setup -------------------------------------
|
------------------------------ Public Functions Setup -------------------------------------
|
||||||
createPublicFunction("CloseBackpack", hideBackpack)
|
createPublicFunction("CloseBackpack", hideBackpack)
|
||||||
createPublicFunction("BackpackReady", backpackReady)
|
createPublicFunction("BackpackReady", backpackReady)
|
||||||
------------------------------ End Public Functions Setup ---------------------------------
|
------------------------------ End Public Functions Setup ---------------------------------
|
||||||
|
|
||||||
|
|
||||||
------------------------ Connections/Script Main -------------------------------------------
|
------------------------ Connections/Script Main -------------------------------------------
|
||||||
|
|
||||||
pcall(function()
|
pcall(function()
|
||||||
|
|
@ -388,14 +406,26 @@ pcall(function()
|
||||||
Game.StarterGui.CoreGuiChangedSignal:connect(coreGuiChanged)
|
Game.StarterGui.CoreGuiChangedSignal:connect(coreGuiChanged)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
inventoryButton.MouseButton1Click:connect(function() newTabClicked("gear") end)
|
inventoryButton.MouseButton1Click:connect(function()
|
||||||
inventoryButton.MouseEnter:connect(function() mouseOverTab(inventoryButton) end)
|
newTabClicked "gear"
|
||||||
inventoryButton.MouseLeave:connect(function() mouseLeaveTab(inventoryButton) end)
|
end)
|
||||||
|
inventoryButton.MouseEnter:connect(function()
|
||||||
|
mouseOverTab(inventoryButton)
|
||||||
|
end)
|
||||||
|
inventoryButton.MouseLeave:connect(function()
|
||||||
|
mouseLeaveTab(inventoryButton)
|
||||||
|
end)
|
||||||
|
|
||||||
if game.CoreGui.Version >= 8 then
|
if game.CoreGui.Version >= 8 then
|
||||||
wardrobeButton.MouseButton1Click:connect(function() newTabClicked("wardrobe") end)
|
wardrobeButton.MouseButton1Click:connect(function()
|
||||||
wardrobeButton.MouseEnter:connect(function() mouseOverTab(wardrobeButton) end)
|
newTabClicked "wardrobe"
|
||||||
wardrobeButton.MouseLeave:connect(function() mouseLeaveTab(wardrobeButton) end)
|
end)
|
||||||
|
wardrobeButton.MouseEnter:connect(function()
|
||||||
|
mouseOverTab(wardrobeButton)
|
||||||
|
end)
|
||||||
|
wardrobeButton.MouseLeave:connect(function()
|
||||||
|
mouseLeaveTab(wardrobeButton)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
closeButton.MouseButton1Click:connect(closeBackpack)
|
closeButton.MouseButton1Click:connect(closeBackpack)
|
||||||
|
|
@ -410,13 +440,17 @@ end)
|
||||||
game:GetService("GuiService"):AddKey(tilde)
|
game:GetService("GuiService"):AddKey(tilde)
|
||||||
game:GetService("GuiService"):AddKey(backquote)
|
game:GetService("GuiService"):AddKey(backquote)
|
||||||
game:GetService("GuiService").KeyPressed:connect(function(key)
|
game:GetService("GuiService").KeyPressed:connect(function(key)
|
||||||
if not active or disabledByDeveloper then return end
|
if not active or disabledByDeveloper then
|
||||||
|
return
|
||||||
|
end
|
||||||
if key == tilde or key == backquote then
|
if key == tilde or key == backquote then
|
||||||
toggleBackpack()
|
toggleBackpack()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
backpackButton.MouseButton1Click:connect(function()
|
backpackButton.MouseButton1Click:connect(function()
|
||||||
if not active or disabledByDeveloper then return end
|
if not active or disabledByDeveloper then
|
||||||
|
return
|
||||||
|
end
|
||||||
toggleBackpack()
|
toggleBackpack()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
|
||||||
1499
97188756.lua
1499
97188756.lua
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1 @@
|
||||||
|
std = "mercury"
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
column_width = 120
|
||||||
|
line_endings = "Unix"
|
||||||
|
indent_type = "Tabs"
|
||||||
|
indent_width = 4
|
||||||
|
quote_style = "AutoPreferDouble"
|
||||||
|
call_parentheses = "None"
|
||||||
Loading…
Reference in New Issue