asset update

This commit is contained in:
Conkley 2022-08-04 00:40:54 +10:00
parent 8d032fdc59
commit 9df49c7532
4 changed files with 467 additions and 152 deletions

View File

@ -1,4 +1,4 @@
%12%
%12%
-- This script creates almost all gui elements found in the backpack (warning: there are a lot!)
-- TODO: automate this process
@ -18,6 +18,12 @@ local function waitForProperty(instance, property)
end
end
local function IsTouchDevice()
local touchEnabled = false
pcall(function() touchEnabled = Game:GetService('UserInputService').TouchEnabled end)
return touchEnabled
end
waitForChild(game,"Players")
waitForProperty(game.Players,"LocalPlayer")
local player = game.Players.LocalPlayer
@ -25,12 +31,29 @@ local player = game.Players.LocalPlayer
-- First up is the current loadout
local CurrentLoadout = Instance.new("Frame")
CurrentLoadout.Name = "CurrentLoadout"
CurrentLoadout.Position = UDim2.new(0.5, -240, 1, -85)
CurrentLoadout.Size = UDim2.new(0, 480, 0, 48)
CurrentLoadout.Position = UDim2.new(0.5, -300, 1, -85)
CurrentLoadout.Size = UDim2.new(0, 600, 0, 54)
CurrentLoadout.BackgroundTransparency = 1
CurrentLoadout.RobloxLocked = true
CurrentLoadout.Parent = gui
local CLBackground = Instance.new('ImageLabel')
CLBackground.Name = 'Background';
CLBackground.Size = UDim2.new(1.2, 0, 1.2, 0);
CLBackground.Image = "http://www.morblox.us/asset/?id=96536002"
CLBackground.BackgroundTransparency = 1.0;
CLBackground.Position = UDim2.new(-0.1, 0, -0.1, 0);
CLBackground.ZIndex = 0.0;
CLBackground.Parent = CurrentLoadout
CLBackground.Visible = false
local BackgroundUp = Instance.new('ImageLabel')
BackgroundUp.Size = UDim2.new(1, 0, 0.025, 1)
BackgroundUp.Position = UDim2.new(0, 0, 0, 0)
BackgroundUp.Image = 'http://www.morblox.us/asset/?id=97662207'
BackgroundUp.BackgroundTransparency = 1.0
BackgroundUp.Parent = CLBackground
local Debounce = Instance.new("BoolValue")
Debounce.Name = "Debounce"
Debounce.RobloxLocked = true
@ -41,36 +64,73 @@ BackpackButton.RobloxLocked = true
BackpackButton.Visible = false
BackpackButton.Name = "BackpackButton"
BackpackButton.BackgroundTransparency = 1
BackpackButton.Image = "rbxasset://textures/ui/backpackButton.png"
BackpackButton.Position = UDim2.new(0.5, -195, 1, -30)
BackpackButton.Size = UDim2.new(0,107,0,26)
BackpackButton.Image = "http://www.morblox.us/asset/?id=97617958"
BackpackButton.Position = UDim2.new(0.5, -60, 1, -108)
BackpackButton.Size = UDim2.new(0, 120, 0, 18)
waitForChild(gui,"ControlFrame")
BackpackButton.Parent = gui.ControlFrame
for i = 0, 9 do
local NumSlots = 9
if gui.AbsoluteSize.Y <= 320 then
NumSlots = 3
CurrentLoadout.Size = UDim2.new(0, 180, 0, 54)
CurrentLoadout.Position = UDim2.new(0.5, -90, 1, -85)
end
for i = 0, NumSlots do
local slotFrame = Instance.new("Frame")
slotFrame.RobloxLocked = true
slotFrame.BackgroundColor3 = Color3.new(0,0,0)
slotFrame.BackgroundTransparency = 1
slotFrame.BorderColor3 = Color3.new(1,1,1)
slotFrame.BorderColor3 = Color3.new(1, 1, 1)
slotFrame.Name = "Slot" .. tostring(i)
slotFrame.ZIndex = 4.0
if i == 0 then
slotFrame.Position = UDim2.new(0.9,0,0,0)
slotFrame.Position = UDim2.new(0.9, 0, 0, 0)
else
slotFrame.Position = UDim2.new((i - 1) * 0.1,0,0,0)
end
slotFrame.Size = UDim2.new(0.1,0,1,0)
slotFrame.Parent = CurrentLoadout
slotFrame.Position = UDim2.new((i - 1) * 0.1, (i-1)* 6,0,0)
end
slotFrame.Size = UDim2.new(0, 54, 1, 0)
slotFrame.Parent = CurrentLoadout
if gui.AbsoluteSize.Y <= 320 then
slotFrame.Position = UDim2.new(0, (i-1)* 60, 0, -50)
print('Well got here', slotFrame, slotFrame.Position.X.Scale, slotFrame.Position.X.Offset)
end
if gui.AbsoluteSize.Y <= 320 and i == 0 then
slotFrame:Destroy()
end
end
local TempSlot = Instance.new("ImageButton")
TempSlot.Name = "TempSlot"
TempSlot.Active = true
TempSlot.Size = UDim2.new(1,0,1,0)
TempSlot.Style = Enum.ButtonStyle.RobloxButton
TempSlot.BackgroundTransparency = 1.0
TempSlot.Style = 'Custom'
TempSlot.Visible = false
TempSlot.RobloxLocked = true
TempSlot.Parent = CurrentLoadout
TempSlot.ZIndex = 3.0
local slotBackground = Instance.new('ImageLabel')
slotBackground.Name = 'Background'
slotBackground.BackgroundTransparency = 1.0
slotBackground.Image = 'http://www.morblox.us/asset/?id=97613075'
slotBackground.Size = UDim2.new(1, 0, 1, 0)
slotBackground.Parent = TempSlot
local HighLight = Instance.new('ImageLabel')
HighLight.Name = 'Highlight'
HighLight.BackgroundTransparency = 1.0
HighLight.Image = 'http://www.morblox.us/asset/?id=97643886'
HighLight.Size = UDim2.new(1, 0, 1, 0)
--HighLight.Parent = TempSlot
HighLight.Visible = false
-- TempSlot Children
local GearReference = Instance.new("ObjectValue")
@ -78,6 +138,7 @@ TempSlot.Parent = CurrentLoadout
GearReference.RobloxLocked = true
GearReference.Parent = TempSlot
local ToolTipLabel = Instance.new("TextLabel")
ToolTipLabel.Name = "ToolTipLabel"
ToolTipLabel.RobloxLocked = true
@ -94,6 +155,7 @@ TempSlot.Parent = CurrentLoadout
ToolTipLabel.Size = UDim2.new(1,60,0,20)
ToolTipLabel.Position = UDim2.new(0,-30,0,-30)
ToolTipLabel.Parent = TempSlot
local Kill = Instance.new("BoolValue")
Kill.Name = "Kill"
@ -103,9 +165,9 @@ TempSlot.Parent = CurrentLoadout
local GearImage = Instance.new("ImageLabel")
GearImage.Name = "GearImage"
GearImage.BackgroundTransparency = 1
GearImage.Position = UDim2.new(0,-7,0,-7)
GearImage.Size = UDim2.new(1,14,1,14)
GearImage.ZIndex = 2
GearImage.Position = UDim2.new(0, 0, 0, 0)
GearImage.Size = UDim2.new(1, 0, 1, 0)
GearImage.ZIndex = 5.0
GearImage.RobloxLocked = true
GearImage.Parent = TempSlot
@ -115,26 +177,30 @@ TempSlot.Parent = CurrentLoadout
SlotNumber.BorderSizePixel = 0
SlotNumber.Font = Enum.Font.ArialBold
SlotNumber.FontSize = Enum.FontSize.Size18
SlotNumber.Position = UDim2.new(0,-7,0,-7)
SlotNumber.Position = UDim2.new(0, 0, 0, 0)
SlotNumber.Size = UDim2.new(0,10,0,15)
SlotNumber.TextColor3 = Color3.new(1,1,1)
SlotNumber.TextTransparency = 0
SlotNumber.TextXAlignment = Enum.TextXAlignment.Left
SlotNumber.TextYAlignment = Enum.TextYAlignment.Bottom
SlotNumber.ZIndex = 4
SlotNumber.TextYAlignment = Enum.TextYAlignment.Bottom
SlotNumber.RobloxLocked = true
SlotNumber.Parent = TempSlot
SlotNumber.ZIndex = 5
if IsTouchDevice() then
SlotNumber.Visible = false
end
local SlotNumberDownShadow = SlotNumber:clone()
local SlotNumberDownShadow = SlotNumber:Clone()
SlotNumberDownShadow.Name = "SlotNumberDownShadow"
SlotNumberDownShadow.TextColor3 = Color3.new(0,0,0)
SlotNumberDownShadow.ZIndex = 3
SlotNumberDownShadow.Position = UDim2.new(0,-6,0,-6)
SlotNumberDownShadow.TextColor3 = Color3.new(0,0,0)
SlotNumberDownShadow.Position = UDim2.new(0, 1, 0, -1)
SlotNumberDownShadow.Parent = TempSlot
SlotNumberDownShadow.ZIndex = 2
local SlotNumberUpShadow = SlotNumberDownShadow:clone()
local SlotNumberUpShadow = SlotNumberDownShadow:Clone()
SlotNumberUpShadow.Name = "SlotNumberUpShadow"
SlotNumberUpShadow.Position = UDim2.new(0,-8,0,-8)
SlotNumberUpShadow.Position = UDim2.new(0, -1, 0, -1)
SlotNumberUpShadow.Parent = TempSlot
local GearText = Instance.new("TextLabel")
@ -143,8 +209,7 @@ TempSlot.Parent = CurrentLoadout
GearText.BackgroundTransparency = 1
GearText.Font = Enum.Font.Arial
GearText.FontSize = Enum.FontSize.Size14
GearText.Position = UDim2.new(0,-8,0,-8)
GearText.ZIndex = 2
GearText.Position = UDim2.new(0,-8,0,-8)
GearText.Size = UDim2.new(1,16,1,16)
GearText.Text = ""
GearText.TextColor3 = Color3.new(1,1,1)
@ -157,9 +222,9 @@ local Backpack = Instance.new("Frame")
Backpack.RobloxLocked = true
Backpack.Visible = false
Backpack.Name = "Backpack"
Backpack.Position = UDim2.new(0.5,0,0.5,0)
Backpack.BackgroundColor3 = Color3.new(0,0,0)
Backpack.BackgroundTransparency = 0.08
Backpack.Position = UDim2.new(0.5, 0, 0.5, 0)
Backpack.BackgroundColor3 = Color3.new(32/255, 32/255, 32/255)
Backpack.BackgroundTransparency = 0.0
Backpack.BorderSizePixel = 0
Backpack.Parent = gui
Backpack.Active = true
@ -183,7 +248,8 @@ Backpack.Active = true
local Tabs = Instance.new("Frame")
Tabs.Name = "Tabs"
Tabs.Visible = true
Tabs.Visible = false
Tabs.Active = false
Tabs.RobloxLocked = true
Tabs.BackgroundColor3 = Color3.new(0,0,0)
Tabs.BackgroundTransparency = 0.08
@ -221,21 +287,23 @@ Backpack.Active = true
InventoryButton.ZIndex = 3
InventoryButton.Parent = Tabs
local WardrobeButton = Instance.new("TextButton")
WardrobeButton.RobloxLocked = true
WardrobeButton.Name = "WardrobeButton"
WardrobeButton.Size = UDim2.new(0,90,0,30)
WardrobeButton.Position = UDim2.new(0,77,1,-31)
WardrobeButton.BackgroundColor3 = Color3.new(0,0,0)
WardrobeButton.BorderColor3 = Color3.new(1,1,1)
WardrobeButton.Font = Enum.Font.ArialBold
WardrobeButton.FontSize = Enum.FontSize.Size18
WardrobeButton.Text = "Wardrobe"
WardrobeButton.AutoButtonColor = false
WardrobeButton.TextColor3 = Color3.new(1,1,1)
WardrobeButton.Selected = false
WardrobeButton.Active = true
WardrobeButton.Parent = Tabs
if game.CoreGui.Version >= 8 then
local WardrobeButton = Instance.new("TextButton")
WardrobeButton.RobloxLocked = true
WardrobeButton.Name = "WardrobeButton"
WardrobeButton.Size = UDim2.new(0,90,0,30)
WardrobeButton.Position = UDim2.new(0,77,1,-31)
WardrobeButton.BackgroundColor3 = Color3.new(0,0,0)
WardrobeButton.BorderColor3 = Color3.new(1,1,1)
WardrobeButton.Font = Enum.Font.ArialBold
WardrobeButton.FontSize = Enum.FontSize.Size18
WardrobeButton.Text = "Wardrobe"
WardrobeButton.AutoButtonColor = false
WardrobeButton.TextColor3 = Color3.new(1,1,1)
WardrobeButton.Selected = false
WardrobeButton.Active = true
WardrobeButton.Parent = Tabs
end
local closeButton = Instance.new("TextButton")
closeButton.RobloxLocked = true
@ -254,8 +322,8 @@ Backpack.Active = true
local XImage = Instance.new("ImageLabel")
XImage.RobloxLocked = true
XImage.Name = "XImage"
game:GetService("ContentProvider"):Preload("http://morblox.us/asset/?id=75547445")
XImage.Image = "http://morblox.us/asset/?id=75547445" --TODO: move to rbxasset
game:GetService("ContentProvider"):Preload("http://www.morblox.us/asset/?id=75547445")
XImage.Image = "http://www.morblox.us/asset/?id=75547445" --TODO: move to rbxasset
XImage.BackgroundTransparency = 1
XImage.Position = UDim2.new(-.25,-1,-.25,-1)
XImage.Size = UDim2.new(1.5,2,1.5,2)
@ -341,18 +409,27 @@ Backpack.Active = true
local GearGrid = Instance.new("Frame")
GearGrid.RobloxLocked = true
GearGrid.Name = "GearGrid"
GearGrid.Size = UDim2.new(0.69,0,1,0)
GearGrid.Size = UDim2.new(0.95, 0, 1, 0)
GearGrid.BackgroundTransparency = 1
GearGrid.Parent = Gear
GearGrid.Parent = Gear
local GearButton = Instance.new("ImageButton")
GearButton.RobloxLocked = true
GearButton.Visible = false
GearButton.Name = "GearButton"
GearButton.Size = UDim2.new(0,64,0,64)
GearButton.Style = Enum.ButtonStyle.RobloxButton
GearButton.Size = UDim2.new(0, 54, 0, 54)
GearButton.Style = 'Custom'
GearButton.Parent = GearGrid
GearButton.BackgroundTransparency = 1.0
local slotBackground = Instance.new('ImageLabel')
slotBackground.Name = 'Background'
slotBackground.BackgroundTransparency = 1.0
slotBackground.Image = 'http://www.morblox.us/asset/?id=97613075'
slotBackground.Size = UDim2.new(1, 0, 1, 0)
slotBackground.Parent = GearButton
-- GearButton Children
local GearReference = Instance.new("ObjectValue")
@ -387,8 +464,8 @@ Backpack.Active = true
local GearGridScrollingArea = Instance.new("Frame")
GearGridScrollingArea.RobloxLocked = true
GearGridScrollingArea.Name = "GearGridScrollingArea"
GearGridScrollingArea.Position = UDim2.new(0.7,0,0,35)
GearGridScrollingArea.Size = UDim2.new(0,17,1,-45)
GearGridScrollingArea.Position = UDim2.new(1, -19, 0, 35)
GearGridScrollingArea.Size = UDim2.new(0, 17, 1, -45)
GearGridScrollingArea.BackgroundTransparency = 1
GearGridScrollingArea.Parent = Gear
@ -527,6 +604,12 @@ Backpack.Active = true
AttributeThreeImage.Parent = GearIcons
------------------------------- WARDROBE -------------------------------------------------------
if game.CoreGui.Version < 8 then
-- no need for this to stick around, we aren't ready for wardrobe
script:remove()
return
end
local function makeCharFrame(frameName, parent)
local frame = Instance.new("Frame")
frame.RobloxLocked = true
@ -676,24 +759,24 @@ Backpack.Active = true
--CharacterPane Children
local FaceFrame = makeCharFrame("FacesFrame", CharacterPane)
game:GetService("ContentProvider"):Preload("http://morblox.us/asset/?id=75460621")
makeZone("FaceZone","http://morblox.us/asset/?id=75460621",UDim2.new(0,157,0,137),UDim2.new(0.5,-78,0.5,-68),FaceFrame)
game:GetService("ContentProvider"):Preload("http://www.morblox.us/asset/?id=75460621")
makeZone("FaceZone","http://www.morblox.us/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)
local HeadFrame = makeCharFrame("HeadsFrame", CharacterPane)
makeZone("FaceZone","http://morblox.us/asset/?id=75460621",UDim2.new(0,157,0,137),UDim2.new(0.5,-78,0.5,-68),HeadFrame)
makeZone("FaceZone","http://www.morblox.us/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)
local HatsFrame = makeCharFrame("HatsFrame", CharacterPane)
game:GetService("ContentProvider"):Preload("http://morblox.us/asset/?id=75457888")
local HatsZone = makeZone("HatsZone","http://morblox.us/asset/?id=75457888",UDim2.new(0,186,0,184),UDim2.new(0.5,-93,0.5,-100), HatsFrame)
game:GetService("ContentProvider"):Preload("http://www.morblox.us/asset/?id=75457888")
local HatsZone = makeZone("HatsZone","http://www.morblox.us/asset/?id=75457888",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)
game:GetService("ContentProvider"):Preload("http://morblox.us/asset/?id=75457920")
makeZone("PantsZone","http://morblox.us/asset/?id=75457920",UDim2.new(0,121,0,99),UDim2.new(0.5,-60,0.5,-100),PantsFrame)
game:GetService("ContentProvider"):Preload("http://www.morblox.us/asset/?id=75457920")
makeZone("PantsZone","http://www.morblox.us/asset/?id=75457920",UDim2.new(0,121,0,99),UDim2.new(0.5,-60,0.5,-100),PantsFrame)
local pantFrame = Instance.new("Frame")
pantFrame.RobloxLocked = true
@ -731,19 +814,19 @@ Backpack.Active = true
makeTextLabel("LeftArmLabel","Left Arm",UDim2.new(0.5,-16,0,-25),leftArmButton)
local TShirtFrame = makeCharFrame("T-ShirtsFrame",CharacterPane)
game:GetService("ContentProvider"):Preload("http://morblox.us/asset/?id=75460642")
makeZone("TShirtZone","http://morblox.us/asset/?id=75460642",UDim2.new(0,121,0,154),UDim2.new(0.5,-60,0.5,-100),TShirtFrame)
game:GetService("ContentProvider"):Preload("http://www.morblox.us/asset/?id=75460642")
makeZone("TShirtZone","http://www.morblox.us/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)
local ShirtFrame = makeCharFrame("ShirtsFrame", CharacterPane)
makeZone("ShirtZone","http://morblox.us/asset/?id=75460642",UDim2.new(0,121,0,154),UDim2.new(0.5,-60,0.5,-100),ShirtFrame)
makeZone("ShirtZone","http://www.morblox.us/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)
local ColorFrame = makeCharFrame("ColorFrame", CharacterPane)
game:GetService("ContentProvider"):Preload("http://morblox.us/asset/?id=76049888")
local ColorZone = makeZone("ColorZone","http://morblox.us/asset/?id=76049888", UDim2.new(0,120,0,150),UDim2.new(0.5,-60,0.5,-100),ColorFrame)
game:GetService("ContentProvider"):Preload("http://www.morblox.us/asset/?id=76049888")
local ColorZone = makeZone("ColorZone","http://www.morblox.us/asset/?id=76049888", UDim2.new(0,120,0,150),UDim2.new(0.5,-60,0.5,-100),ColorFrame)
makeStyledButton("Head",UDim2.new(0.26,0,0.19,0),UDim2.new(0.37,0,0.02,0),ColorZone).AutoButtonColor = false
makeStyledButton("LeftArm",UDim2.new(0.19,0,0.36,0),UDim2.new(0.78,0,0.26,0),ColorZone).AutoButtonColor = false
makeStyledButton("RightArm",UDim2.new(0.19,0,0.36,0),UDim2.new(0.025,0,0.26,0),ColorZone).AutoButtonColor = false
@ -780,4 +863,5 @@ Backpack.Active = true
SaveButton.Parent = CharacterPane
-- no need for this to stick around
script:remove()
script:Destroy()

View File

@ -1,4 +1,4 @@
%13%
%13%
-- 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
@ -40,10 +40,10 @@ local closeButton = backpack.Tabs.CloseButton
waitForChild(backpack.Tabs, "InventoryButton")
local inventoryButton = backpack.Tabs.InventoryButton
waitForChild(backpack.Tabs, "WardrobeButton")
local wardrobeButton = backpack.Tabs.WardrobeButton
if game.CoreGui.Version >= 8 then
waitForChild(backpack.Tabs, "WardrobeButton")
local wardrobeButton = backpack.Tabs.WardrobeButton
end
waitForChild(backpack.Parent,"ControlFrame")
local backpackButton = waitForChild(backpack.Parent.ControlFrame,"BackpackButton")
local currentTab = "gear"
@ -54,6 +54,10 @@ local searchBox = waitForChild(backpack.SearchFrame.SearchBoxFrame,"SearchBox")
local searchButton = waitForChild(backpack.SearchFrame,"SearchButton")
local resetButton = waitForChild(backpack.SearchFrame,"ResetButton")
local robloxGui = waitForChild(Game.CoreGui, 'RobloxGui')
local currentLoadout = waitForChild(robloxGui, 'CurrentLoadout')
local loadoutBackground = waitForChild(currentLoadout, 'Background')
local canToggle = true
local readyForNextEvent = true
local backpackIsOpen = false
@ -61,12 +65,20 @@ local active = true
local humanoidDiedCon = nil
local backpackButtonPos
local guiTweenSpeed = 0.25 -- how quickly we open/close the backpack
local searchDefaultText = "Search..."
local tilde = "~"
local backquote = "`"
local backpackSize = UDim2.new(0, 600, 0, 400)
if robloxGui.AbsoluteSize.Y <= 320 then
backpackSize = UDim2.new(0, 200, 0, 140)
end
------------------------ End Locals ---------------------------
@ -118,6 +130,9 @@ function activateBackpack()
initHumanoidDiedConnections()
active = true
backpack.Visible = backpackIsOpen
if backpackIsOpen then
toggleBackpack()
end
end
function initHumanoidDiedConnections()
@ -137,7 +152,7 @@ local hideBackpack = function()
backpackCloseEvent:Fire(currentTab)
backpack.Tabs.Visible = false
searchFrame.Visible = false
backpack:TweenSizeAndPosition(UDim2.new(0,0,0,0),UDim2.new(0.5,0,0.5,0), 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()
game.GuiService:RemoveCenterDialog(backpack)
backpack.Visible = false
@ -147,6 +162,7 @@ local hideBackpack = function()
game.GuiService:RemoveCenterDialog(backpack)
backpack.Visible = false
backpackButton.Selected = false
readyForNextEvent = true
canToggle = true
end)
end
@ -162,20 +178,22 @@ function showBackpack()
backpackButton.Selected = false
end)
backpack.Visible = true
backpackButton.Selected = true
backpack:TweenSizeAndPosition(UDim2.new(0.55, 0, 0.76, 0),UDim2.new(0.225, 0, 0.09, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, guiTweenSpeed, 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)
delay(guiTweenSpeed,function()
backpack.Tabs.Visible = true
backpack.Tabs.Visible = false
searchFrame.Visible = true
backpackOpenEvent:Fire(currentTab)
canToggle = true
readyForNextEvent = true
backpackButton.Image = 'http://www.morblox.us/asset/?id=97644093'
backpackButton.Position = UDim2.new(0.5, -60, 1, -backpackSize.Y.Offset - 103)
end)
end
function toggleBackpack()
function toggleBackpack()
if not game.Players.LocalPlayer 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
@ -183,11 +201,42 @@ function toggleBackpack()
backpackIsOpen = not backpackIsOpen
if backpackIsOpen then
if backpackIsOpen then
loadoutBackground.Image = 'http://www.morblox.us/asset/?id=97623721'
loadoutBackground.Position = UDim2.new(-0.03, 0, -0.17, 0)
loadoutBackground.Size = UDim2.new(1.05, 0, 1.25, 0)
loadoutBackground.ZIndex = 2.0
loadoutBackground.Visible = true
--backpackButton.Position = UDim2.new(0.5, -60, 1, -503)
showBackpack()
else
backpackButton.Selected = false
else
backpackButton.Position = UDim2.new(0.5, -60, 1, -44)
loadoutBackground.Visible = false
backpackButton.Selected = false
backpackButton.Image = "http://www.morblox.us/asset/?id=97617958"
loadoutBackground.Image = 'http://www.morblox.us/asset/?id=96536002'
loadoutBackground.Position = UDim2.new(-0.1, 0, -0.1, 0)
loadoutBackground.Size = UDim2.new(1.2, 0, 1.2, 0)
hideBackpack()
local clChildren = currentLoadout:GetChildren()
for i = 1, #clChildren do
if clChildren[i] and clChildren[i]:IsA('Frame') then
local frame = clChildren[i]
if #frame:GetChildren() > 0 then
backpackButton.Position = UDim2.new(0.5, -60, 1, -108)
backpackButton.Visible = true
loadoutBackground.Visible = true
if frame:GetChildren()[1]:IsA('ImageButton') then
local imgButton = frame:GetChildren()[1]
imgButton.Active = true
imgButton.Draggable = false
end
end
end
end
end
end
@ -314,9 +363,11 @@ inventoryButton.MouseButton1Click:connect(function() newTabClicked("gear") end)
inventoryButton.MouseEnter:connect(function() mouseOverTab(inventoryButton) end)
inventoryButton.MouseLeave:connect(function() mouseLeaveTab(inventoryButton) end)
wardrobeButton.MouseButton1Click:connect(function() newTabClicked("wardrobe") end)
wardrobeButton.MouseEnter:connect(function() mouseOverTab(wardrobeButton) end)
wardrobeButton.MouseLeave:connect(function() mouseLeaveTab(wardrobeButton) end)
if game.CoreGui.Version >= 8 then
wardrobeButton.MouseButton1Click:connect(function() newTabClicked("wardrobe") end)
wardrobeButton.MouseEnter:connect(function() mouseOverTab(wardrobeButton) end)
wardrobeButton.MouseLeave:connect(function() mouseLeaveTab(wardrobeButton) end)
end
closeButton.MouseButton1Click:connect(closeBackpack)
@ -343,6 +394,7 @@ end)
if game.Players.LocalPlayer["Character"] then
activateBackpack()
end
game.Players.LocalPlayer.CharacterAdded:connect(activateBackpack)
-- search functions
@ -356,4 +408,9 @@ end)
searchButton.MouseButton1Click:connect(doSearch)
resetButton.MouseButton1Click:connect(resetSearch)
backpackButton.Visible = true
if searchFrame and robloxGui.AbsoluteSize.Y <= 320 then
searchFrame.RobloxLocked = false
searchFrame:Destroy()
end
--backpackButton.Visible = true

View File

@ -1,9 +1,10 @@
%14%
%14%
-- A couple of necessary functions
local function waitForChild(instance, name)
assert(instance)
assert(name)
while not instance:FindFirstChild(name) do
print('Waiting for ...', instance, name)
instance.ChildAdded:wait()
end
return instance:FindFirstChild(name)
@ -16,6 +17,13 @@ local function waitForProperty(instance, property)
end
end
local function IsTouchDevice()
local touchEnabled = false
pcall(function() touchEnabled = Game:GetService('UserInputService').TouchEnabled end)
return touchEnabled
end
waitForChild(game,"Players")
waitForProperty(game.Players,"LocalPlayer")
local player = game.Players.LocalPlayer
@ -67,7 +75,7 @@ local searchRequestedEvent = waitForChild(backpackManager,"SearchRequestedEvent"
local tellBackpackReadyFunc = waitForChild(backpackManager,"BackpackReady")
-- creating scroll bar early as to make sure items get placed correctly
local scrollFrame, scrollUp, scrollDown, recalculateScroll = RbxGui.CreateScrollingFrame(nil,"grid")
local scrollFrame, scrollUp, scrollDown, recalculateScroll = RbxGui.CreateScrollingFrame(nil, "grid", Vector2.new(6, 6))
scrollFrame.Position = UDim2.new(0,0,0,30)
scrollFrame.Size = UDim2.new(1,0,1,-30)
@ -236,6 +244,7 @@ end
function previewGear(button)
if not browsingMenu then
gearPreview.Visible = false
gearPreview.GearImage.Image = button.Image
gearPreview.GearStats.GearName.Text = button.GearReference.Value.Name
end
@ -276,7 +285,7 @@ end
function resizeGrid()
for k,v in pairs(backpackItems) do
if not v:FindFirstChild("RobloxBuildTool") then
if not buttons[v] then
if not buttons[v] then
local buttonClone = gearButton:clone()
buttonClone.Parent = grid.ScrollingFrame
buttonClone.Visible = true
@ -289,18 +298,26 @@ function resizeGrid()
buttonClone.Draggable = true
buttons[v] = buttonClone
local unequipMenu = getGearContextMenu()
if not IsTouchDevice() then
local unequipMenu = getGearContextMenu()
unequipMenu.Visible = false
unequipMenu.Parent = buttonClone
unequipMenu.Visible = false
unequipMenu.Parent = buttonClone
end
local beginPos = nil
buttonClone.DragBegin:connect(function(value)
buttonClone.ZIndex = 9
waitForChild(buttonClone, 'Background')
buttonClone['Background'].ZIndex = 10
buttonClone.ZIndex = 10
beginPos = value
end)
buttonClone.DragStopped:connect(function(x,y)
buttonClone.ZIndex = 1
waitForChild(buttonClone, 'Background')
buttonClone['Background'].ZIndex = 1.0
buttonClone.ZIndex = 2
if beginPos ~= buttonClone.Position then
if not checkForSwap(buttonClone,x,y) then
buttonClone:TweenPosition(beginPos,Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true)
@ -622,7 +639,7 @@ function nukeBackpack()
end
end
function getGearContextMenu()
function getGearContextMenu()
local gearContextMenu = Instance.new("Frame")
gearContextMenu.Active = true
gearContextMenu.Name = "UnequipContextMenu"
@ -671,27 +688,30 @@ function getGearContextMenu()
button.ZIndex = 9
button.Parent = gearContextMenuButton
button.MouseButton1Click:connect(function()
if button.Active and not gearContextMenu.Parent.Active then
local success, result = pcall(function() element.DoIt(element, gearContextMenu) end)
browsingMenu = false
gearContextMenu.Visible = false
clearHighlight(button)
clearPreview()
end
end)
button.MouseEnter:connect(function()
if button.Active and gearContextMenu.Parent.Active then
highlight(button)
end
end)
button.MouseLeave:connect(function()
if button.Active and gearContextMenu.Parent.Active then
clearHighlight(button)
end
end)
if not IsTouchDevice() then
button.MouseButton1Click:connect(function()
if button.Active and not gearContextMenu.Parent.Active then
local success, result = pcall(function() element.DoIt(element, gearContextMenu) end)
browsingMenu = false
gearContextMenu.Visible = false
clearHighlight(button)
clearPreview()
end
end)
button.MouseEnter:connect(function()
if button.Active and gearContextMenu.Parent.Active then
highlight(button)
end
end)
button.MouseLeave:connect(function()
if button.Active and gearContextMenu.Parent.Active then
clearHighlight(button)
end
end)
end
contextElement.Button = button
contextElement.Element = button
elseif element.Type == "Label" then

View File

@ -1,4 +1,4 @@
%15%
%15%
if game.CoreGui.Version < 3 then return end -- peace out if we aren't using the right client
-- A couple of necessary functions
@ -19,16 +19,47 @@ local StaticTabName = "gear"
local robloxGui = game:GetService("CoreGui"):FindFirstChild("RobloxGui")
assert(robloxGui)
local controlFrame = waitForChild(robloxGui, 'ControlFrame')
local backpackButton = waitForChild(controlFrame, 'BackpackButton')
local backpack = waitForChild(robloxGui, 'Backpack')
waitForChild(robloxGui,"CurrentLoadout")
waitForChild(robloxGui.CurrentLoadout,"TempSlot")
waitForChild(robloxGui.CurrentLoadout.TempSlot,"SlotNumber")
waitForChild(currentLoadout, 'Background')
local clBackground = currentLoadout.Background
local function IsTouchDevice()
local touchEnabled = false
pcall(function() touchEnabled = Game:GetService('UserInputService').TouchEnabled end)
return touchEnabled
end
local function moveHealthBar(pGui)
waitForChild(pGui, 'HealthGUI')
waitForChild(pGui['HealthGUI'], 'tray')
local tray = pGui['HealthGUI']['tray']
tray.Position = UDim2.new(0.5, -85, 1, -26)
end
--- Begin Locals
waitForChild(game,"Players")
waitForProperty(game.Players,"LocalPlayer")
local player = game.Players.LocalPlayer
waitForChild(player, 'PlayerGui')
Spawn(function()
moveHealthBar(player.PlayerGui)
end)
while player.Character == nil do wait(0.03) end
local humanoid = waitForChild(player.Character, 'Humanoid')
humanoid.Died:connect(function()
backpackButton.Visible = false
end)
waitForChild(game, "LocalBackpack")
game.LocalBackpack:SetOldSchoolBackpack(false)
@ -44,6 +75,10 @@ local resizeEvent = waitForChild(backpackManager,"ResizeEvent")
local inGearTab = true
local maxNumLoadoutItems = 10
if robloxGui.AbsoluteSize.Y <= 320 then
maxNumLoadoutItems = 4
end
local characterChildAddedCon = nil
local backpackChildCon = nil
@ -56,6 +91,8 @@ local buttonSizeNormal = UDim2.new(1,0,1,0)
local enlargeOverride = true
local guiTweenSpeed = 0.5
local firstInstanceOfLoadout = false
local inventory = {}
for i = 0, 9 do
@ -66,6 +103,8 @@ local gearSlots = {}
for i = 1, maxNumLoadoutItems do
gearSlots[i] = "empty"
end
local backpackWasOpened = false
--- End Locals
@ -74,6 +113,14 @@ end
-- Begin Functions
local function backpackIsOpen()
if guiBackpack then
return guiBackpack.Visible
end
return false
end
local function kill(prop,con,gear)
if con then con:disconnect() end
if prop == true and gear then
@ -118,15 +165,35 @@ function removeGear(gear)
gearSlots[emptySlot] = "empty"
local centerizeX = gear.Size.X.Scale/2
local centerizeY = gear.Size.Y.Scale/2
gear:TweenSizeAndPosition(UDim2.new(0,0,0,0),
local centerizeY = gear.Size.Y.Scale/2
--[[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),
Enum.EasingDirection.Out, Enum.EasingStyle.Quad,guiTweenSpeed/4,true)
delay(guiTweenSpeed/2,
Enum.EasingDirection.Out, Enum.EasingStyle.Quad,guiTweenSpeed/4,true)]]
delay(0,
function()
gear:remove()
end)
end
end)
Spawn(function()
while backpackIsOpen() do wait(0.03) end
waitForChild(player, 'Backpack')
local allEmpty = true
for i = 1, #gearSlots do
if gearSlots[i] ~= 'empty' then
allEmpty = false
end
end
if allEmpty then
if #player.Backpack:GetChildren() < 1 then
backpackButton.Visible = false
else
backpackButton.Position = UDim2.new(0.5, -60, 1, -44)
end
clBackground.Visible = false
end
end)
end
end
function insertGear(gear, addToSlot)
@ -320,8 +387,12 @@ enlargeButton = function(button)
return
end
if button:FindFirstChild('Highlight') then
button.Highlight.Visible = true
end
if button:IsA("ImageButton") or button:IsA("TextButton") then
button.ZIndex = 2
button.ZIndex = 5
local centerizeX = -(buttonSizeEnlarge.X.Scale - button.Size.X.Scale)/2
local centerizeY = -(buttonSizeEnlarge.Y.Scale - button.Size.Y.Scale)/2
button:TweenSizeAndPosition(buttonSizeEnlarge,
@ -349,6 +420,10 @@ normalizeButton = function(button, speed)
local moveSpeed = speed
if moveSpeed == nil or type(moveSpeed) ~= "number" then moveSpeed = guiTweenSpeed/5 end
if button:FindFirstChild('Highlight') then
button.Highlight.Visible = false
end
if button:IsA("ImageButton") or button:IsA("TextButton") then
button.ZIndex = 1
local inverseEnlarge = 1/enlargeFactor
@ -463,7 +538,7 @@ function unequipAllItems(dontEquipThis)
end
function showToolTip(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") and not IsTouchDevice() then
button.ToolTipLabel.Text = tostring(tip)
local xSize = button.ToolTipLabel.TextBounds.X + 6
button.ToolTipLabel.Size = UDim2.new(0,xSize,0,20)
@ -478,7 +553,7 @@ function hideToolTip(button, tip)
end
end
local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButton)
local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButton)
waitForDebounce()
debounce = true
@ -495,11 +570,10 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt
if gearSlots[i] ~= "empty" and gearSlots[i].GearReference.Value == child then -- we already have gear, do nothing
debounce = false
return
end
end
end
end
local gearClone = currentLoadout.TempSlot:clone()
gearClone.Name = child.Name
gearClone.GearImage.Image = child.TextureId
@ -586,8 +660,8 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt
end
end)
dragBegin = gearClone.DragBegin:connect(function(pos)
dragBeginPos = pos
gearClone.ZIndex = 7
dragBeginPos = pos
gearClone.ZIndex = 7
local children = gearClone:GetChildren()
for i = 1, #children do
if children[i]:IsA("TextLabel") then
@ -603,9 +677,9 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt
end)
dragStop = gearClone.DragStopped:connect(function(x,y)
if gearClone.Selected then
gearClone.ZIndex = 2
gearClone.ZIndex = 4
else
gearClone.ZIndex = 1
gearClone.ZIndex = 3
end
local children = gearClone:GetChildren()
for i = 1, #children do
@ -665,6 +739,16 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt
debounce = false
Spawn(function()
while backpackIsOpen() do wait(0.03) end
for i = 1, #gearSlots do
if gearSlots[i] ~= 'empty' then
backpackButton.Position = UDim2.new(0.5, -60, 1, -108)
backpackButton.Visible = true
clBackground.Visible = true
end
end
end)
end
function addToInventory(child)
@ -700,8 +784,12 @@ local spreadOutGear = function()
if loadoutChildren[i]:IsA("Frame") then
loadoutChildren[i].BackgroundTransparency = 0.5
local slot = tonumber(string.sub(loadoutChildren[i].Name,5))
if slot == 0 then slot = 10 end
loadoutChildren[i]:TweenPosition(UDim2.new((slot - 1)/10,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, true)
if slot == 0 then slot = 10 end
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)
else
loadoutChildren[i]:TweenPosition(UDim2.new((slot - 1)/10,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, true)
end
end
end
end
@ -709,7 +797,7 @@ end
local centerGear = function()
loadoutChildren = currentLoadout:GetChildren()
local gearButtons = {}
local lastSlotAdd = nlii
local lastSlotAdd = nil
for i = 1, #loadoutChildren do
if loadoutChildren[i]:IsA("Frame") then
@ -726,12 +814,18 @@ local centerGear = function()
if lastSlotAdd then table.insert(gearButtons,lastSlotAdd) end
local startPos = ( 1 - (#gearButtons * 0.1) ) / 2
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)
for i = 1, #gearButtons do
if robloxGui.AbsoluteSize.Y <= 320 then
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)
else
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
function editLoadout()
backpackWasOpened = true
if inGearTab then
spreadOutGear()
end
@ -743,12 +837,17 @@ function readonlyLoadout()
end
end
function setupBackpackListener()
function setupBackpackListener()
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
firstInstanceOfLoadout = true
backpackButton.Visible = true
clBackground.Visible = true
end
addingPlayerChild(child)
addToInventory(child)
end)
end)
end
function playerCharacterChildAdded(child)
@ -784,12 +883,41 @@ wait() -- let stuff initialize incase this is first heartbeat...
waitForChild(player,"Backpack")
waitForProperty(player,"Character")
local backpackChildren = player.Backpack:GetChildren()
local size = math.min(10,#backpackChildren)
for i = 1, size do
addingPlayerChild(backpackChildren[i],false)
end
setupBackpackListener()
-- not sure why this had no delay but the player.CharacterAdded one had one... this type of error would be easier to avoid with function reusage
delay(1,function()
local backpackChildren = player.Backpack:GetChildren()
local size = math.min(10,#backpackChildren)
for i = 1, size do
backpackButton.Visible = true
clBackground.Visible = true
addingPlayerChild(backpackChildren[i],false)
end
setupBackpackListener()
end)
delay(0, function()
for i = 1, 30 do
if not backpackWasOpened then
if robloxGui.AbsoluteSize.Y <= 320 then
local cChildren = currentLoadout:GetChildren()
for i = 1, #cChildren do
local slotNum = tonumber(string.sub(cChildren[i].Name, 5, string.len(cChildren[i].Name)))
if type(slotNum) == 'number' then
cChildren[i].Position = UDim2.new(0, (slotNum-1) * 60, 0, 0)
end
end
end
end
wait(0.25)
end
end)
player.ChildAdded:connect(function(child)
if child:IsA('PlayerGui') then
moveHealthBar(child)
end
end)
waitForProperty(player,"Character")
for i,v in ipairs(player.Character:GetChildren()) do
@ -802,6 +930,7 @@ humanoidDiedCon = player.Character.Humanoid.Died:connect(function()
if humanoidDiedCon then humanoidDiedCon:disconnect() humanoidDiedCon = nil end
deactivateLoadout()
if backpackChildCon then backpackChildCon:disconnect() backpackChildCon = nil end
backpackWasOpened = false
end)
player.CharacterRemoving:connect(function()
@ -813,22 +942,24 @@ player.CharacterRemoving:connect(function()
end
end)
player.CharacterAdded:connect(function()
waitForProperty(game.Players,"LocalPlayer")
player.CharacterAdded:connect(function()
waitForProperty(game.Players,"LocalPlayer")
player = game.Players.LocalPlayer -- make sure we are still looking at the correct character
waitForChild(player,"Backpack")
waitForChild(player,"Backpack")
delay(1,function()
local backpackChildren = player.Backpack:GetChildren()
local size = math.min(10,#backpackChildren)
for i = 1, size do
backpackButton.Visible = true
clBackground.Visible = true
addingPlayerChild(backpackChildren[i],false)
end
setupBackpackListener()
end)
activateLoadout()
activateLoadout()
if characterChildAddedCon then
characterChildAddedCon:disconnect()
@ -841,14 +972,37 @@ player.CharacterAdded:connect(function()
end)
waitForChild(player.Character,"Humanoid")
if backpack.Visible then
backpackOpenEvent:Fire()
end
humanoidDiedCon =
player.Character.Humanoid.Died:connect(function()
deactivateLoadout()
backpackButton.Visible = false
clBackground.Visible = false
firstInstanceOfLoadout = false
deactivateLoadout()
if humanoidDiedCon then humanoidDiedCon:disconnect() humanoidDiedCon = nil end
if backpackChildCon then backpackChildCon:disconnect() backpackChildCon = nil end
end)
waitForChild(player, 'PlayerGui')
moveHealthBar(player.PlayerGui)
delay(0, function()
for i = 1, 30 do
if not backpackWasOpened then
if robloxGui.AbsoluteSize.Y <= 320 then
local cChildren = currentLoadout:GetChildren()
for i = 1, #cChildren do
local slotNum = tonumber(string.sub(cChildren[i].Name, 5, string.len(cChildren[i].Name)))
if type(slotNum) == 'number' then
cChildren[i].Position = UDim2.new(0, (slotNum-1) * 60, 0, 0)
end
end
end
end
wait(0.25)
end
end)
end)
waitForChild(guiBackpack,"SwapSlot")