889 lines
27 KiB
Plaintext
889 lines
27 KiB
Plaintext
<roblox xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd" version="4">
|
|
<External>null</External>
|
|
<External>nil</External>
|
|
<Item class="Tool" referent="RBX0">
|
|
<Properties>
|
|
<bool name="Enabled">true</bool>
|
|
<CoordinateFrame name="Grip">
|
|
<X>0</X>
|
|
<Y>0</Y>
|
|
<Z>-0.699999988</Z>
|
|
<R00>-0</R00>
|
|
<R01>0</R01>
|
|
<R02>1</R02>
|
|
<R10>1</R10>
|
|
<R11>-0</R11>
|
|
<R12>0</R12>
|
|
<R20>0</R20>
|
|
<R21>1</R21>
|
|
<R22>0</R22>
|
|
</CoordinateFrame>
|
|
<string name="Name">Wrench</string>
|
|
<Content name="TextureId"><url>http://www.roblox.com/asset/?id=16885384</url></Content>
|
|
<bool name="archivable">true</bool>
|
|
</Properties>
|
|
<Item class="Script" referent="RBX1">
|
|
<Properties>
|
|
<bool name="Disabled">false</bool>
|
|
<Content name="LinkedSource"><null></null></Content>
|
|
<string name="Name">SwordScript</string>
|
|
<string name="Source">-------- OMG HAX
|
|
|
|
r = game:service("RunService")
|
|
|
|
|
|
local damage = 0
|
|
|
|
|
|
local slash_damage = 0
|
|
|
|
|
|
sword = script.Parent.Handle
|
|
Tool = script.Parent
|
|
|
|
|
|
|
|
function attack()
|
|
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)
|
|
|
|
</string>
|
|
<bool name="archivable">true</bool>
|
|
</Properties>
|
|
</Item>
|
|
<Item class="Part" referent="RBX2">
|
|
<Properties>
|
|
<bool name="Anchored">false</bool>
|
|
<float name="BackParamA">-0.5</float>
|
|
<float name="BackParamB">0.5</float>
|
|
<token name="BackSurface">0</token>
|
|
<token name="BackSurfaceInput">0</token>
|
|
<float name="BottomParamA">-0.5</float>
|
|
<float name="BottomParamB">0.5</float>
|
|
<token name="BottomSurface">0</token>
|
|
<token name="BottomSurfaceInput">0</token>
|
|
<int name="BrickColor">199</int>
|
|
<CoordinateFrame name="CFrame">
|
|
<X>-11</X>
|
|
<Y>2</Y>
|
|
<Z>-11.5</Z>
|
|
<R00>0</R00>
|
|
<R01>0</R01>
|
|
<R02>-1</R02>
|
|
<R10>0</R10>
|
|
<R11>1</R11>
|
|
<R12>-0</R12>
|
|
<R20>1</R20>
|
|
<R21>0</R21>
|
|
<R22>-0</R22>
|
|
</CoordinateFrame>
|
|
<bool name="CanCollide">true</bool>
|
|
<bool name="DraggingV1">false</bool>
|
|
<float name="Elasticity">0.5</float>
|
|
<token name="FormFactor">2</token>
|
|
<float name="Friction">0.300000012</float>
|
|
<float name="FrontParamA">-0.5</float>
|
|
<float name="FrontParamB">0.5</float>
|
|
<token name="FrontSurface">0</token>
|
|
<token name="FrontSurfaceInput">0</token>
|
|
<float name="LeftParamA">-0.5</float>
|
|
<float name="LeftParamB">0.5</float>
|
|
<token name="LeftSurface">0</token>
|
|
<token name="LeftSurfaceInput">0</token>
|
|
<bool name="Locked">true</bool>
|
|
<token name="Material">256</token>
|
|
<string name="Name">Handle</string>
|
|
<float name="Reflectance">0</float>
|
|
<float name="RightParamA">-0.5</float>
|
|
<float name="RightParamB">0.5</float>
|
|
<token name="RightSurface">0</token>
|
|
<token name="RightSurfaceInput">0</token>
|
|
<Vector3 name="RotVelocity">
|
|
<X>0</X>
|
|
<Y>0</Y>
|
|
<Z>0</Z>
|
|
</Vector3>
|
|
<float name="TopParamA">-0.5</float>
|
|
<float name="TopParamB">0.5</float>
|
|
<token name="TopSurface">0</token>
|
|
<token name="TopSurfaceInput">0</token>
|
|
<float name="Transparency">0</float>
|
|
<Vector3 name="Velocity">
|
|
<X>0</X>
|
|
<Y>0</Y>
|
|
<Z>0</Z>
|
|
</Vector3>
|
|
<bool name="archivable">true</bool>
|
|
<token name="shape">1</token>
|
|
<Vector3 name="size">
|
|
<X>1</X>
|
|
<Y>0.800000012</Y>
|
|
<Z>2</Z>
|
|
</Vector3>
|
|
</Properties>
|
|
<Item class="SpecialMesh" referent="RBX3">
|
|
<Properties>
|
|
<token name="LODX">2</token>
|
|
<token name="LODY">2</token>
|
|
<Content name="MeshId"><url>http://www.roblox.com/asset/?id=16884681</url></Content>
|
|
<token name="MeshType">5</token>
|
|
<string name="Name">Mesh</string>
|
|
<Vector3 name="Offset">
|
|
<X>0</X>
|
|
<Y>0</Y>
|
|
<Z>0</Z>
|
|
</Vector3>
|
|
<Vector3 name="Scale">
|
|
<X>0.600000024</X>
|
|
<Y>0.600000024</Y>
|
|
<Z>0.600000024</Z>
|
|
</Vector3>
|
|
<Content name="TextureId"><url>http://www.roblox.com/asset/?id=16884673</url></Content>
|
|
<Vector3 name="VertexColor">
|
|
<X>1</X>
|
|
<Y>1</Y>
|
|
<Z>1</Z>
|
|
</Vector3>
|
|
<bool name="archivable">true</bool>
|
|
</Properties>
|
|
</Item>
|
|
</Item>
|
|
<Item class="LocalScript" referent="RBX4">
|
|
<Properties>
|
|
<bool name="Disabled">false</bool>
|
|
<Content name="LinkedSource"><null></null></Content>
|
|
<string name="Name">Configuration Local</string>
|
|
<string name="Source">local Tool = script.Parent;
|
|
|
|
enabled = true
|
|
|
|
local selectionLasso
|
|
local selectionBox
|
|
local guiMain
|
|
|
|
local selectionGui
|
|
local hintGui
|
|
|
|
local valueConnections = {}
|
|
|
|
local objectValueSelect = {}
|
|
|
|
local colorPaletteSelectMode = false
|
|
|
|
--Constants
|
|
local width = UDim.new(0.25, 0)
|
|
local height = 20
|
|
local transparency = 0.5
|
|
local buttonColor = BrickColor.new("New Yeller")
|
|
local frameColor = BrickColor.new("Pastel yellow")
|
|
|
|
|
|
function sharedProcess(value, parentFrame)
|
|
local subFrame = Instance.new("Frame")
|
|
subFrame.Name = value.Name
|
|
subFrame.Size = UDim2.new(1.0, 0, 0, height)
|
|
subFrame.BackgroundTransparency = 1.0
|
|
subFrame.BorderSizePixel = 0
|
|
|
|
local label = Instance.new("TextLabel")
|
|
label.Position = UDim2.new(0.0, 0, 0.0, 0)
|
|
label.Size = UDim2.new(0.5, 0, 1.0, 0)
|
|
label.TextColor = BrickColor.Black()
|
|
label.Text = value.Name
|
|
label.Parent = subFrame
|
|
label.BackgroundTransparency = 1.0
|
|
label.BorderSizePixel = 0
|
|
|
|
return subFrame
|
|
end
|
|
|
|
function createTextBox(size, text)
|
|
local textBox = Instance.new("TextBox")
|
|
textBox.Position = UDim2.new(0.5, 1, 0.0, 1)
|
|
textBox.Size = size
|
|
textBox.BackgroundColor = BrickColor.White()
|
|
textBox.TextColor = BrickColor.Black()
|
|
textBox.Text = text
|
|
return textBox;
|
|
end
|
|
|
|
function setCheckBoxValue(checkBox, value)
|
|
if value then
|
|
checkBox.Text = "X"
|
|
else
|
|
checkBox.Text = ""
|
|
end
|
|
end
|
|
function createCheckBox(value)
|
|
local checkBox = Instance.new("TextButton")
|
|
checkBox.Position = UDim2.new(0.75, -(height-4)/2, 0.0, 2)
|
|
checkBox.Size = UDim2.new(0.0, height-4, 0.0, height-4)
|
|
checkBox.BackgroundColor = BrickColor.White()
|
|
checkBox.TextColor = BrickColor.Black()
|
|
setCheckBoxValue(checkBox, value)
|
|
return checkBox
|
|
end
|
|
|
|
|
|
|
|
function processBoolValue(value, guiFrame)
|
|
local subFrame = sharedProcess(value, guiFrame)
|
|
local checkBox = createCheckBox(value.Value)
|
|
|
|
--Tie the two values together... we'll need to break these connections later
|
|
checkBox.MouseButton1Down:connect(function() value.Value = not(value.Value) end)
|
|
valueConnections[#valueConnections+1] = value.Changed:connect(function(newValue) print(newValue) setCheckBoxValue(checkBox, newValue) end)
|
|
checkBox.Parent = subFrame
|
|
return subFrame
|
|
end
|
|
|
|
function processIntValue(value, guiFrame)
|
|
local subFrame = sharedProcess(value, guiFrame)
|
|
local textBox = createTextBox(UDim2.new(0.5,-2, 1.0, -2), value.Value, function(textBox) value.Value = textBox.Text end)
|
|
|
|
--Tie the two values together... we'll need to break these connections later
|
|
textBox.Changed:connect(function(prop) if prop == 'Text' then pcall(function() value.Value = textBox.Text end) textBox.Text = value.Value end end)
|
|
valueConnections[#valueConnections+1] = value.Changed:connect(function(newValue) textBox.Text = newValue end)
|
|
|
|
textBox.Parent = subFrame
|
|
return subFrame;
|
|
end
|
|
|
|
|
|
function processNumberValue(value, guiFrame)
|
|
return processIntValue(value, guiFrame)
|
|
end
|
|
|
|
|
|
function processStringValue(value, guiFrame)
|
|
return processIntValue(value, guiFrame)
|
|
end
|
|
|
|
|
|
|
|
function onMouseLeave(hoverSelection, selectedButtonTable, oldButton)
|
|
if oldButton[0] then
|
|
local notSelected = true;
|
|
local selectionText = "";
|
|
for key, value in pairs(selectedButtonTable) do
|
|
if oldButton[0] == value then
|
|
notSelected = false
|
|
else
|
|
selectionText = value.BackgroundColor.Name;
|
|
end
|
|
end
|
|
if notSelected then
|
|
hoverSelection.Text = selectionText;
|
|
oldButton[0].Parent.BackgroundColor = BrickColor.Black();
|
|
end
|
|
end
|
|
oldButton[0] = nil
|
|
end
|
|
|
|
function onMouseEnter(hoverSelection, guiButton, selectedButtonTable, oldButton)
|
|
onMouseLeave(hoverSelection, selectedButtonTable, oldButton)
|
|
hoverSelection.Text = guiButton.BackgroundColor.Name
|
|
if guiButton ~= selectedButton then
|
|
guiButton.Parent.BackgroundColor = BrickColor.White();
|
|
oldButton[0] = guiButton
|
|
end
|
|
end
|
|
|
|
function changeColorSelection(colorHolder, paletteFrame, guiButton, selectedButtonTable)
|
|
if selectedButtonTable[colorHolder] ~= nil then
|
|
selectedButtonTable[colorHolder].Parent.BackgroundColor = BrickColor.Black();
|
|
end
|
|
|
|
guiButton.Parent.BackgroundColor = BrickColor.Yellow();
|
|
colorHolder.BackgroundColor = guiButton.BackgroundColor
|
|
selectedButtonTable[colorHolder] = guiButton
|
|
end
|
|
|
|
function onMouseUp(colorHolder, paletteFrame, guiButton, selectedButtonTable)
|
|
changeColorSelection(colorHolder, paletteFrame, guiButton, selectedButtonTable)
|
|
|
|
onMouseLeavePalette(paletteFrame)
|
|
end
|
|
|
|
function onShowColorDialog(paletteFrame)
|
|
paletteFrame.Visible = not(paletteFrame.Visible)
|
|
colorPaletteSelectMode = true
|
|
end
|
|
|
|
|
|
function onMouseEnterPalette(mouse)
|
|
--mouse.Icon ="rbxasset://textures\\ArrowCursor.png"
|
|
colorPaletteSelectMode = true
|
|
end
|
|
function onMouseLeavePalette(paletteFrame)
|
|
colorPaletteSelectMode = false
|
|
paletteFrame.Visible = false
|
|
end
|
|
|
|
function processBrickColorValue(value, guiFrame)
|
|
local subFrame = sharedProcess(value, guiFrame)
|
|
|
|
local sideBar = Instance.new("Frame")
|
|
sideBar.Position = UDim2.new(0.5, 0, 0.0, 0)
|
|
sideBar.Size = UDim2.new(0.5, 0, 1.0, 0)
|
|
sideBar.BackgroundTransparency = 1.0
|
|
sideBar.Parent = subFrame
|
|
sideBar.BorderSizePixel = 0
|
|
--sideBar.MouseEnter:connect(function() onMouseEnterGui(mouse) end)
|
|
--sideBar.MouseLeave:connect(function() onMouseLeaveGui(mouse) end)
|
|
|
|
local primaryColor = Instance.new("TextButton")
|
|
primaryColor.Position = UDim2.new(0.0, 1, 0.0, 1)
|
|
primaryColor.Size = UDim2.new(0.0, height-2, 0, height-2)
|
|
primaryColor.Text = ""
|
|
primaryColor.BackgroundColor = value.Value
|
|
primaryColor.BorderColor = BrickColor.Black()
|
|
--primaryColor.BorderSizePixel = 1
|
|
primaryColor.Parent = sideBar
|
|
|
|
local hoverSelection = Instance.new("TextLabel")
|
|
hoverSelection.Position = UDim2.new(0.0, height+2, 0.0, 0)
|
|
hoverSelection.Size = UDim2.new(1.0, -height - 4, 1.0, 0)
|
|
hoverSelection.Text = ""
|
|
hoverSelection.BackgroundTransparency = 1.0
|
|
hoverSelection.BorderSizePixel = 0
|
|
hoverSelection.TextColor = BrickColor.Black()
|
|
hoverSelection.Text = primaryColor.BackgroundColor.Name;
|
|
hoverSelection.Parent = sideBar
|
|
|
|
local paletteFrame = Instance.new("Frame")
|
|
paletteFrame.Position = UDim2.new(primaryColor.Position.X.Scale, primaryColor.Position.X.Offset + height, primaryColor.Position.Y.Scale, primaryColor.Position.Y.Offset - height*7)
|
|
paletteFrame.Size = UDim2.new(0, height*8, 0, height*8)
|
|
paletteFrame.BackgroundColor = BrickColor.Black()
|
|
paletteFrame.BorderColor = BrickColor.White()
|
|
paletteFrame.Visible = false;
|
|
paletteFrame.Parent = sideBar
|
|
paletteFrame.ZIndex = 2
|
|
paletteFrame.MouseEnter:connect(function() onMouseEnterPalette(mouse) end)
|
|
paletteFrame.MouseLeave:connect(function() onMouseLeavePalette(paletteFrame, mouse) end)
|
|
|
|
primaryColor.MouseButton1Down:connect(function() onShowColorDialog(paletteFrame) end)
|
|
|
|
local selectedButtonTable = {}
|
|
local colorButtonTable = {}
|
|
local oldButton = {}
|
|
for xOffset = 0, 7 do
|
|
for yOffset = 0,7 do
|
|
local guiFrame = Instance.new("Frame")
|
|
guiFrame.Position = UDim2.new(1.0/8 * xOffset, 0, 1.0/8*yOffset, 0)
|
|
guiFrame.Size = UDim2.new(1.0/8, 0, 1.0/8, 0)
|
|
guiFrame.BackgroundColor = BrickColor.Black();
|
|
guiFrame.BorderSizePixel = 0
|
|
guiFrame.Parent = paletteFrame;
|
|
guiFrame.ZIndex = 2
|
|
|
|
local guiButton = Instance.new("TextButton")
|
|
guiButton.Position = UDim2.new(0.0, 1, 0.0, 1)
|
|
guiButton.Size = UDim2.new(1.0, -2, 1.0, -2)
|
|
guiButton.Text = ""
|
|
guiButton.BorderSizePixel = 0
|
|
guiButton.AutoButtonColor = false
|
|
local color = BrickColor.palette(xOffset + yOffset*8)
|
|
colorButtonTable[color.Number] = guiButton
|
|
guiButton.BackgroundColor = color
|
|
guiButton.MouseEnter:connect(function() onMouseEnter(hoverSelection, guiButton, selectedButtonTable, oldButton) end)
|
|
guiButton.MouseButton1Up:connect(function() onMouseUp(primaryColor, paletteFrame, guiButton, selectedButtonTable, oldButton) end)
|
|
guiButton.MouseButton1Up:connect(function() value.Value = guiButton.BackgroundColor end)
|
|
guiButton.Parent = guiFrame
|
|
guiButton.ZIndex = 2
|
|
|
|
if guiButton.BackgroundColor == primaryColor.BackgroundColor then
|
|
guiFrame.BackgroundColor = BrickColor.White()
|
|
selectedButtonTable[primaryColor] = guiButton
|
|
end
|
|
end
|
|
end
|
|
|
|
valueConnections[#valueConnections+1] = value.Changed:connect(function(newValue) print(newValue) changeColorSelection(primaryColor, paletteFrame, colorButtonTable[newValue.Number], selectedButtonTable) end)
|
|
return subFrame
|
|
end
|
|
|
|
|
|
function onObjectValueMouseClick(guiFrame, value, objectButton)
|
|
objectValueSelect["CancelFrame"].Visible = true
|
|
guiFrame.Visible = false
|
|
objectValueSelect["Value"] = value
|
|
objectValueSelect["Frame"] = guiFrame
|
|
objectValueSelect["Enabled"] = true
|
|
|
|
|
|
onObjectValueMouseLeave(value, objectButton)
|
|
end
|
|
|
|
function createObjectSelectCancelFrame(guiMain)
|
|
local cancelFrame = Instance.new("Frame")
|
|
cancelFrame.Name = "ObjectValueSelectCancel"
|
|
cancelFrame.Size = UDim2.new(width.Scale, width.Offset, 0.0, height)
|
|
cancelFrame.Position = UDim2.new(0.0, 0, 1.0, -height)
|
|
cancelFrame.BackgroundColor = frameColor
|
|
cancelFrame.Visible = false
|
|
cancelFrame.Parent = guiMain
|
|
|
|
local objectSelectHint = Instance.new("TextLabel")
|
|
objectSelectHint.Size = UDim2.new(0.75, 0, 1.0, 0)
|
|
objectSelectHint.Position = UDim2.new(0.0, 0, 0.0, 0)
|
|
objectSelectHint.BackgroundTransparency = 1.0
|
|
objectSelectHint.Text = "Please select a Part";
|
|
objectSelectHint.Parent = cancelFrame
|
|
|
|
local objectSelectCancelButton = Instance.new("TextButton")
|
|
objectSelectCancelButton.Size = UDim2.new(0.25, -4, 1.0, -4)
|
|
objectSelectCancelButton.Position = UDim2.new(0.75, 2, 0.0, 2)
|
|
objectSelectCancelButton.BackgroundColor = buttonColor
|
|
objectSelectCancelButton.Text = "Cancel";
|
|
objectSelectCancelButton.MouseButton1Click:connect(function() onObjectValueCancel() end)
|
|
objectSelectCancelButton.Parent = cancelFrame
|
|
|
|
objectValueSelect["CancelFrame"] = cancelFrame
|
|
end
|
|
|
|
function onObjectValueMouseEnter(value, objectButton)
|
|
objectValueSelect["HoverBox"].Adornee = value.Value
|
|
objectValueSelect["HoverValue"] = value
|
|
if value.Value then
|
|
objectButton.BackgroundColor = BrickColor.Blue()
|
|
else
|
|
objectButton.BackgroundColor = BrickColor.White()
|
|
end
|
|
end
|
|
|
|
function onObjectValueMouseLeave(value, objectButton)
|
|
if objectValueSelect["HoverValue"] == value then
|
|
objectValueSelect["HoverBox"].Adornee = nil
|
|
objectValueSelect["HoverValue"] = nil
|
|
end
|
|
objectButton.BackgroundColor = buttonColor
|
|
end
|
|
|
|
function onObjectValueCancel()
|
|
if objectValueSelect["Enabled"] then
|
|
objectValueSelect["Enabled"] = false
|
|
|
|
objectValueSelect["Box"].Adornee = nil
|
|
objectValueSelect["Frame"].Visible = true
|
|
objectValueSelect["CancelFrame"].Visible = false
|
|
objectValueSelect["Frame"] = nil
|
|
objectValueSelect["Value"] = nil
|
|
end
|
|
end
|
|
|
|
function on3dObjectValueButton1Up(mouse, guiMain)
|
|
local part = mouse.Target
|
|
if part ~= nil then
|
|
objectValueSelect["Value"].Value = part
|
|
|
|
objectValueSelect["Enabled"] = false
|
|
|
|
objectValueSelect["Box"].Adornee = nil
|
|
objectValueSelect["Frame"].Visible = true
|
|
objectValueSelect["CancelFrame"].Visible = false
|
|
|
|
objectValueSelect["Frame"] = nil
|
|
objectValueSelect["Value"] = nil
|
|
end
|
|
end
|
|
|
|
function on3dObjectValueMouseMove(mouse, guiMain)
|
|
local part = mouse.Target
|
|
if part and part ~= objectValueSelect["Box"].Adornee then
|
|
objectValueSelect["Box"].Adornee = part
|
|
end
|
|
end
|
|
|
|
function setObjectButtonText(guiFrame, objectButton, objectValue)
|
|
if objectValueSelect["Enabled"] and objectValue == objectValueSelect["Value"] then
|
|
guiFrame.Visible = true
|
|
objectValueSelect["Enabled"] = false
|
|
objectValueSelect["Value"] = nil
|
|
end
|
|
|
|
if objectValue.Value ~= nil then
|
|
objectButton.Text = objectValue.Value.Name
|
|
else
|
|
objectButton.Text = "[nil]"
|
|
end
|
|
objectButton.BackgroundColor = buttonColor
|
|
end
|
|
|
|
function processObjectValue(value, playerGui, guiFrame)
|
|
local subFrame = sharedProcess(value, guiFrame)
|
|
local objectButton = Instance.new("TextButton")
|
|
objectButton.Position = UDim2.new(0.5, 2, 0.0, 2)
|
|
objectButton.Size = UDim2.new(0.5, -4, 1.0, -4)
|
|
objectButton.BackgroundColor = buttonColor
|
|
objectButton.TextColor = BrickColor.Black()
|
|
objectButton.Parent = subFrame
|
|
objectButton.AutoButtonColor = false
|
|
|
|
objectButton.MouseButton1Click:connect(function() onObjectValueMouseClick(guiFrame, value, objectButton) end)
|
|
objectButton.MouseEnter:connect(function() onObjectValueMouseEnter(value, objectButton) end)
|
|
objectButton.MouseLeave:connect(function() onObjectValueMouseLeave(value, objectButton) end)
|
|
|
|
valueConnections[#valueConnections+1] = value.Changed:connect(function(newObjectValue) setObjectButtonText(guiFrame, objectButton, value) end)
|
|
|
|
setObjectButtonText(guiFrame, objectButton, value)
|
|
return subFrame
|
|
end
|
|
|
|
|
|
function processValue(value, playerGui, guiFrame)
|
|
if value.className == "BoolValue" then
|
|
return processBoolValue(value, guiFrame)
|
|
elseif value.className == "IntValue" then
|
|
return processIntValue(value, guiFrame)
|
|
elseif value.className == "NumberValue" then
|
|
return processNumberValue(value, guiFrame)
|
|
elseif value.className == "StringValue" then
|
|
return processStringValue(value, guiFrame)
|
|
elseif value.className == "ObjectValue" then
|
|
return processObjectValue(value, playerGui, guiFrame)
|
|
elseif value.className == "BrickColorValue" then
|
|
return processBrickColorValue(value, guiFrame)
|
|
else
|
|
return nil
|
|
end
|
|
end
|
|
|
|
function processConfiguration(config, playerGui)
|
|
local parentFrame = Instance.new("Frame")
|
|
parentFrame.Name = "MainFrame"
|
|
parentFrame.BackgroundColor = frameColor
|
|
parentFrame.BackgroundTransparency = transparency
|
|
|
|
local titleLabel = Instance.new("TextLabel")
|
|
titleLabel.Size = UDim2.new(1.0, 0.0, 0.0, height)
|
|
titleLabel.BackgroundColor = BrickColor.new("Cool yellow")
|
|
titleLabel.BackgroundTransparency = 0.75
|
|
titleLabel.Text = config.Name
|
|
titleLabel.Parent = parentFrame
|
|
titleLabel:clone().Parent = parentFrame
|
|
|
|
local valueChildren = 1
|
|
local children = config:GetChildren()
|
|
if children then
|
|
for pos, child in pairs(children) do
|
|
local newFrame = processValue(child, playerGui, parentFrame);
|
|
if newFrame then
|
|
newFrame.Position = UDim2.new(0.0, 0, 0.0, valueChildren*height)
|
|
newFrame.Parent = parentFrame
|
|
valueChildren = valueChildren + 1
|
|
end
|
|
end
|
|
end
|
|
|
|
local buttonFrame = Instance.new("Frame")
|
|
buttonFrame.Name = "Buttons"
|
|
buttonFrame.BackgroundTransparency = 1.0
|
|
buttonFrame.Size = UDim2.new(1.0, 0.0, 0.0, height)
|
|
buttonFrame.Position = UDim2.new(0.0, 0, 0.0, valueChildren*height)
|
|
buttonFrame.Parent = parentFrame
|
|
valueChildren = valueChildren + 1
|
|
|
|
local okButton = Instance.new("TextButton")
|
|
okButton.Text = "Ok"
|
|
okButton.Size = UDim2.new(.25, -4, 0.0, height-4)
|
|
okButton.Position = UDim2.new(0.5-.25/2, 2, 0.0, 2)
|
|
okButton.BackgroundColor = buttonColor
|
|
okButton.MouseButton1Click:connect(function() removeSelectionGui() end)
|
|
okButton.Parent = buttonFrame
|
|
|
|
--local cancelButton = Instance.new("TextButton")
|
|
--cancelButton.Text = "Cancel"
|
|
--cancelButton.Size = UDim2.new(.33, -4, 0.0, height-4)
|
|
--cancelButton.Position = UDim2.new(0.33, 2, 0.0, 2)
|
|
--cancelButton.BackgroundColor = buttonColor
|
|
--cancelButton.MouseButton1Click:connect(function() removeSelectionGui() end)
|
|
--cancelButton.Parent = buttonFrame
|
|
|
|
|
|
parentFrame.Size = UDim2.new(width.Scale, width.Offset, 0.0, valueChildren*height)
|
|
parentFrame.Position = UDim2.new(0.0, 0, 1.0, -valueChildren*height)
|
|
|
|
return parentFrame
|
|
end
|
|
|
|
function on3dMouseMove(mouse, guiMain)
|
|
if objectValueSelect["Enabled"] then
|
|
on3dObjectValueMouseMove(mouse, guiMain)
|
|
end
|
|
end
|
|
|
|
function removeSelectionGui()
|
|
if selectionGui ~= nil then
|
|
selectionGui:Remove()
|
|
selectionGui = nil
|
|
for pos, connection in pairs(valueConnections) do
|
|
connection:disconnect()
|
|
end
|
|
valueConnections = {}
|
|
end
|
|
|
|
selectionBox.Adornee = nil
|
|
selectionLasso.Part = nil
|
|
objectValueSelect["Box"].Adornee = nil
|
|
objectValueSelect["HoverBox"].Adornee = nil
|
|
hintGui.Visible = true
|
|
|
|
showConfigurationAnnotations()
|
|
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 on3dButton1Up(mouse, guiMain, playerGui)
|
|
if objectValueSelect["Enabled"] then
|
|
on3dObjectValueButton1Up(mouse, guiMain)
|
|
return
|
|
elseif canSelectObject(mouse.Target) then
|
|
local part = mouse.Target
|
|
local children = part:GetChildren()
|
|
if children then
|
|
for pos, child in pairs(children) do
|
|
if child:IsA("Configuration") then
|
|
if selectionGui then
|
|
removeSelectionGui()
|
|
end
|
|
|
|
hideConfigurationAnnotations()
|
|
|
|
selectionGui = processConfiguration(child, playerGui)
|
|
selectionGui.Parent = guiMain
|
|
selectionBox.Adornee = part
|
|
selectionLasso.Part = part
|
|
|
|
hintGui.Visible = false
|
|
return;
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
print("3D Button Mouse Up")
|
|
removeSelectionGui()
|
|
end
|
|
function on3dButton1Down(mouse, guiMain, playerGui)
|
|
print("3D Button Mouse Down")
|
|
end
|
|
|
|
function onEquippedLocal(mouse)
|
|
local character = script.Parent.Parent
|
|
local player = game.Players:GetPlayerFromCharacter(character)
|
|
|
|
|
|
guiMain = Instance.new("ScreenGui")
|
|
guiMain.Parent = player.PlayerGui
|
|
|
|
setUpConfigurationService(guiMain)
|
|
showConfigurationAnnotations()
|
|
|
|
createObjectSelectCancelFrame(guiMain)
|
|
|
|
hintGui = Instance.new("TextLabel")
|
|
hintGui.Text = "Click on a Red selected object to change its configuration settings"
|
|
hintGui.Position = UDim2.new(0.0, 0, 1.0, -20)
|
|
hintGui.Size = UDim2.new(0.5, 0, 0.0, 20)
|
|
hintGui.BackgroundColor = frameColor
|
|
hintGui.BackgroundTransparency = 0.5
|
|
hintGui.Parent = guiMain
|
|
|
|
mouse.Icon ="rbxasset://textures\\DragCursor.png"
|
|
mouse.Button1Down:connect(function() on3dButton1Down(mouse, guiMain, player.PlayerGui) end)
|
|
mouse.Button1Up:connect(function() on3dButton1Up(mouse, guiMain, player.PlayerGui) end)
|
|
mouse.Move:connect(function() on3dMouseMove(mouse, guiMain) end)
|
|
|
|
selectionBox = Instance.new("SelectionBox")
|
|
selectionBox.Color = BrickColor.Red()
|
|
selectionBox.Adornee = nil
|
|
selectionBox.Parent = player.PlayerGui;
|
|
|
|
selectionLasso = Instance.new("SelectionPartLasso")
|
|
selectionLasso.Name = "Model Delete Lasso"
|
|
selectionLasso.Humanoid = character.Humanoid
|
|
selectionLasso.Part = nil
|
|
selectionLasso.Visible = true
|
|
selectionLasso.archivable = false
|
|
selectionLasso.Color = BrickColor.Red()
|
|
selectionLasso.Parent = game.workspace
|
|
|
|
objectValueSelect["HoverBox"] = Instance.new("SelectionBox")
|
|
objectValueSelect["HoverBox"].Color = BrickColor.Blue()
|
|
objectValueSelect["HoverBox"].Adornee = nil
|
|
objectValueSelect["HoverBox"].Parent = player.PlayerGui;
|
|
|
|
objectValueSelect["Box"] = Instance.new("SelectionBox")
|
|
objectValueSelect["Box"].Color = BrickColor.Blue()
|
|
objectValueSelect["Box"].Adornee = nil
|
|
objectValueSelect["Box"].Parent = player.PlayerGui;
|
|
|
|
|
|
|
|
end
|
|
|
|
function onUnequippedLocal()
|
|
|
|
destroyConfigurationService()
|
|
|
|
removeSelectionGui()
|
|
|
|
selectionBox:Remove()
|
|
selectionLasso:Remove()
|
|
objectValueSelect["Box"]:Remove()
|
|
objectValueSelect["HoverBox"]:Remove()
|
|
objectValueSelect["CancelFrame"]:Remove()
|
|
|
|
guiMain:Remove()
|
|
|
|
objectValueSelect = {}
|
|
end
|
|
|
|
|
|
local configTable = {}
|
|
|
|
function createVisualAnnotation(config, guiMain)
|
|
local selection = Instance.new("SelectionBox")
|
|
selection.Color = BrickColor.Red()
|
|
selection.Parent = guiMain.Parent
|
|
return selection
|
|
end
|
|
|
|
function configurationParentChanged(data, part)
|
|
if part and not(part:IsA("BasePart")) then
|
|
--Not a legit part, get rid of it
|
|
part = nil
|
|
end
|
|
|
|
data["VisualAnnotation"].Adornee = part
|
|
end
|
|
|
|
function showConfigurationAnnotations()
|
|
for config, data in pairs(configTable) do
|
|
data["VisualAnnotation"].Visible = true
|
|
end
|
|
end
|
|
|
|
|
|
function hideConfigurationAnnotations()
|
|
for config, data in pairs(configTable) do
|
|
data["VisualAnnotation"].Visible = false
|
|
end
|
|
end
|
|
|
|
function configurationAdded(config, guiMain)
|
|
if configTable[config] then
|
|
return
|
|
end
|
|
|
|
local data = {}
|
|
data = {}
|
|
data["Configuration"] = config
|
|
data["VisualAnnotation"] = createVisualAnnotation(config, guiMain)
|
|
data["Connection"] = config.AncestryChanged:connect(function(child, newParent) if child == config then configurationParentChanged(data, newParent) end end)
|
|
|
|
configurationParentChanged(data, config.Parent)
|
|
|
|
configTable[config] = data
|
|
end
|
|
|
|
function configurationRemoved(config)
|
|
local data = configTable[config]
|
|
if not(data) then
|
|
--I have no opinion about this
|
|
return
|
|
end
|
|
|
|
data["Connection"]:disconnect()
|
|
data["VisualAnnotation"]:Remove()
|
|
|
|
configTable[config] = nil
|
|
end
|
|
|
|
function setUpConfigurationService(guiMain)
|
|
local collectionService = game:GetService("CollectionService")
|
|
|
|
collectionService.ItemAdded:connect(function(instance) if instance:IsA("Configuration") then configurationAdded(instance, guiMain) end end)
|
|
collectionService.ItemRemoved:connect(function(instance) if instance:IsA("Configuration") then configurationRemoved(instance) end end)
|
|
|
|
local configs = collectionService:GetCollection("Configuration")
|
|
if configs then
|
|
for pos, config in pairs(configs) do
|
|
configurationAdded(config, guiMain)
|
|
end
|
|
end
|
|
end
|
|
|
|
function destroyConfigurationService()
|
|
for config, data in pairs(configTable) do
|
|
configurationRemoved(config)
|
|
end
|
|
end
|
|
|
|
|
|
|
|
Tool.Equipped:connect(onEquippedLocal)
|
|
Tool.Unequipped:connect(onUnequippedLocal)</string>
|
|
<bool name="archivable">true</bool>
|
|
</Properties>
|
|
</Item>
|
|
</Item>
|
|
</roblox> |