updated 1,12,13,14,15,16

This commit is contained in:
Thomas G 2022-07-05 14:27:49 +10:00
parent 7203529ebc
commit a4ed01c567
6 changed files with 2486 additions and 1943 deletions

View File

@ -70,26 +70,22 @@ else
end
if game.CoreGui.Version >= 3 then
waitForProperty(game,"PlaceId")
local inRightPlace = true
for i,v in ipairs(backpackTestPlaces) do
if v == game.PlaceId then
inRightPlace = true
break
end
-- Backpack Builder, creates most of the backpack gui
scriptContext:AddCoreScript(12,screenGui,"CoreScripts/BackpackScripts/BackpackBuilder")
waitForChild(screenGui,"CurrentLoadout")
waitForChild(screenGui,"Backpack")
local Backpack = screenGui.Backpack
-- Manager handles all big backpack state changes, other scripts subscribe to this and do things accordingly
if game.CoreGui.Version >= 7 then
scriptContext:AddCoreScript(13,Backpack,"CoreScripts/BackpackScripts/BackpackManager")
end
waitForChild(game,"Players")
waitForProperty(game.Players,"LocalPlayer")
if game.Players.LocalPlayer.userId == 7210880 or game.Players.LocalPlayer.userId == 0 then inRightPlace = true end
if not inRightPlace then return end -- restricting availability of backpack
-- Backpack Builder
scriptContext:AddCoreScript(12,screenGui,"BackpackBuilder")
waitForChild(screenGui,"CurrentLoadout")
waitForChild(screenGui.CurrentLoadout,"TempSlot")
waitForChild(screenGui.CurrentLoadout.TempSlot,"SlotNumber")
-- Backpack Script
scriptContext:AddCoreScript(13,screenGui.CurrentLoadout,"BackpackScript")
-- Backpack Gear (handles all backpack gear tab stuff)
game:GetService("ScriptContext"):AddCoreScript(14,Backpack,"CoreScripts/BackpackScripts/BackpackGear")
-- Loadout Script, used for gear hotkeys
scriptContext:AddCoreScript(15,screenGui.CurrentLoadout,"CoreScripts/BackpackScripts/LoadoutScript")
-- Wardrobe script handles all character dressing operations
scriptContext:AddCoreScript(16,Backpack,"CoreScripts/BackpackScripts/BackpackWardrobe")
end

View File

@ -1,5 +1,6 @@
%12%
--- ATTENTION!!! There are site-specific ids at the end of this script!!!!!!!!!!!!!!!!!!!!
-- This script creates almost all gui elements found in the backpack (warning: there are a lot!)
-- TODO: automate this process
if game.CoreGui.Version < 3 then return end -- peace out if we aren't using the right client
@ -76,6 +77,23 @@ TempSlot.Parent = CurrentLoadout
GearReference.Name = "GearReference"
GearReference.RobloxLocked = true
GearReference.Parent = TempSlot
local ToolTipLabel = Instance.new("TextLabel")
ToolTipLabel.Name = "ToolTipLabel"
ToolTipLabel.RobloxLocked = true
ToolTipLabel.Text = ""
ToolTipLabel.BackgroundTransparency = 0.5
ToolTipLabel.BorderSizePixel = 0
ToolTipLabel.Visible = false
ToolTipLabel.TextColor3 = Color3.new(1,1,1)
ToolTipLabel.BackgroundColor3 = Color3.new(0,0,0)
ToolTipLabel.TextStrokeTransparency = 0
ToolTipLabel.Font = Enum.Font.ArialBold
ToolTipLabel.FontSize = Enum.FontSize.Size14
--ToolTipLabel.TextWrap = true
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"
@ -136,12 +154,13 @@ TempSlot.Parent = CurrentLoadout
--- Great, now lets make the inventory!
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.Size = UDim2.new(0,0,0,0)
Backpack.Style = Enum.FrameStyle.RobloxSquare
Backpack.RobloxLocked = true
Backpack.BackgroundColor3 = Color3.new(0,0,0)
Backpack.BackgroundTransparency = 0.08
Backpack.BorderSizePixel = 0
Backpack.Parent = gui
Backpack.Active = true
@ -164,49 +183,146 @@ Backpack.Active = true
local Tabs = Instance.new("Frame")
Tabs.Name = "Tabs"
Tabs.Visible = false
Tabs.Visible = true
Tabs.RobloxLocked = true
Tabs.BackgroundColor3 = Color3.new(0,0,0)
Tabs.BackgroundTransparency = 0.5
Tabs.BackgroundTransparency = 0.08
Tabs.BorderSizePixel = 0
Tabs.Position = UDim2.new(0,-8,-0.1,-8)
Tabs.Size = UDim2.new(1,16,0.1,0)
Tabs.Position = UDim2.new(0,0,-0.1,-4)
Tabs.Size = UDim2.new(1,0,0.1,4)
Tabs.Parent = Backpack
-- Tabs Children
local InventoryButton = Instance.new("ImageButton")
local tabLine = Instance.new("Frame")
tabLine.RobloxLocked = true
tabLine.Name = "TabLine"
tabLine.BackgroundColor3 = Color3.new(53/255, 53/255, 53/255)
tabLine.BorderSizePixel = 0
tabLine.Position = UDim2.new(0,5,1,-4)
tabLine.Size = UDim2.new(1,-10,0,4)
tabLine.ZIndex = 2
tabLine.Parent = Tabs
local InventoryButton = Instance.new("TextButton")
InventoryButton.RobloxLocked = true
InventoryButton.Name = "InventoryButton"
InventoryButton.Size = UDim2.new(0.12,0,1,0)
InventoryButton.Style = Enum.ButtonStyle.RobloxButton
InventoryButton.Size = UDim2.new(0,60,0,30)
InventoryButton.Position = UDim2.new(0,7,1,-31)
InventoryButton.BackgroundColor3 = Color3.new(1,1,1)
InventoryButton.BorderColor3 = Color3.new(1,1,1)
InventoryButton.Font = Enum.Font.ArialBold
InventoryButton.FontSize = Enum.FontSize.Size18
InventoryButton.Text = "Gear"
InventoryButton.AutoButtonColor = false
InventoryButton.TextColor3 = Color3.new(0,0,0)
InventoryButton.Selected = true
InventoryButton.Active = true
InventoryButton.ZIndex = 3
InventoryButton.Parent = Tabs
-- InventoryButton Children
local InventoryText = Instance.new("TextLabel")
InventoryText.RobloxLocked = true
InventoryText.Name = "InventoryText"
InventoryText.BackgroundTransparency = 1
InventoryText.Font = Enum.Font.ArialBold
InventoryText.FontSize = Enum.FontSize.Size18
InventoryText.Position = UDim2.new(0,-7,0,-7)
InventoryText.Size = UDim2.new(1,14,1,14)
InventoryText.Text = "Gear"
InventoryText.TextColor3 = Color3.new(1,1,1)
InventoryText.Parent = InventoryButton
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
closeButton.Name = "CloseButton"
closeButton.Font = Enum.Font.ArialBold
closeButton.FontSize = Enum.FontSize.Size24
closeButton.Position = UDim2.new(1,-33,0,2)
closeButton.Position = UDim2.new(1,-33,0,4)
closeButton.Size = UDim2.new(0,30,0,30)
closeButton.Style = Enum.ButtonStyle.RobloxButton
closeButton.Text = "X"
closeButton.Text = ""
closeButton.TextColor3 = Color3.new(1,1,1)
closeButton.Parent = Tabs
closeButton.Modal = true
--closeButton child
local XImage = Instance.new("ImageLabel")
XImage.RobloxLocked = true
XImage.Name = "XImage"
game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=75547445")
XImage.Image = "http://www.roblox.com/asset/?id=75547445" --TODO: move to rbxasset
XImage.BackgroundTransparency = 1
XImage.Position = UDim2.new(-.25,-1,-.25,-1)
XImage.Size = UDim2.new(1.5,2,1.5,2)
XImage.ZIndex = 2
XImage.Parent = closeButton
-- Generic Search gui used across backpack
local SearchFrame = Instance.new("Frame")
SearchFrame.RobloxLocked = true
SearchFrame.Name = "SearchFrame"
SearchFrame.BackgroundTransparency = 1
SearchFrame.Position = UDim2.new(1,-220,0,2)
SearchFrame.Size = UDim2.new(0,220,0,24)
SearchFrame.Parent = Backpack
-- SearchFrame Children
local SearchButton = Instance.new("ImageButton")
SearchButton.RobloxLocked = true
SearchButton.Name = "SearchButton"
SearchButton.Size = UDim2.new(0,25,0,25)
SearchButton.BackgroundTransparency = 1
SearchButton.Image = "rbxasset://textures/ui/SearchIcon.png"
SearchButton.Parent = SearchFrame
local SearchBoxFrame = Instance.new("TextButton")
SearchBoxFrame.RobloxLocked = true
SearchBoxFrame.Position = UDim2.new(0,25,0,0)
SearchBoxFrame.Size = UDim2.new(1,-28,0,26)
SearchBoxFrame.Name = "SearchBoxFrame"
SearchBoxFrame.Text = ""
SearchBoxFrame.Style = Enum.ButtonStyle.RobloxButton
SearchBoxFrame.Parent = SearchFrame
-- SearchBoxFrame Children
local SearchBox = Instance.new("TextBox")
SearchBox.RobloxLocked = true
SearchBox.Name = "SearchBox"
SearchBox.BackgroundTransparency = 1
SearchBox.Font = Enum.Font.ArialBold
SearchBox.FontSize = Enum.FontSize.Size12
SearchBox.Position = UDim2.new(0,-5,0,-5)
SearchBox.Size = UDim2.new(1,10,1,10)
SearchBox.TextColor3 = Color3.new(1,1,1)
SearchBox.TextXAlignment = Enum.TextXAlignment.Left
SearchBox.ZIndex = 2
SearchBox.TextWrap = true
SearchBox.Text = "Search..."
SearchBox.Parent = SearchBoxFrame
local ResetButton = Instance.new("TextButton")
ResetButton.RobloxLocked = true
ResetButton.Visible = false
ResetButton.Name = "ResetButton"
ResetButton.Position = UDim2.new(1,-26,0,3)
ResetButton.Size = UDim2.new(0,20,0,20)
ResetButton.Style = Enum.ButtonStyle.RobloxButtonDefault
ResetButton.Text = "X"
ResetButton.TextColor3 = Color3.new(1,1,1)
ResetButton.Font = Enum.Font.ArialBold
ResetButton.FontSize = Enum.FontSize.Size18
ResetButton.ZIndex = 3
ResetButton.Parent = SearchFrame
------------------------------- GEAR -------------------------------------------------------
local Gear = Instance.new("Frame")
Gear.Name = "Gear"
Gear.RobloxLocked = true
@ -215,84 +331,22 @@ Backpack.Active = true
Gear.Parent = Backpack
-- Gear Children
local AssetsList = Instance.new("Frame")
AssetsList.RobloxLocked = true
AssetsList.Name = "AssetsList"
AssetsList.BackgroundTransparency = 1
AssetsList.Size = UDim2.new(0.2,0,1,0)
AssetsList.Style = Enum.FrameStyle.RobloxSquare
AssetsList.Visible = false
AssetsList.Parent = Gear
local GearGrid = Instance.new("Frame")
GearGrid.RobloxLocked = true
GearGrid.Name = "GearGrid"
GearGrid.Size = UDim2.new(0.69,0,1,0)
GearGrid.Style = Enum.FrameStyle.RobloxSquare
GearGrid.BackgroundTransparency = 1
GearGrid.Parent = Gear
-- GearGrid Children
local ResetFrame = Instance.new("Frame")
ResetFrame.RobloxLocked = true
ResetFrame.Name = "ResetFrame"
ResetFrame.Visible = false
ResetFrame.BackgroundTransparency = 1
ResetFrame.Size = UDim2.new(0,32,0,64)
ResetFrame.Parent = GearGrid
-- ResetFrame Children
local ResetImageLabel = Instance.new("ImageLabel")
ResetImageLabel.RobloxLocked = true
ResetImageLabel.Name = "ResetImageLabel"
ResetImageLabel.Image = "rbxasset://textures/ui/ResetIcon.png"
ResetImageLabel.BackgroundTransparency = 1
ResetImageLabel.Position = UDim2.new(0,0,0,-12)
ResetImageLabel.Size = UDim2.new(0.8,0,0.79,0)
ResetImageLabel.ZIndex = 2
ResetImageLabel.Parent = ResetFrame
local ResetButtonBorder = Instance.new("TextButton")
ResetButtonBorder.RobloxLocked = true
ResetButtonBorder.Name = "ResetButtonBorder"
ResetButtonBorder.Position = UDim2.new(0,-3,0,-7)
ResetButtonBorder.Size = UDim2.new(1,0,0.64,0)
ResetButtonBorder.Style = Enum.ButtonStyle.RobloxButton
ResetButtonBorder.Text = ""
ResetButtonBorder.Parent = ResetFrame
local SearchFrame = Instance.new("Frame")
SearchFrame.RobloxLocked = true
SearchFrame.Name = "SearchFrame"
SearchFrame.BackgroundTransparency = 1
SearchFrame.Position = UDim2.new(1,-150,0,0)
SearchFrame.Size = UDim2.new(0,150,0,25)
SearchFrame.Parent = GearGrid
-- SearchFrame Children
local SearchButton = Instance.new("ImageButton")
SearchButton.RobloxLocked = true
SearchButton.Name = "SearchButton"
SearchButton.Size = UDim2.new(0,25,0,25)
SearchButton.BackgroundTransparency = 1
SearchButton.Image = "rbxasset://textures/ui/SearchIcon.png"
SearchButton.Parent = SearchFrame
local SearchBoxFrame = Instance.new("TextButton")
SearchBoxFrame.RobloxLocked = true
SearchBoxFrame.Position = UDim2.new(0,26,0,0)
SearchBoxFrame.Size = UDim2.new(0,121,0,25)
SearchBoxFrame.Name = "SearchBoxFrame"
SearchBoxFrame.Text = ""
SearchBoxFrame.Style = Enum.ButtonStyle.RobloxButton
SearchBoxFrame.Parent = SearchFrame
-- SearchBoxFrame Children
local SearchBox = Instance.new("TextBox")
SearchBox.RobloxLocked = true
SearchBox.Name = "SearchBox"
SearchBox.BackgroundTransparency = 1
SearchBox.Font = Enum.Font.ArialBold
SearchBox.FontSize = Enum.FontSize.Size12
SearchBox.Position = UDim2.new(0,-5,0,-5)
SearchBox.Size = UDim2.new(1,10,1,10)
SearchBox.TextColor3 = Color3.new(1,1,1)
SearchBox.TextXAlignment = Enum.TextXAlignment.Left
SearchBox.ZIndex = 2
SearchBox.TextWrap = true
SearchBox.Text = "Search..."
SearchBox.Parent = SearchBoxFrame
local GearButton = Instance.new("ImageButton")
GearButton.RobloxLocked = true
@ -335,8 +389,8 @@ Backpack.Active = true
local GearGridScrollingArea = Instance.new("Frame")
GearGridScrollingArea.RobloxLocked = true
GearGridScrollingArea.Name = "GearGridScrollingArea"
GearGridScrollingArea.Position = UDim2.new(0.7,0,0,0)
GearGridScrollingArea.Size = UDim2.new(0,17,1,0)
GearGridScrollingArea.Position = UDim2.new(0.7,0,0,35)
GearGridScrollingArea.Size = UDim2.new(0,17,1,-45)
GearGridScrollingArea.BackgroundTransparency = 1
GearGridScrollingArea.Parent = Gear
@ -385,14 +439,14 @@ Backpack.Active = true
LoadoutsList.Size = UDim2.new(1,-17,0.85,-2)
LoadoutsList.Style = Enum.FrameStyle.RobloxSquare
LoadoutsList.Parent = GearLoadouts
local GearPreview = Instance.new("Frame")
GearPreview.RobloxLocked = true
GearPreview.Name = "GearPreview"
GearPreview.Position = UDim2.new(0.7,23,0,0)
GearPreview.Size = UDim2.new(0.3,-23,0.5,-1)
GearPreview.Style = Enum.FrameStyle.RobloxRound
GearPreview.Size = UDim2.new(0.3,-28,0.5,-1)
GearPreview.BackgroundTransparency = 1
GearPreview.ZIndex = 7
GearPreview.Parent = Gear
-- GearPreview Children
@ -402,6 +456,7 @@ Backpack.Active = true
GearStats.BackgroundTransparency = 1
GearStats.Position = UDim2.new(0,0,0.75,0)
GearStats.Size = UDim2.new(1,0,0.25,0)
GearStats.ZIndex = 8
GearStats.Parent = GearPreview
-- GearStats Children
@ -416,6 +471,7 @@ Backpack.Active = true
GearName.Text = ""
GearName.TextColor3 = Color3.new(1,1,1)
GearName.TextWrap = true
GearName.ZIndex = 9
GearName.Parent = GearStats
local GearImage = Instance.new("ImageLabel")
@ -425,6 +481,7 @@ Backpack.Active = true
GearImage.BackgroundTransparency = 1
GearImage.Position = UDim2.new(0.125,0,0,0)
GearImage.Size = UDim2.new(0.75,0,0.75,0)
GearImage.ZIndex = 8
GearImage.Parent = GearPreview
--GearImage Children
@ -437,6 +494,7 @@ Backpack.Active = true
GearIcons.Position = UDim2.new(0.4,2,0.85,-2)
GearIcons.Size = UDim2.new(0.6,0,0.15,0)
GearIcons.Visible = false
GearIcons.ZIndex = 9
GearIcons.Parent = GearImage
-- GearIcons Children
@ -470,8 +528,264 @@ Backpack.Active = true
AttributeThreeImage.Position = UDim2.new(0.75,0,0,0)
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
-- Backpack Resizer (handles all backpack resizing junk)
game:GetService("ScriptContext"):AddCoreScript(11,Backpack,"BackpackResizer")
local function makeCharFrame(frameName, parent)
local frame = Instance.new("Frame")
frame.RobloxLocked = true
frame.Size = UDim2.new(1,0,1,-70)
frame.Position = UDim2.new(0,0,0,20)
frame.Name = frameName
frame.BackgroundTransparency = 1
frame.Parent = parent
frame.Visible = false
return frame
end
local function makeZone( zoneName, image, size, position, parent )
local zone = Instance.new("ImageLabel")
zone.RobloxLocked = true
zone.Name = zoneName
zone.Image = image
zone.Size = size
zone.BackgroundTransparency = 1
zone.Position = position
zone.Parent = parent
return zone
end
local function makeStyledButton( buttonName, size, position, parent, buttonStyle )
local button = Instance.new("ImageButton")
button.RobloxLocked = true
button.Name = buttonName
button.Size = size
button.Position = position
if buttonStyle then
button.Style = buttonStyle
else
button.BackgroundColor3 = Color3.new(0,0,0)
button.BorderColor3 = Color3.new(1,1,1)
end
button.Parent = parent
return button
end
local function makeTextLabel( TextLabelName,text,position,parent )
local label = Instance.new("TextLabel")
label.RobloxLocked = true
label.BackgroundTransparency = 1
label.Size = UDim2.new(0,32,0,14)
label.Name = TextLabelName
label.Font = Enum.Font.Arial
label.TextColor3 = Color3.new(1,1,1)
label.FontSize = Enum.FontSize.Size14
label.Text = text
label.Position = position
label.Parent = parent
end
local Wardrobe = Instance.new("Frame")
Wardrobe.Name = "Wardrobe"
Wardrobe.RobloxLocked = true
Wardrobe.BackgroundTransparency = 1
Wardrobe.Visible = false
Wardrobe.Size = UDim2.new(1,0,1,0)
Wardrobe.Parent = Backpack
local AssetList = Instance.new("Frame")
AssetList.RobloxLocked = true
AssetList.Name = "AssetList"
AssetList.Position = UDim2.new(0,4,0,5)
AssetList.Size = UDim2.new(0,85,1,-5)
AssetList.BackgroundTransparency = 1
AssetList.Visible = true
AssetList.Parent = Wardrobe
local PreviewAssetFrame = Instance.new("Frame")
PreviewAssetFrame.RobloxLocked = true
PreviewAssetFrame.Name = "PreviewAssetFrame"
PreviewAssetFrame.BackgroundTransparency = 1
PreviewAssetFrame.Position = UDim2.new(1,-240,0,30)
PreviewAssetFrame.Size = UDim2.new(0,250,0,250)
PreviewAssetFrame.Parent = Wardrobe
local PreviewAssetBacking = Instance.new("TextButton")
PreviewAssetBacking.RobloxLocked = true
PreviewAssetBacking.Name = "PreviewAssetBacking"
PreviewAssetBacking.Active = false
PreviewAssetBacking.Text = ""
PreviewAssetBacking.AutoButtonColor = false
PreviewAssetBacking.Size = UDim2.new(1,0,1,0)
PreviewAssetBacking.Style = Enum.ButtonStyle.RobloxButton
PreviewAssetBacking.Visible = false
PreviewAssetBacking.ZIndex = 9
PreviewAssetBacking.Parent = PreviewAssetFrame
local PreviewAssetImage = Instance.new("ImageLabel")
PreviewAssetImage.RobloxLocked = true
PreviewAssetImage.Name = "PreviewAssetImage"
PreviewAssetImage.BackgroundTransparency = 0.8
PreviewAssetImage.Position = UDim2.new(0.5,-100,0,0)
PreviewAssetImage.Size = UDim2.new(0,200,0,200)
PreviewAssetImage.BorderSizePixel = 0
PreviewAssetImage.ZIndex = 10
PreviewAssetImage.Parent = PreviewAssetBacking
local AssetNameLabel = Instance.new("TextLabel")
AssetNameLabel.Name = "AssetNameLabel"
AssetNameLabel.RobloxLocked = true
AssetNameLabel.BackgroundTransparency = 1
AssetNameLabel.Position = UDim2.new(0,0,1,-20)
AssetNameLabel.Size = UDim2.new(0.5,0,0,24)
AssetNameLabel.ZIndex = 10
AssetNameLabel.Font = Enum.Font.Arial
AssetNameLabel.Text = ""
AssetNameLabel.TextColor3 = Color3.new(1,1,1)
AssetNameLabel.TextScaled = true
AssetNameLabel.Parent = PreviewAssetBacking
local AssetTypeLabel = AssetNameLabel:clone()
AssetTypeLabel.RobloxLocked = true
AssetTypeLabel.Name = "AssetTypeLabel"
AssetTypeLabel.TextScaled = false
AssetTypeLabel.FontSize = Enum.FontSize.Size18
AssetTypeLabel.Position = UDim2.new(0.5,3,1,-20)
AssetTypeLabel.Parent = PreviewAssetBacking
local PreviewButton = Instance.new("TextButton")
PreviewButton.RobloxLocked = true
PreviewButton.Name = "PreviewButton"
PreviewButton.Text = "Rotate"
PreviewButton.BackgroundColor3 = Color3.new(0,0,0)
PreviewButton.BackgroundTransparency = 0.5
PreviewButton.BorderColor3 = Color3.new(1,1,1)
PreviewButton.Position = UDim2.new(1.2,-62,1,-50)
PreviewButton.Size = UDim2.new(0,125,0,50)
PreviewButton.Font = Enum.Font.ArialBold
PreviewButton.FontSize = Enum.FontSize.Size24
PreviewButton.TextColor3 = Color3.new(1,1,1)
PreviewButton.TextWrapped = true
PreviewButton.TextStrokeTransparency = 0
PreviewButton.Parent = Wardrobe
local CharacterPane = Instance.new("Frame")
CharacterPane.RobloxLocked = true
CharacterPane.Name = "CharacterPane"
CharacterPane.Position = UDim2.new(1,-220,0,32)
CharacterPane.Size = UDim2.new(0,220,1,-40)
CharacterPane.BackgroundTransparency = 1
CharacterPane.Visible = true
CharacterPane.Parent = Wardrobe
--CharacterPane Children
local FaceFrame = makeCharFrame("FacesFrame", CharacterPane)
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)
makeStyledButton("Face",UDim2.new(0,64,0,64),UDim2.new(0.5,-32,0.5,-135),FaceFrame)
local HeadFrame = makeCharFrame("HeadsFrame", CharacterPane)
makeZone("FaceZone","http://www.roblox.com/asset/?id=75460621",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://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)
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://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)
local pantFrame = Instance.new("Frame")
pantFrame.RobloxLocked = true
pantFrame.Size = UDim2.new(0,25,0,56)
pantFrame.Position = UDim2.new(0.5,-26,0.5,0)
pantFrame.BackgroundColor3 = Color3.new(0,0,0)
pantFrame.BorderColor3 = Color3.new(1,1,1)
pantFrame.Name = "PantFrame"
pantFrame.Parent = PantsFrame
local otherPantFrame = pantFrame:clone()
otherPantFrame.Position = UDim2.new(0.5,3,0.5,0)
otherPantFrame.RobloxLocked = true
otherPantFrame.Parent = PantsFrame
local CurrentPants = Instance.new("ImageButton")
CurrentPants.RobloxLocked = true
CurrentPants.BackgroundTransparency = 1
CurrentPants.ZIndex = 2
CurrentPants.Name = "CurrentPants"
CurrentPants.Position = UDim2.new(0.5,-31,0.5,-4)
CurrentPants.Size = UDim2.new(0,54,0,59)
CurrentPants.Parent = PantsFrame
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)
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)
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)
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)
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)
makeTextLabel("LeftArmLabel","Left Arm",UDim2.new(0.5,-16,0,-25),leftArmButton)
local TShirtFrame = makeCharFrame("T-ShirtsFrame",CharacterPane)
game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=75460642")
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)
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)
makeStyledButton("ShirtButton", UDim2.new(0,64,0,64),UDim2.new(0.5,-32,0.5,-64),ShirtFrame)
local ColorFrame = makeCharFrame("ColorFrame", CharacterPane)
game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=76049888")
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("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("Torso",UDim2.new(0.43,0,0.36,0),UDim2.new(0.28,0,0.26,0),ColorZone).AutoButtonColor = false
makeStyledButton("RightLeg",UDim2.new(0.19,0,0.31,0),UDim2.new(0.275,0,0.67,0),ColorZone).AutoButtonColor = false
makeStyledButton("LeftLeg",UDim2.new(0.19,0,0.31,0),UDim2.new(0.525,0,0.67,0),ColorZone).AutoButtonColor = false
-- Character Panel label (shows what category we are currently browsing)
local CategoryLabel = Instance.new("TextLabel")
CategoryLabel.RobloxLocked = true
CategoryLabel.Name = "CategoryLabel"
CategoryLabel.BackgroundTransparency = 1
CategoryLabel.Font = Enum.Font.ArialBold
CategoryLabel.FontSize = Enum.FontSize.Size18
CategoryLabel.Position = UDim2.new(0,0,0,-7)
CategoryLabel.Size = UDim2.new(1,0,0,20)
CategoryLabel.TextXAlignment = Enum.TextXAlignment.Center
CategoryLabel.Text = "All"
CategoryLabel.TextColor3 = Color3.new(1,1,1)
CategoryLabel.Parent = CharacterPane
--Save Button
local SaveButton = Instance.new("TextButton")
SaveButton.RobloxLocked = true
SaveButton.Name = "SaveButton"
SaveButton.Size = UDim2.new(0.6,0,0,50)
SaveButton.Position = UDim2.new(0.2,0,1,-50)
SaveButton.Style = Enum.ButtonStyle.RobloxButton
SaveButton.Selected = false
SaveButton.Font = Enum.Font.ArialBold
SaveButton.FontSize = Enum.FontSize.Size18
SaveButton.Text = "Save"
SaveButton.TextColor3 = Color3.new(1,1,1)
SaveButton.Parent = CharacterPane
-- no need for this to stick around
script:remove()

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,147 +1,247 @@
%16%
-- Responsible for giving out tools in personal servers
-- A couple of necessary functions
print("BackpackWardrobe.lua loaded - edit 14")
-- first, lets see if buildTools have already been created
-- create the object in lighting (TODO: move to some sort of "container" object when we have one)
local toolsArray = game.Lighting:FindFirstChild("BuildToolsModel")
local ownerArray = game.Lighting:FindFirstChild("OwnerToolsModel")
local hasBuildTools = false
function getIds(idTable, assetTable)
for i = 1, #idTable do
local model = game:GetService("InsertService"):LoadAsset(idTable[i])
if model then
local children = model:GetChildren()
for i = 1, #children do
if children[i]:IsA("Tool") then
table.insert(assetTable,children[i])
end
end
end
local function waitForChild(instance, name)
assert(instance)
assert(name)
while not instance:FindFirstChild(name) do
instance.ChildAdded:wait()
end
return instance:FindFirstChild(name)
end
local function waitForProperty(instance, property)
assert(instance)
assert(property)
while not instance[property] do
instance.Changed:wait()
end
end
function storeInLighting(modelName, assetTable)
local model = Instance.new("Model")
model.Archivable = false
model.Name = modelName
for i = 1, #assetTable do
assetTable[i].Parent = model
end
if not game.Lighting:FindFirstChild(modelName) then -- no one beat us to it, we get to insert
model.Parent = game.Lighting
end
end
waitForChild(game,"Players")
waitForProperty(game.Players,"LocalPlayer")
local player = game.Players.LocalPlayer
if not toolsArray then -- no one has made build tools yet, we get to!
local buildToolIds = {}
local ownerToolIds = {}
local RbxGui, msg = LoadLibrary("RbxGui")
if not RbxGui then print("could not find RbxGui!") return end
table.insert(buildToolIds,73089166) -- PartSelectionTool
table.insert(buildToolIds,73089190) -- DeleteTool
table.insert(buildToolIds,73089204) -- CloneTool
table.insert(buildToolIds,73089214) -- RotateTool
table.insert(buildToolIds,73089239) -- ConfigTool
table.insert(buildToolIds,73089259) -- WiringTool
table.insert(buildToolIds,58921588) -- ClassicTool
table.insert(ownerToolIds, 65347268)
--- Begin Locals
local StaticTabName = "wardrobe"
-- next, create array of our tools
local buildTools = {}
local ownerTools = {}
getIds(buildToolIds, buildTools)
getIds(ownerToolIds, ownerTools)
storeInLighting("BuildToolsModel",buildTools)
storeInLighting("OwnerToolsModel",ownerTools)
toolsArray = game.Lighting:FindFirstChild("BuildToolsModel")
ownerArray = game.Lighting:FindFirstChild("OwnerToolsModel")
end
local backpack = script.Parent
local screen = script.Parent.Parent
local localBuildTools = {}
function giveBuildTools()
if not hasBuildTools then
hasBuildTools = true
local theTools = toolsArray:GetChildren()
for i = 1, #theTools do
local toolClone = theTools[i]:clone()
if toolClone then
toolClone.Parent = game.Players.LocalPlayer.Backpack
table.insert(localBuildTools,toolClone)
end
end
end
end
function giveOwnerTools()
local theOwnerTools = ownerArray:GetChildren()
for i = 1, #theOwnerTools do
local ownerToolClone = theOwnerTools[i]:clone()
if ownerToolClone then
ownerToolClone.Parent = game.Players.LocalPlayer.Backpack
table.insert(localBuildTools,ownerToolClone)
end
end
end
function removeBuildTools()
if hasBuildTools then
hasBuildTools = false
for i = 1, #localBuildTools do
localBuildTools[i].Parent = nil
end
localBuildTools = {}
end
end
if game.Players.LocalPlayer.HasBuildTools then
giveBuildTools()
end
if game.Players.LocalPlayer.PersonalServerRank >= 255 then
giveOwnerTools()
end
local backpackItems = {}
local buttons = {}
local debounce = false
game.Players.LocalPlayer.Changed:connect(function(prop)
if prop == "HasBuildTools" then
while debounce do
wait(0.5)
end
debounce = true
if game.Players.LocalPlayer.HasBuildTools then
giveBuildTools()
else
removeBuildTools()
end
if game.Players.LocalPlayer.PersonalServerRank >= 255 then
giveOwnerTools()
end
debounce = false
elseif prop == "PersonalServerRank" then
if game.Players.LocalPlayer.PersonalServerRank >= 255 then
giveOwnerTools()
elseif game.Players.LocalPlayer.PersonalServerRank <= 0 then
game.Players.LocalPlayer:Remove() -- you're banned, goodbye!
local browsingMenu = false
local mouseEnterCons = {}
local mouseClickCons = {}
local characterChildAddedCon = nil
local characterChildRemovedCon = nil
local backpackAddCon = nil
local Camera = game.Workspace.CurrentCamera
local playerBackpack = waitForChild(player,"Backpack")
waitForChild(backpack,"Tabs")
waitForChild(backpack,"Wardrobe")
local currentLoadout = waitForChild(backpack.Parent,"CurrentLoadout")
local walkSpeed = 16
local screenSize = game:GetService("CoreGui"):FindFirstChild("RobloxGui").AbsoluteSize
local rotateCharacter = false
local rotateCharacterButton = waitForChild(backpack.Wardrobe,"PreviewButton")
local swapSlot = waitForChild(script.Parent,"SwapSlot")
local backpackManager = waitForChild(script.Parent,"CoreScripts/BackpackScripts/BackpackManager")
local backpackOpenEvent = waitForChild(backpackManager,"BackpackOpenEvent")
local backpackCloseEvent = waitForChild(backpackManager,"BackpackCloseEvent")
local tabClickedEvent = waitForChild(backpackManager,"TabClickedEvent")
local resizeEvent = waitForChild(backpackManager,"ResizeEvent")
local searchRequestedEvent = waitForChild(backpackManager,"SearchRequestedEvent")
local tellBackpackReadyFunc = waitForChild(backpackManager,"BackpackReady")
-- creating scroll bar early as to make sure items get placed correctly
-- Begin Functions
function lerpTest(from, to)
local ax, ay, az, a11, a12, a13, a21, a22, a23, a31, a32, a33 = from:components()
local bx, by, bz, b11, b12, b13, b21, b22, b23, b31, b32, b33 = to:components()
local diffx = bx - ax;
local diffy = by - ay;
local diffz = bz - az;
local diff11 = b11 - a11;
local diff12 = b12 - a12;
local diff13 = b13 - a13;
local diff21 = b21 - a21;
local diff22 = b22 - a22;
local diff23 = b23 - a23;
local diff31 = b31 - a31;
local diff32 = b32 - a32;
local diff33 = b33 - a33;
while wait(0.1) do
break
end
end
function removeFromMap(map,object)
for i = 1, #map do
if map[i] == object then
table.remove(map,i)
break
end
end
end
function robloxLock(instance)
instance.RobloxLocked = true
children = instance:GetChildren()
if children then
for i, child in ipairs(children) do
robloxLock(child)
end
end
end
function buttonClick(button)
if button:FindFirstChild("UnequipContextMenu") and not button.Active then
button.UnequipContextMenu.Visible = true
browsingMenu = true
end
end
function tabClickHandler(tabName)
if tabName == StaticTabName then
backpackOpenHandler(tabName)
else
backpackCloseHandler(tabName)
end
end
function backpackOpenHandler(currentTab)
if currentTab and currentTab ~= StaticTabName then
backpack.Wardrobe.Visible = false
return
end
backpack.Wardrobe.Visible = true
createView()
tellBackpackReadyFunc:Invoke()
end
function backpackCloseHandler(currentTab)
if currentTab and currentTab ~= StaticTabName then
backpack.Wardrobe.Visible = false
revertView()
return
end
backpack.Wardrobe.Visible = false
revertView()
tellBackpackReadyFunc:Invoke()
end
function highlight(button)
button.TextColor3 = Color3.new(0,0,0)
button.BackgroundColor3 = Color3.new(0.8,0.8,0.8)
end
function clearHighlight(button)
button.TextColor3 = Color3.new(1,1,1)
button.BackgroundColor3 = Color3.new(0,0,0)
end
function trim(s)
return (s:gsub("^%s*(.-)%s*$", "%1"))
end
function splitByWhitespace(text)
if type(text) ~= "string" then return nil end
local terms = {}
for token in string.gmatch(text, "[^%s]+") do
if string.len(token) > 0 then
table.insert(terms,token)
end
end
return terms
end
function createView()
-- stop player from moving and store initial speed (they can still jump though)
if player.Character.Humanoid.WalkSpeed ~= 0 then walkSpeed = player.Character.Humanoid.WalkSpeed end
player.Character.Humanoid.WalkSpeed = 0
-- initialize camera
Camera.CameraType = Enum.CameraType.Scriptable
focusCamera()
end
function revertView()
-- restore initial walk speed
player.Character.Humanoid.WalkSpeed = walkSpeed
-- restore player camera
Camera.CameraType = Enum.CameraType.Custom
-- if character spin is enabled then disable it
if rotateCharacter then toggleCharacterSpin() end
end
function focusCamera()
if not backpack.Wardrobe.Visible then return end
local cameraAngle = CFrame.fromEulerAnglesXYZ(0, math.pi, 0) * CFrame.fromEulerAnglesXYZ(0, -0.1, 0)
local cameraPosition = CFrame.new(screenSize.X*0.00983455882, 0, screenSize.Y*-0.01527777777)
Camera.CoordinateFrame = game.Players.LocalPlayer.Character.Torso.CFrame * cameraPosition * cameraAngle
end
function toggleCharacterSpin()
rotateCharacter = not rotateCharacter
if rotateCharacter then
rotateCharacterButton.Text = "Pause"
else
rotateCharacterButton.Text = "Rotate"
end
while rotateCharacter do
wait(0.05)
player.Character.Torso.CFrame = player.Character.Torso.CFrame * CFrame.Angles(0,0.035,0)
end
end
------------------------- Start Lifelong Connections -----------------------
resizeEvent.Event:connect(function(absSize)
if debounce then return end
debounce = true
wait()
screenSize = absSize
focusCamera()
debounce = false
end)
game.Players.LocalPlayer.CharacterAdded:connect(function()
hasBuildTools = false
if game.Players.LocalPlayer.HasBuildTools then
giveBuildTools()
end
if game.Players.LocalPlayer.PersonalServerRank >= 255 then
giveOwnerTools()
end
end)
------------------------- End Lifelong Connections -----------------------
backpackOpenEvent.Event:connect(backpackOpenHandler)
backpackCloseEvent.Event:connect(backpackCloseHandler)
tabClickedEvent.Event:connect(tabClickHandler)
rotateCharacterButton.MouseButton1Click:connect(toggleCharacterSpin)