Fuck with the CoreScripts despite task telling me very clearly not to fuck with the corescripts
This commit is contained in:
parent
26dfa13ee3
commit
bb1eb0faa6
676
107893730.lua
676
107893730.lua
File diff suppressed because it is too large
Load Diff
|
|
@ -4,7 +4,7 @@
|
||||||
-- Essentially a user can bind a lua function to a key code, input type (mousebutton1 etc.) and this
|
-- Essentially a user can bind a lua function to a key code, input type (mousebutton1 etc.) and this
|
||||||
|
|
||||||
-- Variables
|
-- Variables
|
||||||
local contextActionService = Game:GetService("ContextActionService")
|
local contextActionService = Game:GetService "ContextActionService"
|
||||||
local isTouchDevice = Game:GetService("UserInputService").TouchEnabled
|
local isTouchDevice = Game:GetService("UserInputService").TouchEnabled
|
||||||
local functionTable = {}
|
local functionTable = {}
|
||||||
local buttonVector = {}
|
local buttonVector = {}
|
||||||
|
|
@ -17,14 +17,14 @@ local ContextUpImage = "http://www.banland.xyz/asset/?id=97166444"
|
||||||
local oldTouches = {}
|
local oldTouches = {}
|
||||||
|
|
||||||
local buttonPositionTable = {
|
local buttonPositionTable = {
|
||||||
[1] = UDim2.new(0,123,0,70),
|
[1] = UDim2.new(0, 123, 0, 70),
|
||||||
[2] = UDim2.new(0,30,0,60),
|
[2] = UDim2.new(0, 30, 0, 60),
|
||||||
[3] = UDim2.new(0,180,0,160),
|
[3] = UDim2.new(0, 180, 0, 160),
|
||||||
[4] = UDim2.new(0,85,0,-25),
|
[4] = UDim2.new(0, 85, 0, -25),
|
||||||
[5] = UDim2.new(0,185,0,-25),
|
[5] = UDim2.new(0, 185, 0, -25),
|
||||||
[6] = UDim2.new(0,185,0,260),
|
[6] = UDim2.new(0, 185, 0, 260),
|
||||||
[7] = UDim2.new(0,216,0,65)
|
[7] = UDim2.new(0, 216, 0, 65),
|
||||||
}
|
}
|
||||||
local maxButtons = #buttonPositionTable
|
local maxButtons = #buttonPositionTable
|
||||||
|
|
||||||
-- Preload images
|
-- Preload images
|
||||||
|
|
@ -41,13 +41,13 @@ end
|
||||||
|
|
||||||
function createContextActionGui()
|
function createContextActionGui()
|
||||||
if not buttonScreenGui and isTouchDevice then
|
if not buttonScreenGui and isTouchDevice then
|
||||||
buttonScreenGui = Instance.new("ScreenGui")
|
buttonScreenGui = Instance.new "ScreenGui"
|
||||||
buttonScreenGui.Name = "ContextActionGui"
|
buttonScreenGui.Name = "ContextActionGui"
|
||||||
|
|
||||||
buttonFrame = Instance.new("Frame")
|
buttonFrame = Instance.new "Frame"
|
||||||
buttonFrame.BackgroundTransparency = 1
|
buttonFrame.BackgroundTransparency = 1
|
||||||
buttonFrame.Size = UDim2.new(0.3,0,0.5,0)
|
buttonFrame.Size = UDim2.new(0.3, 0, 0.5, 0)
|
||||||
buttonFrame.Position = UDim2.new(0.7,0,0.5,0)
|
buttonFrame.Position = UDim2.new(0.7, 0, 0.5, 0)
|
||||||
buttonFrame.Name = "ContextButtonFrame"
|
buttonFrame.Name = "ContextButtonFrame"
|
||||||
buttonFrame.Parent = buttonScreenGui
|
buttonFrame.Parent = buttonScreenGui
|
||||||
end
|
end
|
||||||
|
|
@ -66,7 +66,7 @@ function setButtonSizeAndPosition(object)
|
||||||
xOffset = 40
|
xOffset = 40
|
||||||
end
|
end
|
||||||
|
|
||||||
object.Size = UDim2.new(0,buttonSize,0,buttonSize)
|
object.Size = UDim2.new(0, buttonSize, 0, buttonSize)
|
||||||
end
|
end
|
||||||
|
|
||||||
function contextButtonDown(button, inputObject, actionName)
|
function contextButtonDown(button, inputObject, actionName)
|
||||||
|
|
@ -85,7 +85,10 @@ end
|
||||||
|
|
||||||
function contextButtonUp(button, inputObject, actionName)
|
function contextButtonUp(button, inputObject, actionName)
|
||||||
button.Image = ContextUpImage
|
button.Image = ContextUpImage
|
||||||
if inputObject.UserInputType == Enum.UserInputType.Touch and inputObject.UserInputState == Enum.UserInputState.End then
|
if
|
||||||
|
inputObject.UserInputType == Enum.UserInputType.Touch
|
||||||
|
and inputObject.UserInputState == Enum.UserInputState.End
|
||||||
|
then
|
||||||
contextActionService:CallFunction(actionName, Enum.UserInputState.End, inputObject)
|
contextActionService:CallFunction(actionName, Enum.UserInputState.End, inputObject)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -94,26 +97,27 @@ function isSmallScreenDevice()
|
||||||
return Game:GetService("GuiService"):GetScreenResolution().y <= 320
|
return Game:GetService("GuiService"):GetScreenResolution().y <= 320
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function createNewButton(actionName, functionInfoTable)
|
function createNewButton(actionName, functionInfoTable)
|
||||||
local contextButton = Instance.new("ImageButton")
|
local contextButton = Instance.new "ImageButton"
|
||||||
contextButton.Name = "ContextActionButton"
|
contextButton.Name = "ContextActionButton"
|
||||||
contextButton.BackgroundTransparency = 1
|
contextButton.BackgroundTransparency = 1
|
||||||
contextButton.Size = UDim2.new(0,90,0,90)
|
contextButton.Size = UDim2.new(0, 90, 0, 90)
|
||||||
contextButton.Active = true
|
contextButton.Active = true
|
||||||
if isSmallScreenDevice() then
|
if isSmallScreenDevice() then
|
||||||
contextButton.Size = UDim2.new(0,70,0,70)
|
contextButton.Size = UDim2.new(0, 70, 0, 70)
|
||||||
end
|
end
|
||||||
contextButton.Image = ContextUpImage
|
contextButton.Image = ContextUpImage
|
||||||
contextButton.Parent = buttonFrame
|
contextButton.Parent = buttonFrame
|
||||||
|
|
||||||
local currentButtonTouch = nil
|
local currentButtonTouch = nil
|
||||||
|
|
||||||
Game:GetService("UserInputService").InputEnded:connect(function ( inputObject )
|
Game:GetService("UserInputService").InputEnded:connect(function(inputObject)
|
||||||
oldTouches[inputObject] = nil
|
oldTouches[inputObject] = nil
|
||||||
end)
|
end)
|
||||||
contextButton.InputBegan:connect(function(inputObject)
|
contextButton.InputBegan:connect(function(inputObject)
|
||||||
if oldTouches[inputObject] then return end
|
if oldTouches[inputObject] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if inputObject.UserInputState == Enum.UserInputState.Begin and currentButtonTouch == nil then
|
if inputObject.UserInputState == Enum.UserInputState.Begin and currentButtonTouch == nil then
|
||||||
currentButtonTouch = inputObject
|
currentButtonTouch = inputObject
|
||||||
|
|
@ -121,21 +125,29 @@ function createNewButton(actionName, functionInfoTable)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
contextButton.InputChanged:connect(function(inputObject)
|
contextButton.InputChanged:connect(function(inputObject)
|
||||||
if oldTouches[inputObject] then return end
|
if oldTouches[inputObject] then
|
||||||
if currentButtonTouch ~= inputObject then return end
|
return
|
||||||
|
end
|
||||||
|
if currentButtonTouch ~= inputObject then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
contextButtonMoved(contextButton, inputObject, actionName)
|
contextButtonMoved(contextButton, inputObject, actionName)
|
||||||
end)
|
end)
|
||||||
contextButton.InputEnded:connect(function(inputObject)
|
contextButton.InputEnded:connect(function(inputObject)
|
||||||
if oldTouches[inputObject] then return end
|
if oldTouches[inputObject] then
|
||||||
if currentButtonTouch ~= inputObject then return end
|
return
|
||||||
|
end
|
||||||
|
if currentButtonTouch ~= inputObject then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
currentButtonTouch = nil
|
currentButtonTouch = nil
|
||||||
oldTouches[inputObject] = true
|
oldTouches[inputObject] = true
|
||||||
contextButtonUp(contextButton, inputObject, actionName)
|
contextButtonUp(contextButton, inputObject, actionName)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local actionIcon = Instance.new("ImageLabel")
|
local actionIcon = Instance.new "ImageLabel"
|
||||||
actionIcon.Name = "ActionIcon"
|
actionIcon.Name = "ActionIcon"
|
||||||
actionIcon.Position = UDim2.new(0.175, 0, 0.175, 0)
|
actionIcon.Position = UDim2.new(0.175, 0, 0.175, 0)
|
||||||
actionIcon.Size = UDim2.new(0.65, 0, 0.65, 0)
|
actionIcon.Size = UDim2.new(0.65, 0, 0.65, 0)
|
||||||
|
|
@ -145,12 +157,12 @@ function createNewButton(actionName, functionInfoTable)
|
||||||
end
|
end
|
||||||
actionIcon.Parent = contextButton
|
actionIcon.Parent = contextButton
|
||||||
|
|
||||||
local actionTitle = Instance.new("TextLabel")
|
local actionTitle = Instance.new "TextLabel"
|
||||||
actionTitle.Name = "ActionTitle"
|
actionTitle.Name = "ActionTitle"
|
||||||
actionTitle.Size = UDim2.new(1,0,1,0)
|
actionTitle.Size = UDim2.new(1, 0, 1, 0)
|
||||||
actionTitle.BackgroundTransparency = 1
|
actionTitle.BackgroundTransparency = 1
|
||||||
actionTitle.Font = Enum.Font.SourceSansBold
|
actionTitle.Font = Enum.Font.SourceSansBold
|
||||||
actionTitle.TextColor3 = Color3.new(1,1,1)
|
actionTitle.TextColor3 = Color3.new(1, 1, 1)
|
||||||
actionTitle.TextStrokeTransparency = 0
|
actionTitle.TextStrokeTransparency = 0
|
||||||
actionTitle.FontSize = Enum.FontSize.Size18
|
actionTitle.FontSize = Enum.FontSize.Size18
|
||||||
actionTitle.TextWrapped = true
|
actionTitle.TextWrapped = true
|
||||||
|
|
@ -163,11 +175,11 @@ function createNewButton(actionName, functionInfoTable)
|
||||||
return contextButton
|
return contextButton
|
||||||
end
|
end
|
||||||
|
|
||||||
function createButton( actionName, functionInfoTable )
|
function createButton(actionName, functionInfoTable)
|
||||||
local button = createNewButton(actionName, functionInfoTable)
|
local button = createNewButton(actionName, functionInfoTable)
|
||||||
|
|
||||||
local position = nil
|
local position = nil
|
||||||
for i = 1,#buttonVector do
|
for i = 1, #buttonVector do
|
||||||
if buttonVector[i] == "empty" then
|
if buttonVector[i] == "empty" then
|
||||||
position = i
|
position = i
|
||||||
break
|
break
|
||||||
|
|
@ -194,14 +206,16 @@ function createButton( actionName, functionInfoTable )
|
||||||
end
|
end
|
||||||
|
|
||||||
function removeAction(actionName)
|
function removeAction(actionName)
|
||||||
if not functionTable[actionName] then return end
|
if not functionTable[actionName] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local actionButton = functionTable[actionName]["button"]
|
local actionButton = functionTable[actionName]["button"]
|
||||||
|
|
||||||
if actionButton then
|
if actionButton then
|
||||||
actionButton.Parent = nil
|
actionButton.Parent = nil
|
||||||
|
|
||||||
for i = 1,#buttonVector do
|
for i = 1, #buttonVector do
|
||||||
if buttonVector[i] == actionButton then
|
if buttonVector[i] == actionButton then
|
||||||
buttonVector[i] = "empty"
|
buttonVector[i] = "empty"
|
||||||
break
|
break
|
||||||
|
|
@ -214,11 +228,11 @@ function removeAction(actionName)
|
||||||
functionTable[actionName] = nil
|
functionTable[actionName] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function addAction(actionName,createTouchButton,functionInfoTable)
|
function addAction(actionName, createTouchButton, functionInfoTable)
|
||||||
if functionTable[actionName] then
|
if functionTable[actionName] then
|
||||||
removeAction(actionName)
|
removeAction(actionName)
|
||||||
end
|
end
|
||||||
functionTable[actionName] = {functionInfoTable}
|
functionTable[actionName] = { functionInfoTable }
|
||||||
if createTouchButton and isTouchDevice then
|
if createTouchButton and isTouchDevice then
|
||||||
createContextActionGui()
|
createContextActionGui()
|
||||||
createButton(actionName, functionInfoTable)
|
createButton(actionName, functionInfoTable)
|
||||||
|
|
@ -226,7 +240,7 @@ function addAction(actionName,createTouchButton,functionInfoTable)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Connections
|
-- Connections
|
||||||
contextActionService.BoundActionChanged:connect( function(actionName, changeName, changeTable)
|
contextActionService.BoundActionChanged:connect(function(actionName, changeName, changeTable)
|
||||||
if functionTable[actionName] and changeTable then
|
if functionTable[actionName] and changeTable then
|
||||||
local button = functionTable[actionName]["button"]
|
local button = functionTable[actionName]["button"]
|
||||||
if button then
|
if button then
|
||||||
|
|
@ -243,15 +257,15 @@ contextActionService.BoundActionChanged:connect( function(actionName, changeName
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
contextActionService.BoundActionAdded:connect( function(actionName, createTouchButton, functionInfoTable)
|
contextActionService.BoundActionAdded:connect(function(actionName, createTouchButton, functionInfoTable)
|
||||||
addAction(actionName, createTouchButton, functionInfoTable)
|
addAction(actionName, createTouchButton, functionInfoTable)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
contextActionService.BoundActionRemoved:connect( function(actionName, functionInfoTable)
|
contextActionService.BoundActionRemoved:connect(function(actionName, functionInfoTable)
|
||||||
removeAction(actionName)
|
removeAction(actionName)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
contextActionService.GetActionButtonEvent:connect( function(actionName)
|
contextActionService.GetActionButtonEvent:connect(function(actionName)
|
||||||
if functionTable[actionName] then
|
if functionTable[actionName] then
|
||||||
contextActionService:FireActionButtonFoundSignal(actionName, functionTable[actionName]["button"])
|
contextActionService:FireActionButtonFoundSignal(actionName, functionTable[actionName]["button"])
|
||||||
end
|
end
|
||||||
|
|
@ -260,5 +274,5 @@ end)
|
||||||
-- make sure any bound data before we setup connections is handled
|
-- make sure any bound data before we setup connections is handled
|
||||||
local boundActions = contextActionService:GetAllBoundActionInfo()
|
local boundActions = contextActionService:GetAllBoundActionInfo()
|
||||||
for actionName, actionData in pairs(boundActions) do
|
for actionName, actionData in pairs(boundActions) do
|
||||||
addAction(actionName,actionData["createTouchButton"],actionData)
|
addAction(actionName, actionData["createTouchButton"], actionData)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
423
153556783.lua
423
153556783.lua
|
|
@ -6,21 +6,23 @@
|
||||||
while not Game do
|
while not Game do
|
||||||
wait()
|
wait()
|
||||||
end
|
end
|
||||||
while not Game:FindFirstChild("Players") do
|
while not Game:FindFirstChild "Players" do
|
||||||
wait()
|
wait()
|
||||||
end
|
end
|
||||||
while not Game.Players.LocalPlayer do
|
while not Game.Players.LocalPlayer do
|
||||||
wait()
|
wait()
|
||||||
end
|
end
|
||||||
while not Game:FindFirstChild("CoreGui") do
|
while not Game:FindFirstChild "CoreGui" do
|
||||||
wait()
|
wait()
|
||||||
end
|
end
|
||||||
while not Game.CoreGui:FindFirstChild("RobloxGui") do
|
while not Game.CoreGui:FindFirstChild "RobloxGui" do
|
||||||
wait()
|
wait()
|
||||||
end
|
end
|
||||||
|
|
||||||
local userInputService = Game:GetService("UserInputService")
|
local userInputService = Game:GetService "UserInputService"
|
||||||
local success = pcall(function() userInputService:IsLuaTouchControls() end)
|
local success = pcall(function()
|
||||||
|
userInputService:IsLuaTouchControls()
|
||||||
|
end)
|
||||||
if not success then
|
if not success then
|
||||||
script:Destroy()
|
script:Destroy()
|
||||||
end
|
end
|
||||||
|
|
@ -34,7 +36,6 @@ function isSmallScreenDevice()
|
||||||
end
|
end
|
||||||
|
|
||||||
local localPlayer = Game.Players.LocalPlayer
|
local localPlayer = Game.Players.LocalPlayer
|
||||||
local thumbstickInactiveAlpha = 0.3
|
|
||||||
local thumbstickSize = 120
|
local thumbstickSize = 120
|
||||||
if isSmallScreenDevice() then
|
if isSmallScreenDevice() then
|
||||||
thumbstickSize = 70
|
thumbstickSize = 70
|
||||||
|
|
@ -58,7 +59,6 @@ local CameraZoomSensitivity = 0.03
|
||||||
local PinchZoomDelay = 0.2
|
local PinchZoomDelay = 0.2
|
||||||
local cameraTouch = nil
|
local cameraTouch = nil
|
||||||
|
|
||||||
|
|
||||||
-- make sure all of our images are good to go
|
-- make sure all of our images are good to go
|
||||||
Game:GetService("ContentProvider"):Preload(touchControlsSheet)
|
Game:GetService("ContentProvider"):Preload(touchControlsSheet)
|
||||||
|
|
||||||
|
|
@ -67,134 +67,181 @@ Game:GetService("ContentProvider"):Preload(touchControlsSheet)
|
||||||
-- Functions
|
-- Functions
|
||||||
|
|
||||||
function DistanceBetweenTwoPoints(point1, point2)
|
function DistanceBetweenTwoPoints(point1, point2)
|
||||||
local dx = point2.x - point1.x
|
local dx = point2.x - point1.x
|
||||||
local dy = point2.y - point1.y
|
local dy = point2.y - point1.y
|
||||||
return math.sqrt( (dx*dx) + (dy*dy) )
|
return math.sqrt((dx * dx) + (dy * dy))
|
||||||
end
|
end
|
||||||
|
|
||||||
function transformFromCenterToTopLeft(pointToTranslate, guiObject)
|
function transformFromCenterToTopLeft(pointToTranslate, guiObject)
|
||||||
return UDim2.new(0,pointToTranslate.x - guiObject.AbsoluteSize.x/2,0,pointToTranslate.y - guiObject.AbsoluteSize.y/2)
|
return UDim2.new(
|
||||||
|
0,
|
||||||
|
pointToTranslate.x - guiObject.AbsoluteSize.x / 2,
|
||||||
|
0,
|
||||||
|
pointToTranslate.y - guiObject.AbsoluteSize.y / 2
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function rotatePointAboutLocation(pointToRotate, pointToRotateAbout, radians)
|
function rotatePointAboutLocation(pointToRotate, pointToRotateAbout, radians)
|
||||||
local sinAnglePercent = math.sin(radians)
|
local sinAnglePercent = math.sin(radians)
|
||||||
local cosAnglePercent = math.cos(radians)
|
local cosAnglePercent = math.cos(radians)
|
||||||
|
|
||||||
local transformedPoint = pointToRotate
|
local transformedPoint = pointToRotate
|
||||||
|
|
||||||
-- translate point back to origin:
|
-- translate point back to origin:
|
||||||
transformedPoint = Vector2.new(transformedPoint.x - pointToRotateAbout.x, transformedPoint.y - pointToRotateAbout.y)
|
transformedPoint = Vector2.new(transformedPoint.x - pointToRotateAbout.x, transformedPoint.y - pointToRotateAbout.y)
|
||||||
|
|
||||||
-- rotate point
|
-- rotate point
|
||||||
local xNew = transformedPoint.x * cosAnglePercent - transformedPoint.y * sinAnglePercent
|
local xNew = transformedPoint.x * cosAnglePercent - transformedPoint.y * sinAnglePercent
|
||||||
local yNew = transformedPoint.x * sinAnglePercent + transformedPoint.y * cosAnglePercent
|
local yNew = transformedPoint.x * sinAnglePercent + transformedPoint.y * cosAnglePercent
|
||||||
|
|
||||||
-- translate point back:
|
-- translate point back:
|
||||||
transformedPoint = Vector2.new(xNew + pointToRotateAbout.x, yNew + pointToRotateAbout.y)
|
transformedPoint = Vector2.new(xNew + pointToRotateAbout.x, yNew + pointToRotateAbout.y)
|
||||||
|
|
||||||
return transformedPoint
|
return transformedPoint
|
||||||
end
|
end
|
||||||
|
|
||||||
function dotProduct(v1,v2)
|
function dotProduct(v1, v2)
|
||||||
return ((v1.x*v2.x) + (v1.y*v2.y))
|
return ((v1.x * v2.x) + (v1.y * v2.y))
|
||||||
end
|
end
|
||||||
|
|
||||||
function stationaryThumbstickTouchMove(thumbstickFrame, thumbstickOuter, touchLocation)
|
function stationaryThumbstickTouchMove(thumbstickFrame, thumbstickOuter, touchLocation)
|
||||||
local thumbstickOuterCenterPosition = Vector2.new(thumbstickOuter.Position.X.Offset + thumbstickOuter.AbsoluteSize.x/2, thumbstickOuter.Position.Y.Offset + thumbstickOuter.AbsoluteSize.y/2)
|
local thumbstickOuterCenterPosition = Vector2.new(
|
||||||
local centerDiff = DistanceBetweenTwoPoints(touchLocation, thumbstickOuterCenterPosition)
|
thumbstickOuter.Position.X.Offset + thumbstickOuter.AbsoluteSize.x / 2,
|
||||||
|
thumbstickOuter.Position.Y.Offset + thumbstickOuter.AbsoluteSize.y / 2
|
||||||
|
)
|
||||||
|
local centerDiff = DistanceBetweenTwoPoints(touchLocation, thumbstickOuterCenterPosition)
|
||||||
|
|
||||||
-- thumbstick is moving outside our region, need to cap its distance
|
-- thumbstick is moving outside our region, need to cap its distance
|
||||||
if centerDiff > (thumbstickSize/2) then
|
if centerDiff > (thumbstickSize / 2) then
|
||||||
local thumbVector = Vector2.new(touchLocation.x - thumbstickOuterCenterPosition.x,touchLocation.y - thumbstickOuterCenterPosition.y);
|
local thumbVector = Vector2.new(
|
||||||
local normal = thumbVector.unit
|
touchLocation.x - thumbstickOuterCenterPosition.x,
|
||||||
if normal.x == math.nan or normal.x == math.inf then
|
touchLocation.y - thumbstickOuterCenterPosition.y
|
||||||
normal = Vector2.new(0,normal.y)
|
)
|
||||||
end
|
local normal = thumbVector.unit
|
||||||
if normal.y == math.nan or normal.y == math.inf then
|
if normal.x == math.nan or normal.x == math.inf then
|
||||||
normal = Vector2.new(normal.x,0)
|
normal = Vector2.new(0, normal.y)
|
||||||
end
|
end
|
||||||
|
if normal.y == math.nan or normal.y == math.inf then
|
||||||
|
normal = Vector2.new(normal.x, 0)
|
||||||
|
end
|
||||||
|
|
||||||
local newThumbstickInnerPosition = thumbstickOuterCenterPosition + (normal * (thumbstickSize/2))
|
local newThumbstickInnerPosition = thumbstickOuterCenterPosition + (normal * (thumbstickSize / 2))
|
||||||
thumbstickFrame.Position = transformFromCenterToTopLeft(newThumbstickInnerPosition, thumbstickFrame)
|
thumbstickFrame.Position = transformFromCenterToTopLeft(newThumbstickInnerPosition, thumbstickFrame)
|
||||||
else
|
else
|
||||||
thumbstickFrame.Position = transformFromCenterToTopLeft(touchLocation,thumbstickFrame)
|
thumbstickFrame.Position = transformFromCenterToTopLeft(touchLocation, thumbstickFrame)
|
||||||
end
|
end
|
||||||
|
|
||||||
return Vector2.new(thumbstickFrame.Position.X.Offset - thumbstickOuter.Position.X.Offset,thumbstickFrame.Position.Y.Offset - thumbstickOuter.Position.Y.Offset)
|
return Vector2.new(
|
||||||
|
thumbstickFrame.Position.X.Offset - thumbstickOuter.Position.X.Offset,
|
||||||
|
thumbstickFrame.Position.Y.Offset - thumbstickOuter.Position.Y.Offset
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function followThumbstickTouchMove(thumbstickFrame, thumbstickOuter, touchLocation)
|
function followThumbstickTouchMove(thumbstickFrame, thumbstickOuter, touchLocation)
|
||||||
local thumbstickOuterCenter = Vector2.new(thumbstickOuter.Position.X.Offset + thumbstickOuter.AbsoluteSize.x/2, thumbstickOuter.Position.Y.Offset + thumbstickOuter.AbsoluteSize.y/2)
|
local thumbstickOuterCenter = Vector2.new(
|
||||||
|
thumbstickOuter.Position.X.Offset + thumbstickOuter.AbsoluteSize.x / 2,
|
||||||
|
thumbstickOuter.Position.Y.Offset + thumbstickOuter.AbsoluteSize.y / 2
|
||||||
|
)
|
||||||
|
|
||||||
-- thumbstick is moving outside our region, need to position outer thumbstick texture carefully (to make look and feel like actual joystick controller)
|
-- thumbstick is moving outside our region, need to position outer thumbstick texture carefully (to make look and feel like actual joystick controller)
|
||||||
if DistanceBetweenTwoPoints(touchLocation, thumbstickOuterCenter) > thumbstickSize/2 then
|
if DistanceBetweenTwoPoints(touchLocation, thumbstickOuterCenter) > thumbstickSize / 2 then
|
||||||
local thumbstickInnerCenter = Vector2.new(thumbstickFrame.Position.X.Offset + thumbstickFrame.AbsoluteSize.x/2, thumbstickFrame.Position.Y.Offset + thumbstickFrame.AbsoluteSize.y/2)
|
local thumbstickInnerCenter = Vector2.new(
|
||||||
local movementVectorUnit = Vector2.new(touchLocation.x - thumbstickInnerCenter.x, touchLocation.y - thumbstickInnerCenter.y).unit
|
thumbstickFrame.Position.X.Offset + thumbstickFrame.AbsoluteSize.x / 2,
|
||||||
|
thumbstickFrame.Position.Y.Offset + thumbstickFrame.AbsoluteSize.y / 2
|
||||||
|
)
|
||||||
|
local movementVectorUnit =
|
||||||
|
Vector2.new(touchLocation.x - thumbstickInnerCenter.x, touchLocation.y - thumbstickInnerCenter.y).unit
|
||||||
|
|
||||||
local outerToInnerVectorCurrent = Vector2.new(thumbstickInnerCenter.x - thumbstickOuterCenter.x, thumbstickInnerCenter.y - thumbstickOuterCenter.y)
|
local outerToInnerVectorCurrent = Vector2.new(
|
||||||
local outerToInnerVectorCurrentUnit = outerToInnerVectorCurrent.unit
|
thumbstickInnerCenter.x - thumbstickOuterCenter.x,
|
||||||
local movementVector = Vector2.new(touchLocation.x - thumbstickInnerCenter.x, touchLocation.y - thumbstickInnerCenter.y)
|
thumbstickInnerCenter.y - thumbstickOuterCenter.y
|
||||||
|
)
|
||||||
|
local outerToInnerVectorCurrentUnit = outerToInnerVectorCurrent.unit
|
||||||
|
local movementVector =
|
||||||
|
Vector2.new(touchLocation.x - thumbstickInnerCenter.x, touchLocation.y - thumbstickInnerCenter.y)
|
||||||
|
|
||||||
-- First, find the angle between the new thumbstick movement vector,
|
-- First, find the angle between the new thumbstick movement vector,
|
||||||
-- and the vector between thumbstick inner and thumbstick outer.
|
-- and the vector between thumbstick inner and thumbstick outer.
|
||||||
-- We will use this to pivot thumbstick outer around thumbstick inner, gives a nice joystick feel
|
-- We will use this to pivot thumbstick outer around thumbstick inner, gives a nice joystick feel
|
||||||
local crossOuterToInnerWithMovement = (outerToInnerVectorCurrentUnit.x * movementVectorUnit.y) - (outerToInnerVectorCurrentUnit.y * movementVectorUnit.x)
|
local crossOuterToInnerWithMovement = (outerToInnerVectorCurrentUnit.x * movementVectorUnit.y)
|
||||||
local angle = math.atan2(crossOuterToInnerWithMovement, dotProduct(outerToInnerVectorCurrentUnit, movementVectorUnit))
|
- (outerToInnerVectorCurrentUnit.y * movementVectorUnit.x)
|
||||||
local anglePercent = angle * math.min( (movementVector.magnitude)/(outerToInnerVectorCurrent.magnitude), 1.0);
|
local angle =
|
||||||
|
math.atan2(crossOuterToInnerWithMovement, dotProduct(outerToInnerVectorCurrentUnit, movementVectorUnit))
|
||||||
|
local anglePercent = angle * math.min(movementVector.magnitude / outerToInnerVectorCurrent.magnitude, 1.0)
|
||||||
|
|
||||||
-- If angle is significant, rotate about the inner thumbsticks current center
|
-- If angle is significant, rotate about the inner thumbsticks current center
|
||||||
if math.abs(anglePercent) > 0.00001 then
|
if math.abs(anglePercent) > 0.00001 then
|
||||||
local outerThumbCenter = rotatePointAboutLocation(thumbstickOuterCenter, thumbstickInnerCenter, anglePercent)
|
local outerThumbCenter =
|
||||||
thumbstickOuter.Position = transformFromCenterToTopLeft(Vector2.new(outerThumbCenter.x,outerThumbCenter.y), thumbstickOuter)
|
rotatePointAboutLocation(thumbstickOuterCenter, thumbstickInnerCenter, anglePercent)
|
||||||
end
|
thumbstickOuter.Position =
|
||||||
|
transformFromCenterToTopLeft(Vector2.new(outerThumbCenter.x, outerThumbCenter.y), thumbstickOuter)
|
||||||
|
end
|
||||||
|
|
||||||
-- now just translate outer thumbstick to make sure it stays nears inner thumbstick
|
-- now just translate outer thumbstick to make sure it stays nears inner thumbstick
|
||||||
thumbstickOuter.Position = UDim2.new(0,thumbstickOuter.Position.X.Offset+movementVector.x,0,thumbstickOuter.Position.Y.Offset+movementVector.y)
|
thumbstickOuter.Position = UDim2.new(
|
||||||
end
|
0,
|
||||||
|
thumbstickOuter.Position.X.Offset + movementVector.x,
|
||||||
|
0,
|
||||||
|
thumbstickOuter.Position.Y.Offset + movementVector.y
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
thumbstickFrame.Position = transformFromCenterToTopLeft(touchLocation,thumbstickFrame)
|
thumbstickFrame.Position = transformFromCenterToTopLeft(touchLocation, thumbstickFrame)
|
||||||
|
|
||||||
-- a bit of error checking to make sure thumbsticks stay close to eachother
|
-- a bit of error checking to make sure thumbsticks stay close to eachother
|
||||||
thumbstickFramePosition = Vector2.new(thumbstickFrame.Position.X.Offset,thumbstickFrame.Position.Y.Offset)
|
thumbstickFramePosition = Vector2.new(thumbstickFrame.Position.X.Offset, thumbstickFrame.Position.Y.Offset)
|
||||||
thumbstickOuterPosition = Vector2.new(thumbstickOuter.Position.X.Offset,thumbstickOuter.Position.Y.Offset)
|
thumbstickOuterPosition = Vector2.new(thumbstickOuter.Position.X.Offset, thumbstickOuter.Position.Y.Offset)
|
||||||
if DistanceBetweenTwoPoints(thumbstickFramePosition, thumbstickOuterPosition) > thumbstickSize/2 then
|
if DistanceBetweenTwoPoints(thumbstickFramePosition, thumbstickOuterPosition) > thumbstickSize / 2 then
|
||||||
local vectorWithLength = (thumbstickOuterPosition - thumbstickFramePosition).unit * thumbstickSize/2
|
local vectorWithLength = (thumbstickOuterPosition - thumbstickFramePosition).unit * thumbstickSize / 2
|
||||||
thumbstickOuter.Position = UDim2.new(0,thumbstickFramePosition.x + vectorWithLength.x,0,thumbstickFramePosition.y + vectorWithLength.y)
|
thumbstickOuter.Position = UDim2.new(
|
||||||
end
|
0,
|
||||||
|
thumbstickFramePosition.x + vectorWithLength.x,
|
||||||
|
0,
|
||||||
|
thumbstickFramePosition.y + vectorWithLength.y
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
return Vector2.new(thumbstickFrame.Position.X.Offset - thumbstickOuter.Position.X.Offset,thumbstickFrame.Position.Y.Offset - thumbstickOuter.Position.Y.Offset)
|
return Vector2.new(
|
||||||
|
thumbstickFrame.Position.X.Offset - thumbstickOuter.Position.X.Offset,
|
||||||
|
thumbstickFrame.Position.Y.Offset - thumbstickOuter.Position.Y.Offset
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function movementOutsideDeadZone(movementVector)
|
function movementOutsideDeadZone(movementVector)
|
||||||
return ( (math.abs(movementVector.x) > ThumbstickDeadZone) or (math.abs(movementVector.y) > ThumbstickDeadZone) )
|
return ((math.abs(movementVector.x) > ThumbstickDeadZone) or (math.abs(movementVector.y) > ThumbstickDeadZone))
|
||||||
end
|
end
|
||||||
|
|
||||||
function constructThumbstick(defaultThumbstickPos, updateFunction, stationaryThumbstick)
|
function constructThumbstick(defaultThumbstickPos, updateFunction, stationaryThumbstick)
|
||||||
local thumbstickFrame = Instance.new("Frame")
|
local thumbstickFrame = Instance.new "Frame"
|
||||||
thumbstickFrame.Name = "ThumbstickFrame"
|
thumbstickFrame.Name = "ThumbstickFrame"
|
||||||
thumbstickFrame.Active = true
|
thumbstickFrame.Active = true
|
||||||
thumbstickFrame.Size = UDim2.new(0,thumbstickSize,0,thumbstickSize)
|
thumbstickFrame.Size = UDim2.new(0, thumbstickSize, 0, thumbstickSize)
|
||||||
thumbstickFrame.Position = defaultThumbstickPos
|
thumbstickFrame.Position = defaultThumbstickPos
|
||||||
thumbstickFrame.BackgroundTransparency = 1
|
thumbstickFrame.BackgroundTransparency = 1
|
||||||
|
|
||||||
local outerThumbstick = Instance.new("ImageLabel")
|
local outerThumbstick = Instance.new "ImageLabel"
|
||||||
outerThumbstick.Name = "OuterThumbstick"
|
outerThumbstick.Name = "OuterThumbstick"
|
||||||
outerThumbstick.Image = touchControlsSheet
|
outerThumbstick.Image = touchControlsSheet
|
||||||
outerThumbstick.ImageRectOffset = Vector2.new(0,0)
|
outerThumbstick.ImageRectOffset = Vector2.new(0, 0)
|
||||||
outerThumbstick.ImageRectSize = Vector2.new(220,220)
|
outerThumbstick.ImageRectSize = Vector2.new(220, 220)
|
||||||
outerThumbstick.BackgroundTransparency = 1
|
outerThumbstick.BackgroundTransparency = 1
|
||||||
outerThumbstick.Size = UDim2.new(0,thumbstickSize,0,thumbstickSize)
|
outerThumbstick.Size = UDim2.new(0, thumbstickSize, 0, thumbstickSize)
|
||||||
outerThumbstick.Position = defaultThumbstickPos
|
outerThumbstick.Position = defaultThumbstickPos
|
||||||
outerThumbstick.Parent = Game.CoreGui.RobloxGui
|
outerThumbstick.Parent = Game.CoreGui.RobloxGui
|
||||||
|
|
||||||
local innerThumbstick = Instance.new("ImageLabel")
|
local innerThumbstick = Instance.new "ImageLabel"
|
||||||
innerThumbstick.Name = "InnerThumbstick"
|
innerThumbstick.Name = "InnerThumbstick"
|
||||||
innerThumbstick.Image = touchControlsSheet
|
innerThumbstick.Image = touchControlsSheet
|
||||||
innerThumbstick.ImageRectOffset = Vector2.new(220,0)
|
innerThumbstick.ImageRectOffset = Vector2.new(220, 0)
|
||||||
innerThumbstick.ImageRectSize = Vector2.new(111,111)
|
innerThumbstick.ImageRectSize = Vector2.new(111, 111)
|
||||||
innerThumbstick.BackgroundTransparency = 1
|
innerThumbstick.BackgroundTransparency = 1
|
||||||
innerThumbstick.Size = UDim2.new(0,thumbstickSize/2,0,thumbstickSize/2)
|
innerThumbstick.Size = UDim2.new(0, thumbstickSize / 2, 0, thumbstickSize / 2)
|
||||||
innerThumbstick.Position = UDim2.new(0, thumbstickFrame.Size.X.Offset/2 - thumbstickSize/4, 0, thumbstickFrame.Size.Y.Offset/2 - thumbstickSize/4)
|
innerThumbstick.Position = UDim2.new(
|
||||||
|
0,
|
||||||
|
thumbstickFrame.Size.X.Offset / 2 - thumbstickSize / 4,
|
||||||
|
0,
|
||||||
|
thumbstickFrame.Size.Y.Offset / 2 - thumbstickSize / 4
|
||||||
|
)
|
||||||
innerThumbstick.Parent = thumbstickFrame
|
innerThumbstick.Parent = thumbstickFrame
|
||||||
innerThumbstick.ZIndex = 2
|
innerThumbstick.ZIndex = 2
|
||||||
|
|
||||||
|
|
@ -203,35 +250,51 @@ function constructThumbstick(defaultThumbstickPos, updateFunction, stationaryThu
|
||||||
local userInputSeviceTouchEndedCon = nil
|
local userInputSeviceTouchEndedCon = nil
|
||||||
|
|
||||||
local startInputTracking = function(inputObject)
|
local startInputTracking = function(inputObject)
|
||||||
if thumbstickTouch then return end
|
if thumbstickTouch then
|
||||||
if inputObject == cameraTouch then return end
|
return
|
||||||
if inputObject == currentJumpTouch then return end
|
end
|
||||||
if inputObject.UserInputType ~= Enum.UserInputType.Touch then return end
|
if inputObject == cameraTouch then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if inputObject == currentJumpTouch then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if inputObject.UserInputType ~= Enum.UserInputType.Touch then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
thumbstickTouch = inputObject
|
thumbstickTouch = inputObject
|
||||||
table.insert(thumbstickTouches,thumbstickTouch)
|
table.insert(thumbstickTouches, thumbstickTouch)
|
||||||
|
|
||||||
thumbstickFrame.Position = transformFromCenterToTopLeft(thumbstickTouch.Position,thumbstickFrame)
|
thumbstickFrame.Position = transformFromCenterToTopLeft(thumbstickTouch.Position, thumbstickFrame)
|
||||||
outerThumbstick.Position = thumbstickFrame.Position
|
outerThumbstick.Position = thumbstickFrame.Position
|
||||||
|
|
||||||
userInputServiceTouchMovedCon = userInputService.TouchMoved:connect(function(movedInput)
|
userInputServiceTouchMovedCon = userInputService.TouchMoved:connect(function(movedInput)
|
||||||
if movedInput == thumbstickTouch then
|
if movedInput == thumbstickTouch then
|
||||||
local movementVector = nil
|
local movementVector = nil
|
||||||
if stationaryThumbstick then
|
if stationaryThumbstick then
|
||||||
movementVector = stationaryThumbstickTouchMove(thumbstickFrame,outerThumbstick,Vector2.new(movedInput.Position.x,movedInput.Position.y))
|
movementVector = stationaryThumbstickTouchMove(
|
||||||
|
thumbstickFrame,
|
||||||
|
outerThumbstick,
|
||||||
|
Vector2.new(movedInput.Position.x, movedInput.Position.y)
|
||||||
|
)
|
||||||
else
|
else
|
||||||
movementVector = followThumbstickTouchMove(thumbstickFrame,outerThumbstick,Vector2.new(movedInput.Position.x,movedInput.Position.y))
|
movementVector = followThumbstickTouchMove(
|
||||||
|
thumbstickFrame,
|
||||||
|
outerThumbstick,
|
||||||
|
Vector2.new(movedInput.Position.x, movedInput.Position.y)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
if updateFunction then
|
if updateFunction then
|
||||||
updateFunction(movementVector,outerThumbstick.Size.X.Offset/2)
|
updateFunction(movementVector, outerThumbstick.Size.X.Offset / 2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
userInputSeviceTouchEndedCon = userInputService.TouchEnded:connect(function(endedInput)
|
userInputSeviceTouchEndedCon = userInputService.TouchEnded:connect(function(endedInput)
|
||||||
if endedInput == thumbstickTouch then
|
if endedInput == thumbstickTouch then
|
||||||
if updateFunction then
|
if updateFunction then
|
||||||
updateFunction(Vector2.new(0,0),1)
|
updateFunction(Vector2.new(0, 0), 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
userInputSeviceTouchEndedCon:disconnect()
|
userInputSeviceTouchEndedCon:disconnect()
|
||||||
|
|
@ -242,7 +305,7 @@ function constructThumbstick(defaultThumbstickPos, updateFunction, stationaryThu
|
||||||
|
|
||||||
for i, object in pairs(thumbstickTouches) do
|
for i, object in pairs(thumbstickTouches) do
|
||||||
if object == thumbstickTouch then
|
if object == thumbstickTouch then
|
||||||
table.remove(thumbstickTouches,i)
|
table.remove(thumbstickTouches, i)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -262,31 +325,31 @@ function constructThumbstick(defaultThumbstickPos, updateFunction, stationaryThu
|
||||||
return thumbstickFrame
|
return thumbstickFrame
|
||||||
end
|
end
|
||||||
|
|
||||||
function setupCharacterMovement( parentFrame )
|
function setupCharacterMovement(parentFrame)
|
||||||
local lastMovementVector, lastMaxMovement = nil
|
local lastMovementVector, lastMaxMovement = nil
|
||||||
local moveCharacterFunc = localPlayer.MoveCharacter
|
local moveCharacterFunc = localPlayer.MoveCharacter
|
||||||
local moveCharacterFunction = function ( movementVector, maxMovement )
|
local moveCharacterFunction = function(movementVector, maxMovement)
|
||||||
if localPlayer then
|
if localPlayer then
|
||||||
if movementOutsideDeadZone(movementVector) then
|
if movementOutsideDeadZone(movementVector) then
|
||||||
lastMovementVector = movementVector
|
lastMovementVector = movementVector
|
||||||
lastMaxMovement = maxMovement
|
lastMaxMovement = maxMovement
|
||||||
-- sometimes rounding error will not allow us to go max speed at some
|
-- sometimes rounding error will not allow us to go max speed at some
|
||||||
-- thumbstick angles, fix this with a bit of fudging near 100% throttle
|
-- thumbstick angles, fix this with a bit of fudging near 100% throttle
|
||||||
if movementVector.magnitude/maxMovement > ThumbstickMaxPercentGive then
|
if movementVector.magnitude / maxMovement > ThumbstickMaxPercentGive then
|
||||||
maxMovement = movementVector.magnitude - 1
|
maxMovement = movementVector.magnitude - 1
|
||||||
end
|
end
|
||||||
moveCharacterFunc(localPlayer, movementVector, maxMovement)
|
moveCharacterFunc(localPlayer, movementVector, maxMovement)
|
||||||
else
|
else
|
||||||
lastMovementVector = Vector2.new(0,0)
|
lastMovementVector = Vector2.new(0, 0)
|
||||||
lastMaxMovement = 1
|
lastMaxMovement = 1
|
||||||
moveCharacterFunc(localPlayer, lastMovementVector, lastMaxMovement)
|
moveCharacterFunc(localPlayer, lastMovementVector, lastMaxMovement)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local thumbstickPos = UDim2.new(0,thumbstickSize/2,1,-thumbstickSize*1.75)
|
local thumbstickPos = UDim2.new(0, thumbstickSize / 2, 1, -thumbstickSize * 1.75)
|
||||||
if isSmallScreenDevice() then
|
if isSmallScreenDevice() then
|
||||||
thumbstickPos = UDim2.new(0,(thumbstickSize/2) - 10,1,-thumbstickSize - 20)
|
thumbstickPos = UDim2.new(0, (thumbstickSize / 2) - 10, 1, -thumbstickSize - 20)
|
||||||
end
|
end
|
||||||
local characterThumbstick = constructThumbstick(thumbstickPos, moveCharacterFunction, false)
|
local characterThumbstick = constructThumbstick(thumbstickPos, moveCharacterFunction, false)
|
||||||
characterThumbstick.Name = "CharacterThumbstick"
|
characterThumbstick.Name = "CharacterThumbstick"
|
||||||
|
|
@ -300,36 +363,41 @@ function setupCharacterMovement( parentFrame )
|
||||||
return refreshCharacterMovement
|
return refreshCharacterMovement
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function setupJumpButton(parentFrame)
|
||||||
function setupJumpButton( parentFrame )
|
local jumpButton = Instance.new "ImageButton"
|
||||||
local jumpButton = Instance.new("ImageButton")
|
|
||||||
jumpButton.Name = "JumpButton"
|
jumpButton.Name = "JumpButton"
|
||||||
jumpButton.BackgroundTransparency = 1
|
jumpButton.BackgroundTransparency = 1
|
||||||
jumpButton.Image = touchControlsSheet
|
jumpButton.Image = touchControlsSheet
|
||||||
jumpButton.ImageRectOffset = Vector2.new(176,222)
|
jumpButton.ImageRectOffset = Vector2.new(176, 222)
|
||||||
jumpButton.ImageRectSize = Vector2.new(174,174)
|
jumpButton.ImageRectSize = Vector2.new(174, 174)
|
||||||
jumpButton.Size = UDim2.new(0,jumpButtonSize,0,jumpButtonSize)
|
jumpButton.Size = UDim2.new(0, jumpButtonSize, 0, jumpButtonSize)
|
||||||
if isSmallScreenDevice() then
|
if isSmallScreenDevice() then
|
||||||
jumpButton.Position = UDim2.new(1, -(jumpButtonSize*2.25), 1, -jumpButtonSize - 20)
|
jumpButton.Position = UDim2.new(1, -(jumpButtonSize * 2.25), 1, -jumpButtonSize - 20)
|
||||||
else
|
else
|
||||||
jumpButton.Position = UDim2.new(1, -(jumpButtonSize*2.75), 1, -jumpButtonSize - 120)
|
jumpButton.Position = UDim2.new(1, -(jumpButtonSize * 2.75), 1, -jumpButtonSize - 120)
|
||||||
end
|
end
|
||||||
|
|
||||||
local playerJumpFunc = localPlayer.JumpCharacter
|
local playerJumpFunc = localPlayer.JumpCharacter
|
||||||
|
|
||||||
local doJumpLoop = function ()
|
local doJumpLoop = function()
|
||||||
while currentJumpTouch do
|
while currentJumpTouch do
|
||||||
if localPlayer then
|
if localPlayer then
|
||||||
playerJumpFunc(localPlayer)
|
playerJumpFunc(localPlayer)
|
||||||
end
|
end
|
||||||
wait(1/60)
|
wait(1 / 60)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
jumpButton.InputBegan:connect(function(inputObject)
|
jumpButton.InputBegan:connect(function(inputObject)
|
||||||
if inputObject.UserInputType ~= Enum.UserInputType.Touch then return end
|
if inputObject.UserInputType ~= Enum.UserInputType.Touch then
|
||||||
if currentJumpTouch then return end
|
return
|
||||||
if inputObject == cameraTouch then return end
|
end
|
||||||
|
if currentJumpTouch then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if inputObject == cameraTouch then
|
||||||
|
return
|
||||||
|
end
|
||||||
for i, touch in pairs(oldJumpTouches) do
|
for i, touch in pairs(oldJumpTouches) do
|
||||||
if touch == inputObject then
|
if touch == inputObject then
|
||||||
return
|
return
|
||||||
|
|
@ -337,25 +405,27 @@ function setupJumpButton( parentFrame )
|
||||||
end
|
end
|
||||||
|
|
||||||
currentJumpTouch = inputObject
|
currentJumpTouch = inputObject
|
||||||
jumpButton.ImageRectOffset = Vector2.new(0,222)
|
jumpButton.ImageRectOffset = Vector2.new(0, 222)
|
||||||
jumpButton.ImageRectSize = Vector2.new(174,174)
|
jumpButton.ImageRectSize = Vector2.new(174, 174)
|
||||||
doJumpLoop()
|
doJumpLoop()
|
||||||
end)
|
end)
|
||||||
jumpButton.InputEnded:connect(function (inputObject)
|
jumpButton.InputEnded:connect(function(inputObject)
|
||||||
if inputObject.UserInputType ~= Enum.UserInputType.Touch then return end
|
if inputObject.UserInputType ~= Enum.UserInputType.Touch then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
jumpButton.ImageRectOffset = Vector2.new(176,222)
|
jumpButton.ImageRectOffset = Vector2.new(176, 222)
|
||||||
jumpButton.ImageRectSize = Vector2.new(174,174)
|
jumpButton.ImageRectSize = Vector2.new(174, 174)
|
||||||
|
|
||||||
if inputObject == currentJumpTouch then
|
if inputObject == currentJumpTouch then
|
||||||
table.insert(oldJumpTouches,currentJumpTouch)
|
table.insert(oldJumpTouches, currentJumpTouch)
|
||||||
currentJumpTouch = nil
|
currentJumpTouch = nil
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
userInputService.InputEnded:connect(function ( globalInputObject )
|
userInputService.InputEnded:connect(function(globalInputObject)
|
||||||
for i, touch in pairs(oldJumpTouches) do
|
for i, touch in pairs(oldJumpTouches) do
|
||||||
if touch == globalInputObject then
|
if touch == globalInputObject then
|
||||||
table.remove(oldJumpTouches,i)
|
table.remove(oldJumpTouches, i)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -370,8 +440,10 @@ function setupJumpButton( parentFrame )
|
||||||
jumpButton.Parent = parentFrame
|
jumpButton.Parent = parentFrame
|
||||||
end
|
end
|
||||||
|
|
||||||
function isTouchUsedByJumpButton( touch )
|
function isTouchUsedByJumpButton(touch)
|
||||||
if touch == currentJumpTouch then return true end
|
if touch == currentJumpTouch then
|
||||||
|
return true
|
||||||
|
end
|
||||||
for i, touchToCompare in pairs(oldJumpTouches) do
|
for i, touchToCompare in pairs(oldJumpTouches) do
|
||||||
if touch == touchToCompare then
|
if touch == touchToCompare then
|
||||||
return true
|
return true
|
||||||
|
|
@ -409,7 +481,7 @@ function setupCameraControl(parentFrame, refreshCharacterMoveFunc)
|
||||||
lastPos = nil
|
lastPos = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local resetPinchState = function ()
|
local resetPinchState = function()
|
||||||
pinchTouches = {}
|
pinchTouches = {}
|
||||||
lastPinchScale = nil
|
lastPinchScale = nil
|
||||||
shouldPinch = false
|
shouldPinch = false
|
||||||
|
|
@ -419,18 +491,20 @@ function setupCameraControl(parentFrame, refreshCharacterMoveFunc)
|
||||||
|
|
||||||
local startPinch = function(firstTouch, secondTouch)
|
local startPinch = function(firstTouch, secondTouch)
|
||||||
-- track pinching in new frame
|
-- track pinching in new frame
|
||||||
if pinchFrame then pinchFrame:Destroy() end -- make sure we didn't track in any mud
|
if pinchFrame then
|
||||||
pinchFrame = Instance.new("Frame")
|
pinchFrame:Destroy()
|
||||||
pinchFrame.Name = "PinchFrame"
|
end -- make sure we didn't track in any mud
|
||||||
pinchFrame.BackgroundTransparency = 1
|
pinchFrame = Instance.new "Frame"
|
||||||
pinchFrame.Parent = parentFrame
|
pinchFrame.Name = "PinchFrame"
|
||||||
pinchFrame.Size = UDim2.new(1,0,1,0)
|
pinchFrame.BackgroundTransparency = 1
|
||||||
|
pinchFrame.Parent = parentFrame
|
||||||
|
pinchFrame.Size = UDim2.new(1, 0, 1, 0)
|
||||||
|
|
||||||
pinchFrame.InputChanged:connect(function(inputObject)
|
pinchFrame.InputChanged:connect(function(inputObject)
|
||||||
if not shouldPinch then
|
if not shouldPinch then
|
||||||
resetPinchState()
|
resetPinchState()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
resetCameraRotateState()
|
resetCameraRotateState()
|
||||||
|
|
||||||
if lastPinchScale == nil then -- first pinch move, just set up scale
|
if lastPinchScale == nil then -- first pinch move, just set up scale
|
||||||
|
|
@ -458,34 +532,38 @@ function setupCameraControl(parentFrame, refreshCharacterMoveFunc)
|
||||||
lastPinchScale = newPinchDistance
|
lastPinchScale = newPinchDistance
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
pinchFrame.InputEnded:connect(function(inputObject) -- pinch is over, destroy all
|
pinchFrame.InputEnded:connect(function(inputObject) -- pinch is over, destroy all
|
||||||
if inputObject == firstTouch or inputObject == secondTouch then
|
if inputObject == firstTouch or inputObject == secondTouch then
|
||||||
resetPinchState()
|
resetPinchState()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
local pinchGestureReceivedTouch = function(inputObject)
|
local pinchGestureReceivedTouch = function(inputObject)
|
||||||
if #pinchTouches < 1 then
|
if #pinchTouches < 1 then
|
||||||
table.insert(pinchTouches,inputObject)
|
table.insert(pinchTouches, inputObject)
|
||||||
pinchTime = tick()
|
pinchTime = tick()
|
||||||
shouldPinch = false
|
shouldPinch = false
|
||||||
elseif #pinchTouches == 1 then
|
elseif #pinchTouches == 1 then
|
||||||
shouldPinch = ( (tick() - pinchTime) <= PinchZoomDelay )
|
shouldPinch = ((tick() - pinchTime) <= PinchZoomDelay)
|
||||||
|
|
||||||
if shouldPinch then
|
if shouldPinch then
|
||||||
table.insert(pinchTouches,inputObject)
|
table.insert(pinchTouches, inputObject)
|
||||||
startPinch(pinchTouches[1], pinchTouches[2])
|
startPinch(pinchTouches[1], pinchTouches[2])
|
||||||
else -- shouldn't ever get here, but just in case
|
else -- shouldn't ever get here, but just in case
|
||||||
pinchTouches = {}
|
pinchTouches = {}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
parentFrame.InputBegan:connect(function (inputObject)
|
parentFrame.InputBegan:connect(function(inputObject)
|
||||||
if inputObject.UserInputType ~= Enum.UserInputType.Touch then return end
|
if inputObject.UserInputType ~= Enum.UserInputType.Touch then
|
||||||
if isTouchUsedByJumpButton(inputObject) then return end
|
return
|
||||||
|
end
|
||||||
|
if isTouchUsedByJumpButton(inputObject) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local usedByThumbstick = isTouchUsedByThumbstick(inputObject)
|
local usedByThumbstick = isTouchUsedByThumbstick(inputObject)
|
||||||
if not usedByThumbstick then
|
if not usedByThumbstick then
|
||||||
|
|
@ -494,15 +572,19 @@ function setupCameraControl(parentFrame, refreshCharacterMoveFunc)
|
||||||
|
|
||||||
if cameraTouch == nil and not usedByThumbstick then
|
if cameraTouch == nil and not usedByThumbstick then
|
||||||
cameraTouch = inputObject
|
cameraTouch = inputObject
|
||||||
lastPos = Vector2.new(cameraTouch.Position.x,cameraTouch.Position.y)
|
lastPos = Vector2.new(cameraTouch.Position.x, cameraTouch.Position.y)
|
||||||
lastTick = tick()
|
lastTick = tick()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
userInputService.InputChanged:connect(function (inputObject)
|
userInputService.InputChanged:connect(function(inputObject)
|
||||||
if inputObject.UserInputType ~= Enum.UserInputType.Touch then return end
|
if inputObject.UserInputType ~= Enum.UserInputType.Touch then
|
||||||
if cameraTouch ~= inputObject then return end
|
return
|
||||||
|
end
|
||||||
|
if cameraTouch ~= inputObject then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local newPos = Vector2.new(cameraTouch.Position.x,cameraTouch.Position.y)
|
local newPos = Vector2.new(cameraTouch.Position.x, cameraTouch.Position.y)
|
||||||
local touchDiff = (lastPos - newPos) * CameraRotateSensitivity
|
local touchDiff = (lastPos - newPos) * CameraRotateSensitivity
|
||||||
|
|
||||||
-- first time rotating outside deadzone, just setup for next changed event
|
-- first time rotating outside deadzone, just setup for next changed event
|
||||||
|
|
@ -518,23 +600,23 @@ function setupCameraControl(parentFrame, refreshCharacterMoveFunc)
|
||||||
lastPos = newPos
|
lastPos = newPos
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
userInputService.InputEnded:connect(function (inputObject)
|
userInputService.InputEnded:connect(function(inputObject)
|
||||||
if cameraTouch == inputObject or cameraTouch == nil then
|
if cameraTouch == inputObject or cameraTouch == nil then
|
||||||
resetCameraRotateState()
|
resetCameraRotateState()
|
||||||
end
|
end
|
||||||
|
|
||||||
for i, touch in pairs(pinchTouches) do
|
for i, touch in pairs(pinchTouches) do
|
||||||
if touch == inputObject then
|
if touch == inputObject then
|
||||||
table.remove(pinchTouches,i)
|
table.remove(pinchTouches, i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function setupTouchControls()
|
function setupTouchControls()
|
||||||
local touchControlFrame = Instance.new("Frame")
|
local touchControlFrame = Instance.new "Frame"
|
||||||
touchControlFrame.Name = "TouchControlFrame"
|
touchControlFrame.Name = "TouchControlFrame"
|
||||||
touchControlFrame.Size = UDim2.new(1,0,1,0)
|
touchControlFrame.Size = UDim2.new(1, 0, 1, 0)
|
||||||
touchControlFrame.BackgroundTransparency = 1
|
touchControlFrame.BackgroundTransparency = 1
|
||||||
touchControlFrame.Parent = Game.CoreGui.RobloxGui
|
touchControlFrame.Parent = Game.CoreGui.RobloxGui
|
||||||
|
|
||||||
|
|
@ -543,7 +625,9 @@ function setupTouchControls()
|
||||||
setupCameraControl(touchControlFrame, refreshCharacterMoveFunc)
|
setupCameraControl(touchControlFrame, refreshCharacterMoveFunc)
|
||||||
|
|
||||||
userInputService.ProcessedEvent:connect(function(inputObject, processed)
|
userInputService.ProcessedEvent:connect(function(inputObject, processed)
|
||||||
if not processed then return end
|
if not processed then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- kill camera pan if the touch is used by some user controls
|
-- kill camera pan if the touch is used by some user controls
|
||||||
if inputObject == cameraTouch and inputObject.UserInputState == Enum.UserInputState.Begin then
|
if inputObject == cameraTouch and inputObject.UserInputState == Enum.UserInputState.Begin then
|
||||||
|
|
@ -552,7 +636,6 @@ function setupTouchControls()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
-- Start of Script
|
-- Start of Script
|
||||||
|
|
|
||||||
784
157877000.lua
784
157877000.lua
File diff suppressed because it is too large
Load Diff
74
36868950.lua
74
36868950.lua
|
|
@ -1,28 +1,28 @@
|
||||||
local controlFrame = script.Parent:FindFirstChild("ControlFrame")
|
local controlFrame = script.Parent:FindFirstChild "ControlFrame"
|
||||||
|
|
||||||
if not controlFrame then return end
|
if not controlFrame then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local topLeftControl = controlFrame:FindFirstChild("TopLeftControl")
|
local bottomLeftControl = controlFrame:FindFirstChild "BottomLeftControl"
|
||||||
local bottomLeftControl = controlFrame:FindFirstChild("BottomLeftControl")
|
local bottomRightControl = controlFrame:FindFirstChild "BottomRightControl"
|
||||||
local bottomRightControl = controlFrame:FindFirstChild("BottomRightControl")
|
|
||||||
|
|
||||||
|
local frameTip = Instance.new "TextLabel"
|
||||||
local frameTip = Instance.new("TextLabel")
|
|
||||||
frameTip.Name = "ToolTip"
|
frameTip.Name = "ToolTip"
|
||||||
frameTip.Text = ""
|
frameTip.Text = ""
|
||||||
frameTip.Font = Enum.Font.ArialBold
|
frameTip.Font = Enum.Font.ArialBold
|
||||||
frameTip.FontSize = Enum.FontSize.Size12
|
frameTip.FontSize = Enum.FontSize.Size12
|
||||||
frameTip.TextColor3 = Color3.new(1,1,1)
|
frameTip.TextColor3 = Color3.new(1, 1, 1)
|
||||||
frameTip.BorderSizePixel = 0
|
frameTip.BorderSizePixel = 0
|
||||||
frameTip.ZIndex = 10
|
frameTip.ZIndex = 10
|
||||||
frameTip.Size = UDim2.new(2,0,1,0)
|
frameTip.Size = UDim2.new(2, 0, 1, 0)
|
||||||
frameTip.Position = UDim2.new(1,0,0,0)
|
frameTip.Position = UDim2.new(1, 0, 0, 0)
|
||||||
frameTip.BackgroundColor3 = Color3.new(0,0,0)
|
frameTip.BackgroundColor3 = Color3.new(0, 0, 0)
|
||||||
frameTip.BackgroundTransparency = 1
|
frameTip.BackgroundTransparency = 1
|
||||||
frameTip.TextTransparency = 1
|
frameTip.TextTransparency = 1
|
||||||
frameTip.TextWrap = true
|
frameTip.TextWrap = true
|
||||||
|
|
||||||
local inside = Instance.new("BoolValue")
|
local inside = Instance.new "BoolValue"
|
||||||
inside.Name = "inside"
|
inside.Name = "inside"
|
||||||
inside.Value = false
|
inside.Value = false
|
||||||
inside.Parent = frameTip
|
inside.Parent = frameTip
|
||||||
|
|
@ -30,7 +30,7 @@ inside.Parent = frameTip
|
||||||
function setUpListeners(frameToListen)
|
function setUpListeners(frameToListen)
|
||||||
local fadeSpeed = 0.1
|
local fadeSpeed = 0.1
|
||||||
frameToListen.Parent.MouseEnter:connect(function()
|
frameToListen.Parent.MouseEnter:connect(function()
|
||||||
if frameToListen:FindFirstChild("inside") then
|
if frameToListen:FindFirstChild "inside" then
|
||||||
frameToListen.inside.Value = true
|
frameToListen.inside.Value = true
|
||||||
wait(1.2)
|
wait(1.2)
|
||||||
if frameToListen.inside.Value then
|
if frameToListen.inside.Value then
|
||||||
|
|
@ -47,22 +47,26 @@ function setUpListeners(frameToListen)
|
||||||
killFrame.BackgroundTransparency = 1
|
killFrame.BackgroundTransparency = 1
|
||||||
killFrame.TextTransparency = 1
|
killFrame.TextTransparency = 1
|
||||||
end
|
end
|
||||||
frameToListen.Parent.MouseLeave:connect(function() killTip(frameToListen) end)
|
frameToListen.Parent.MouseLeave:connect(function()
|
||||||
frameToListen.Parent.MouseButton1Click:connect(function() killTip(frameToListen) end)
|
killTip(frameToListen)
|
||||||
|
end)
|
||||||
|
frameToListen.Parent.MouseButton1Click:connect(function()
|
||||||
|
killTip(frameToListen)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function createSettingsButtonTip(parent)
|
function createSettingsButtonTip(parent)
|
||||||
if parent == nil then
|
if parent == nil then
|
||||||
parent = bottomLeftControl:FindFirstChild("SettingsButton")
|
parent = bottomLeftControl:FindFirstChild "SettingsButton"
|
||||||
end
|
end
|
||||||
|
|
||||||
local toolTip = frameTip:clone()
|
local toolTip = frameTip:clone()
|
||||||
toolTip.RobloxLocked = true
|
toolTip.RobloxLocked = true
|
||||||
toolTip.Text = "Settings/Leave Game"
|
toolTip.Text = "Settings/Leave Game"
|
||||||
toolTip.Position = UDim2.new(0,0,0,-18)
|
toolTip.Position = UDim2.new(0, 0, 0, -18)
|
||||||
toolTip.Size = UDim2.new(0,120,0,20)
|
toolTip.Size = UDim2.new(0, 120, 0, 20)
|
||||||
toolTip.Parent = parent
|
toolTip.Parent = parent
|
||||||
setUpListeners(toolTip)
|
setUpListeners(toolTip)
|
||||||
end
|
end
|
||||||
|
|
||||||
wait(5) -- make sure we are loaded in, won't need tool tips for first 5 seconds anyway
|
wait(5) -- make sure we are loaded in, won't need tool tips for first 5 seconds anyway
|
||||||
|
|
@ -70,18 +74,16 @@ wait(5) -- make sure we are loaded in, won't need tool tips for first 5 seconds
|
||||||
---------------- set up Bottom Left Tool Tips -------------------------
|
---------------- set up Bottom Left Tool Tips -------------------------
|
||||||
|
|
||||||
local bottomLeftChildren = bottomLeftControl:GetChildren()
|
local bottomLeftChildren = bottomLeftControl:GetChildren()
|
||||||
local hasSettingsTip = false
|
|
||||||
|
|
||||||
for i = 1, #bottomLeftChildren do
|
for i = 1, #bottomLeftChildren do
|
||||||
|
|
||||||
if bottomLeftChildren[i].Name == "Exit" then
|
if bottomLeftChildren[i].Name == "Exit" then
|
||||||
local exitTip = frameTip:clone()
|
local exitTip = frameTip:clone()
|
||||||
exitTip.RobloxLocked = true
|
exitTip.RobloxLocked = true
|
||||||
exitTip.Text = "Leave Place"
|
exitTip.Text = "Leave Place"
|
||||||
exitTip.Position = UDim2.new(0,0,-1,0)
|
exitTip.Position = UDim2.new(0, 0, -1, 0)
|
||||||
exitTip.Size = UDim2.new(1,0,1,0)
|
exitTip.Size = UDim2.new(1, 0, 1, 0)
|
||||||
exitTip.Parent = bottomLeftChildren[i]
|
exitTip.Parent = bottomLeftChildren[i]
|
||||||
setUpListeners(exitTip)
|
setUpListeners(exitTip)
|
||||||
elseif bottomLeftChildren[i].Name == "SettingsButton" then
|
elseif bottomLeftChildren[i].Name == "SettingsButton" then
|
||||||
hasSettingsTip = true
|
hasSettingsTip = true
|
||||||
createSettingsButtonTip(bottomLeftChildren[i])
|
createSettingsButtonTip(bottomLeftChildren[i])
|
||||||
|
|
@ -93,16 +95,16 @@ end
|
||||||
local bottomRightChildren = bottomRightControl:GetChildren()
|
local bottomRightChildren = bottomRightControl:GetChildren()
|
||||||
|
|
||||||
for i = 1, #bottomRightChildren do
|
for i = 1, #bottomRightChildren do
|
||||||
if bottomRightChildren[i].Name:find("Camera") ~= nil then
|
if bottomRightChildren[i].Name:find "Camera" ~= nil then
|
||||||
local cameraTip = frameTip:clone()
|
local cameraTip = frameTip:clone()
|
||||||
cameraTip.RobloxLocked = true
|
cameraTip.RobloxLocked = true
|
||||||
cameraTip.Text = "Camera View"
|
cameraTip.Text = "Camera View"
|
||||||
if bottomRightChildren[i].Name:find("Zoom") then
|
if bottomRightChildren[i].Name:find "Zoom" then
|
||||||
cameraTip.Position = UDim2.new(-1,0,-1.5)
|
cameraTip.Position = UDim2.new(-1, 0, -1.5)
|
||||||
else
|
else
|
||||||
cameraTip.Position = UDim2.new(0,0,-1.5,0)
|
cameraTip.Position = UDim2.new(0, 0, -1.5, 0)
|
||||||
end
|
end
|
||||||
cameraTip.Size = UDim2.new(2,0,1.25,0)
|
cameraTip.Size = UDim2.new(2, 0, 1.25, 0)
|
||||||
cameraTip.Parent = bottomRightChildren[i]
|
cameraTip.Parent = bottomRightChildren[i]
|
||||||
setUpListeners(cameraTip)
|
setUpListeners(cameraTip)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
66
37801172.lua
66
37801172.lua
|
|
@ -1,13 +1,14 @@
|
||||||
|
|
||||||
-- Creates all neccessary scripts for the gui on initial load, everything except build tools
|
-- Creates all neccessary scripts for the gui on initial load, everything except build tools
|
||||||
-- Created by Ben T. 10/29/10
|
-- Created by Ben T. 10/29/10
|
||||||
-- Please note that these are loaded in a specific order to diminish errors/perceived load time by user
|
-- Please note that these are loaded in a specific order to diminish errors/perceived load time by user
|
||||||
local scriptContext = game:GetService("ScriptContext")
|
local scriptContext = game:GetService "ScriptContext"
|
||||||
local touchEnabled = false
|
local touchEnabled = false
|
||||||
pcall(function() touchEnabled = game:GetService("UserInputService").TouchEnabled end)
|
pcall(function()
|
||||||
|
touchEnabled = game:GetService("UserInputService").TouchEnabled
|
||||||
|
end)
|
||||||
|
|
||||||
-- library registration
|
-- library registration
|
||||||
scriptContext:AddCoreScript(60595695, scriptContext,"/Libraries/LibraryRegistration/LibraryRegistration")
|
scriptContext:AddCoreScript(60595695, scriptContext, "/Libraries/LibraryRegistration/LibraryRegistration")
|
||||||
|
|
||||||
local function waitForChild(instance, name)
|
local function waitForChild(instance, name)
|
||||||
while not instance:FindFirstChild(name) do
|
while not instance:FindFirstChild(name) do
|
||||||
|
|
@ -21,90 +22,87 @@ local function waitForProperty(instance, property)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Responsible for tracking logging items
|
-- Responsible for tracking logging items
|
||||||
local scriptContext = game:GetService("ScriptContext")
|
local scriptContext = game:GetService "ScriptContext"
|
||||||
scriptContext:AddCoreScript(59002209, scriptContext, "CoreScripts/Sections")
|
scriptContext:AddCoreScript(59002209, scriptContext, "CoreScripts/Sections")
|
||||||
|
|
||||||
waitForChild(game:GetService("CoreGui"),"RobloxGui")
|
waitForChild(game:GetService "CoreGui", "RobloxGui")
|
||||||
local screenGui = game:GetService("CoreGui"):FindFirstChild("RobloxGui")
|
local screenGui = game:GetService("CoreGui"):FindFirstChild "RobloxGui"
|
||||||
|
|
||||||
if not touchEnabled then
|
if not touchEnabled then
|
||||||
-- ToolTipper (creates tool tips for gui)
|
-- ToolTipper (creates tool tips for gui)
|
||||||
scriptContext:AddCoreScript(36868950,screenGui,"CoreScripts/ToolTip")
|
scriptContext:AddCoreScript(36868950, screenGui, "CoreScripts/ToolTip")
|
||||||
-- SettingsScript
|
-- SettingsScript
|
||||||
scriptContext:AddCoreScript(46295863,screenGui,"CoreScripts/Settings")
|
scriptContext:AddCoreScript(46295863, screenGui, "CoreScripts/Settings")
|
||||||
else
|
else
|
||||||
scriptContext:AddCoreScript(153556783,screenGui,"CoreScripts/TouchControls")
|
scriptContext:AddCoreScript(153556783, screenGui, "CoreScripts/TouchControls")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- MainBotChatScript
|
-- MainBotChatScript
|
||||||
scriptContext:AddCoreScript(39250920,screenGui,"CoreScripts/MainBotChatScript")
|
scriptContext:AddCoreScript(39250920, screenGui, "CoreScripts/MainBotChatScript")
|
||||||
|
|
||||||
-- Popup Script
|
-- Popup Script
|
||||||
scriptContext:AddCoreScript(48488451,screenGui,"CoreScripts/PopupScript")
|
scriptContext:AddCoreScript(48488451, screenGui, "CoreScripts/PopupScript")
|
||||||
-- Friend Notification Script (probably can use this script to expand out to other notifications)
|
-- Friend Notification Script (probably can use this script to expand out to other notifications)
|
||||||
scriptContext:AddCoreScript(48488398,screenGui,"CoreScripts/NotificationScript")
|
scriptContext:AddCoreScript(48488398, screenGui, "CoreScripts/NotificationScript")
|
||||||
-- Chat script
|
-- Chat script
|
||||||
scriptContext:AddCoreScript(97188756, screenGui, "CoreScripts/ChatScript")
|
scriptContext:AddCoreScript(97188756, screenGui, "CoreScripts/ChatScript")
|
||||||
-- Purchase Prompt Script
|
-- Purchase Prompt Script
|
||||||
scriptContext:AddCoreScript(107893730, screenGui, "CoreScripts/PurchasePromptScript")
|
scriptContext:AddCoreScript(107893730, screenGui, "CoreScripts/PurchasePromptScript")
|
||||||
|
|
||||||
if not touchEnabled then
|
if not touchEnabled or screenGui.AbsoluteSize.Y > 600 then
|
||||||
-- New Player List
|
-- New Player List
|
||||||
scriptContext:AddCoreScript(48488235,screenGui,"CoreScripts/PlayerListScript")
|
scriptContext:AddCoreScript(48488235, screenGui, "CoreScripts/PlayerListScript")
|
||||||
elseif screenGui.AbsoluteSize.Y > 600 then
|
|
||||||
-- New Player List
|
|
||||||
scriptContext:AddCoreScript(48488235,screenGui,"CoreScripts/PlayerListScript")
|
|
||||||
else
|
else
|
||||||
delay(5, function()
|
delay(5, function()
|
||||||
if screenGui.AbsoluteSize.Y >= 600 then
|
if screenGui.AbsoluteSize.Y >= 600 then
|
||||||
-- New Player List
|
-- New Player List
|
||||||
scriptContext:AddCoreScript(48488235,screenGui,"CoreScripts/PlayerListScript")
|
scriptContext:AddCoreScript(48488235, screenGui, "CoreScripts/PlayerListScript")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
if game.CoreGui.Version >= 3 and game.PlaceId ~= 130815926 then --todo: remove placeid hack for halloween
|
if game.CoreGui.Version >= 3 and game.PlaceId ~= 130815926 then --todo: remove placeid hack for halloween
|
||||||
-- Backpack Builder, creates most of the backpack gui
|
-- Backpack Builder, creates most of the backpack gui
|
||||||
scriptContext:AddCoreScript(53878047,screenGui,"CoreScripts/BackpackScripts/BackpackBuilder")
|
scriptContext:AddCoreScript(53878047, screenGui, "CoreScripts/BackpackScripts/BackpackBuilder")
|
||||||
|
|
||||||
waitForChild(screenGui,"CurrentLoadout")
|
waitForChild(screenGui, "CurrentLoadout")
|
||||||
waitForChild(screenGui,"Backpack")
|
waitForChild(screenGui, "Backpack")
|
||||||
local Backpack = screenGui.Backpack
|
local Backpack = screenGui.Backpack
|
||||||
|
|
||||||
-- Manager handles all big backpack state changes, other scripts subscribe to this and do things accordingly
|
-- Manager handles all big backpack state changes, other scripts subscribe to this and do things accordingly
|
||||||
if game.CoreGui.Version >= 7 then
|
if game.CoreGui.Version >= 7 then
|
||||||
scriptContext:AddCoreScript(89449093,Backpack,"CoreScripts/BackpackScripts/BackpackManager")
|
scriptContext:AddCoreScript(89449093, Backpack, "CoreScripts/BackpackScripts/BackpackManager")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Backpack Gear (handles all backpack gear tab stuff)
|
-- Backpack Gear (handles all backpack gear tab stuff)
|
||||||
game:GetService("ScriptContext"):AddCoreScript(89449008,Backpack,"CoreScripts/BackpackScripts/BackpackGear")
|
game:GetService("ScriptContext"):AddCoreScript(89449008, Backpack, "CoreScripts/BackpackScripts/BackpackGear")
|
||||||
-- Loadout Script, used for gear hotkeys
|
-- Loadout Script, used for gear hotkeys
|
||||||
scriptContext:AddCoreScript(53878057,screenGui.CurrentLoadout,"CoreScripts/BackpackScripts/LoadoutScript")
|
scriptContext:AddCoreScript(53878057, screenGui.CurrentLoadout, "CoreScripts/BackpackScripts/LoadoutScript")
|
||||||
if game.CoreGui.Version >= 8 then
|
if game.CoreGui.Version >= 8 then
|
||||||
-- Wardrobe script handles all character dressing operations
|
-- Wardrobe script handles all character dressing operations
|
||||||
scriptContext:AddCoreScript(-1,Backpack,"CoreScripts/BackpackScripts/BackpackWardrobe")
|
scriptContext:AddCoreScript(-1, Backpack, "CoreScripts/BackpackScripts/BackpackWardrobe")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local IsPersonalServer = not not game.Workspace:FindFirstChild("PSVariable")
|
local IsPersonalServer = not not game.Workspace:FindFirstChild "PSVariable"
|
||||||
if IsPersonalServer then
|
if IsPersonalServer then
|
||||||
game:GetService("ScriptContext"):AddCoreScript(64164692,game.Players.LocalPlayer,"BuildToolManager")
|
game:GetService("ScriptContext"):AddCoreScript(64164692, game.Players.LocalPlayer, "BuildToolManager")
|
||||||
end
|
end
|
||||||
game.Workspace.ChildAdded:connect(function(nchild)
|
game.Workspace.ChildAdded:connect(function(nchild)
|
||||||
if nchild.Name=='PSVariable' and nchild:IsA('BoolValue') then
|
if nchild.Name == "PSVariable" and nchild:IsA "BoolValue" then
|
||||||
IsPersonalServer = true
|
IsPersonalServer = true
|
||||||
game:GetService("ScriptContext"):AddCoreScript(64164692,game.Players.LocalPlayer,"BuildToolManager")
|
game:GetService("ScriptContext"):AddCoreScript(64164692, game.Players.LocalPlayer, "BuildToolManager")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if touchEnabled then -- touch devices don't use same control frame
|
if touchEnabled then -- touch devices don't use same control frame
|
||||||
-- only used for touch device button generation
|
-- only used for touch device button generation
|
||||||
scriptContext:AddCoreScript(152908679,screenGui,"CoreScripts/ContextActionTouch")
|
scriptContext:AddCoreScript(152908679, screenGui, "CoreScripts/ContextActionTouch")
|
||||||
|
|
||||||
waitForChild(screenGui, 'ControlFrame')
|
waitForChild(screenGui, "ControlFrame")
|
||||||
waitForChild(screenGui.ControlFrame, 'BottomLeftControl')
|
waitForChild(screenGui.ControlFrame, "BottomLeftControl")
|
||||||
screenGui.ControlFrame.BottomLeftControl.Visible = false
|
screenGui.ControlFrame.BottomLeftControl.Visible = false
|
||||||
|
|
||||||
waitForChild(screenGui.ControlFrame, 'TopLeftControl')
|
waitForChild(screenGui.ControlFrame, "TopLeftControl")
|
||||||
screenGui.ControlFrame.TopLeftControl.Visible = false
|
screenGui.ControlFrame.TopLeftControl.Visible = false
|
||||||
end
|
end
|
||||||
307
38037565.lua
307
38037565.lua
|
|
@ -1,52 +1,52 @@
|
||||||
local damageGuiWidth = 5.0
|
local damageGuiWidth = 5.0
|
||||||
local damageGuiHeight = 5.0
|
local damageGuiHeight = 5.0
|
||||||
|
|
||||||
|
|
||||||
function waitForChild(parent, childName)
|
function waitForChild(parent, childName)
|
||||||
local child = parent:findFirstChild(childName)
|
local child = parent:findFirstChild(childName)
|
||||||
if child then return child end
|
if child then
|
||||||
while true do
|
return child
|
||||||
child = parent.ChildAdded:wait()
|
end
|
||||||
if child.Name==childName then return child end
|
while true do
|
||||||
end
|
child = parent.ChildAdded:wait()
|
||||||
|
if child.Name == childName then
|
||||||
|
return child
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- declarations
|
-- declarations
|
||||||
local Figure = script.Parent
|
local Figure = script.Parent
|
||||||
local Head = waitForChild(Figure, "Head")
|
local Humanoid = waitForChild(Figure, "Humanoid")
|
||||||
local Humanoid = waitForChild(Figure, "Humanoid")
|
local Torso = waitForChild(Figure, "Torso")
|
||||||
local walkSpeed = Humanoid.WalkSpeed
|
|
||||||
local Torso = waitForChild(Figure, "Torso")
|
|
||||||
|
|
||||||
local config = Figure:FindFirstChild("PlayerStats")
|
local config = Figure:FindFirstChild "PlayerStats"
|
||||||
|
|
||||||
local inCharTag = Instance.new("BoolValue")
|
local inCharTag = Instance.new "BoolValue"
|
||||||
inCharTag.Name = "InCharTag"
|
inCharTag.Name = "InCharTag"
|
||||||
|
|
||||||
local hider = Instance.new("BoolValue")
|
local hider = Instance.new "BoolValue"
|
||||||
hider.Name = "RobloxBuildTool"
|
hider.Name = "RobloxBuildTool"
|
||||||
|
|
||||||
local currentChildren
|
local currentChildren
|
||||||
local backpackTools
|
local backpackTools
|
||||||
|
|
||||||
if config == nil then
|
if config == nil then
|
||||||
config = Instance.new("Configuration")
|
config = Instance.new "Configuration"
|
||||||
config.Parent = Figure
|
config.Parent = Figure
|
||||||
config.Name = "PlayerStats"
|
config.Name = "PlayerStats"
|
||||||
end
|
end
|
||||||
|
|
||||||
local myHealth = config:FindFirstChild("MaxHealth")
|
local myHealth = config:FindFirstChild "MaxHealth"
|
||||||
if myHealth == nil then
|
if myHealth == nil then
|
||||||
myHealth = Instance.new("NumberValue")
|
myHealth = Instance.new "NumberValue"
|
||||||
myHealth.Parent = config
|
myHealth.Parent = config
|
||||||
myHealth.Value = 100
|
myHealth.Value = 100
|
||||||
myHealth.Name = "MaxHealth"
|
myHealth.Name = "MaxHealth"
|
||||||
end
|
end
|
||||||
|
|
||||||
Humanoid.MaxHealth = myHealth.Value
|
Humanoid.MaxHealth = myHealth.Value
|
||||||
Humanoid.Health = myHealth.Value
|
Humanoid.Health = myHealth.Value
|
||||||
|
|
||||||
|
|
||||||
function onMaxHealthChange()
|
function onMaxHealthChange()
|
||||||
Humanoid.MaxHealth = myHealth.Value
|
Humanoid.MaxHealth = myHealth.Value
|
||||||
Humanoid.Health = myHealth.Value
|
Humanoid.Health = myHealth.Value
|
||||||
|
|
@ -54,50 +54,54 @@ end
|
||||||
|
|
||||||
myHealth.Changed:connect(onMaxHealthChange)
|
myHealth.Changed:connect(onMaxHealthChange)
|
||||||
|
|
||||||
|
|
||||||
--Humanoid.MaxHealth = myHealth.Value
|
--Humanoid.MaxHealth = myHealth.Value
|
||||||
--Humanoid.Health = Humanoid.MaxHealth
|
--Humanoid.Health = Humanoid.MaxHealth
|
||||||
|
|
||||||
local vPlayer = game.Players:GetPlayerFromCharacter(script.Parent)
|
local vPlayer = game.Players:GetPlayerFromCharacter(script.Parent)
|
||||||
local dotGui = vPlayer.PlayerGui:FindFirstChild("DamageOverTimeGui")
|
local dotGui = vPlayer.PlayerGui:FindFirstChild "DamageOverTimeGui"
|
||||||
if dotGui == nil then
|
if dotGui == nil then
|
||||||
dotGui = Instance.new("BillboardGui")
|
dotGui = Instance.new "BillboardGui"
|
||||||
dotGui.Name = "DamageOverTimeGui"
|
dotGui.Name = "DamageOverTimeGui"
|
||||||
dotGui.Parent = vPlayer.PlayerGui
|
dotGui.Parent = vPlayer.PlayerGui
|
||||||
dotGui.Adornee = script.Parent:FindFirstChild("Head")
|
dotGui.Adornee = script.Parent:FindFirstChild "Head"
|
||||||
dotGui.Active = true
|
dotGui.Active = true
|
||||||
dotGui.size = UDim2.new(damageGuiWidth, 0.0, damageGuiHeight, 0.0)
|
dotGui.size = UDim2.new(damageGuiWidth, 0, damageGuiHeight, 0.0)
|
||||||
dotGui.StudsOffset = Vector3.new(0.0, 2.0, 0.0)
|
dotGui.StudsOffset = Vector3.new(0, 2.0, 0.0)
|
||||||
end
|
end
|
||||||
|
|
||||||
print("newHealth declarations finished")
|
print "newHealth declarations finished"
|
||||||
|
|
||||||
function billboardHealthChange(dmg)
|
function billboardHealthChange(dmg)
|
||||||
local textLabel = Instance.new("TextLabel")
|
local textLabel = Instance.new "TextLabel"
|
||||||
if dmg > 0 then textLabel.Text = tostring(dmg) textLabel.TextColor3 = Color3.new(0, 1, 0)
|
if dmg > 0 then
|
||||||
else textLabel.Text = tostring(dmg) textLabel.TextColor3 = Color3.new(1, 0, 1) end
|
textLabel.Text = tostring(dmg)
|
||||||
textLabel.size = UDim2.new(1.0, 0.0, 1.0, 0.0)
|
textLabel.TextColor3 = Color3.new(0, 1, 0)
|
||||||
textLabel.Active = true
|
else
|
||||||
textLabel.FontSize = 6
|
textLabel.Text = tostring(dmg)
|
||||||
textLabel.BackgroundTransparency = 1
|
textLabel.TextColor3 = Color3.new(1, 0, 1)
|
||||||
textLabel.Parent = dotGui
|
end
|
||||||
|
textLabel.size = UDim2.new(1, 0, 1, 0.0)
|
||||||
|
textLabel.Active = true
|
||||||
|
textLabel.FontSize = 6
|
||||||
|
textLabel.BackgroundTransparency = 1
|
||||||
|
textLabel.Parent = dotGui
|
||||||
|
|
||||||
for t = 1, 10 do
|
for t = 1, 10 do
|
||||||
wait(.1)
|
wait(0.1)
|
||||||
textLabel.TextTransparency = t/10
|
textLabel.TextTransparency = t / 10
|
||||||
textLabel.Position = UDim2.new(0, 0, 0, -t*5)
|
textLabel.Position = UDim2.new(0, 0, 0, -t * 5)
|
||||||
textLabel.FontSize = 6-t*.6
|
textLabel.FontSize = 6 - t * 0.6
|
||||||
end
|
end
|
||||||
|
|
||||||
textLabel:remove()
|
textLabel:remove()
|
||||||
end
|
end
|
||||||
|
|
||||||
function setMaxHealth()
|
function setMaxHealth()
|
||||||
--print(Humanoid.Health)
|
--print(Humanoid.Health)
|
||||||
if myHealth.Value >=0 then
|
if myHealth.Value >= 0 then
|
||||||
Humanoid.MaxHealth = myHealth.Value
|
Humanoid.MaxHealth = myHealth.Value
|
||||||
print(Humanoid.MaxHealth)
|
print(Humanoid.MaxHealth)
|
||||||
if Humanoid.Health > Humanoid.MaxHealth then
|
if Humanoid.Health > Humanoid.MaxHealth then
|
||||||
Humanoid.Health = Humanoid.MaxHealth
|
Humanoid.Health = Humanoid.MaxHealth
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -107,121 +111,130 @@ myHealth.Changed:connect(setMaxHealth)
|
||||||
|
|
||||||
-- Visual Effects --
|
-- Visual Effects --
|
||||||
|
|
||||||
fireEffect = Instance.new("Fire")
|
fireEffect = Instance.new "Fire"
|
||||||
fireEffect.Heat = 0.1
|
fireEffect.Heat = 0.1
|
||||||
fireEffect.Size = 3.0
|
fireEffect.Size = 3.0
|
||||||
fireEffect.Name = "FireEffect"
|
fireEffect.Name = "FireEffect"
|
||||||
fireEffect.Enabled = false
|
fireEffect.Enabled = false
|
||||||
--
|
--
|
||||||
|
|
||||||
|
-- regeneration
|
||||||
-- regeneration
|
while true do
|
||||||
while true do
|
local s = wait(1)
|
||||||
local s = wait(1)
|
local health = Humanoid.Health
|
||||||
local health = Humanoid.Health
|
if health > 0 then -- and health < Humanoid.MaxHealth then
|
||||||
if health > 0 then -- and health < Humanoid.MaxHealth then
|
local delta = 0
|
||||||
local delta = 0
|
if config then
|
||||||
if config then
|
regen = config:FindFirstChild "Regen"
|
||||||
regen = config:FindFirstChild("Regen")
|
poison = config:FindFirstChild "Poison"
|
||||||
poison = config:FindFirstChild("Poison")
|
ice = config:FindFirstChild "Ice"
|
||||||
ice = config:FindFirstChild("Ice")
|
fire = config:FindFirstChild "Fire"
|
||||||
fire = config:FindFirstChild("Fire")
|
stun = config:FindFirstChild "Stun"
|
||||||
stun = config:FindFirstChild("Stun")
|
if regen then
|
||||||
if regen then
|
delta = delta + regen.Value.X
|
||||||
delta = delta + regen.Value.X
|
if regen.Value.Y >= 0 then
|
||||||
if regen.Value.Y >= 0 then regen.Value = Vector3.new(regen.Value.X+regen.Value.Z, regen.Value.Y - s, regen.Value.Z) -- maybe have 3rd parameter be an increaser/decreaser?
|
regen.Value = Vector3.new(regen.Value.X + regen.Value.Z, regen.Value.Y - s, regen.Value.Z) -- maybe have 3rd parameter be an increaser/decreaser?
|
||||||
elseif regen.Value.Y == -1 then regen.Value = Vector3.new(regen.Value.X+regen.Value.Z, -1, regen.Value.Z)
|
elseif regen.Value.Y == -1 then
|
||||||
else regen:remove() end -- infinity is -1
|
regen.Value = Vector3.new(regen.Value.X + regen.Value.Z, -1, regen.Value.Z)
|
||||||
end
|
else
|
||||||
if poison then
|
regen:remove()
|
||||||
delta = delta - poison.Value.X
|
end -- infinity is -1
|
||||||
if poison.Value.Y >= 0 then poison.Value = Vector3.new(poison.Value.X+poison.Value.Z, poison.Value.Y - s, poison.Value.Z)
|
|
||||||
elseif poison.Value.Y == -1 then poison.Value = Vector3.new(poison.Value.X+poison.Value.Z, -1, poison.Value.Z)
|
|
||||||
else poison:remove() end -- infinity is -1
|
|
||||||
end
|
|
||||||
|
|
||||||
if ice then
|
|
||||||
--print("IN ICE")
|
|
||||||
delta = delta - ice.Value.X
|
|
||||||
if ice.Value.Y >=0 then
|
|
||||||
ice.Value = Vector3.new(ice.Value.X, ice.Value.Y - s, ice.Value.Z)
|
|
||||||
else
|
|
||||||
ice:remove()
|
|
||||||
end
|
end
|
||||||
end
|
if poison then
|
||||||
|
delta = delta - poison.Value.X
|
||||||
if fire then
|
if poison.Value.Y >= 0 then
|
||||||
fireEffect.Enabled = true
|
poison.Value = Vector3.new(poison.Value.X + poison.Value.Z, poison.Value.Y - s, poison.Value.Z)
|
||||||
fireEffect.Parent = Figure.Torso
|
elseif poison.Value.Y == -1 then
|
||||||
delta = delta - fire.Value.X
|
poison.Value = Vector3.new(poison.Value.X + poison.Value.Z, -1, poison.Value.Z)
|
||||||
if fire.Value.Y >= 0 then
|
else
|
||||||
fire.Value = Vector3.new(fire.Value.X, fire.Value.Y - s, fire.Value.Z)
|
poison:remove()
|
||||||
else
|
end -- infinity is -1
|
||||||
fire:remove()
|
|
||||||
fireEffect.Enabled = false
|
|
||||||
fireEffect.Parent = nil
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if stun then
|
if ice then
|
||||||
if stun.Value > 0 then
|
--print("IN ICE")
|
||||||
Torso.Anchored = true
|
delta = delta - ice.Value.X
|
||||||
currentChildren = script.Parent:GetChildren()
|
if ice.Value.Y >= 0 then
|
||||||
backpackTools = game.Players:GetPlayerFromCharacter(script.Parent).Backpack:GetChildren()
|
ice.Value = Vector3.new(ice.Value.X, ice.Value.Y - s, ice.Value.Z)
|
||||||
for i = 1, #currentChildren do
|
else
|
||||||
if currentChildren[i].className == "Tool" then
|
ice:remove()
|
||||||
inCharTag:Clone().Parent = currentChildren[i]
|
end
|
||||||
print(backpackTools)
|
end
|
||||||
table.insert(backpackTools, currentChildren[i])
|
|
||||||
|
if fire then
|
||||||
|
fireEffect.Enabled = true
|
||||||
|
fireEffect.Parent = Figure.Torso
|
||||||
|
delta = delta - fire.Value.X
|
||||||
|
if fire.Value.Y >= 0 then
|
||||||
|
fire.Value = Vector3.new(fire.Value.X, fire.Value.Y - s, fire.Value.Z)
|
||||||
|
else
|
||||||
|
fire:remove()
|
||||||
|
fireEffect.Enabled = false
|
||||||
|
fireEffect.Parent = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if stun then
|
||||||
|
if stun.Value > 0 then
|
||||||
|
Torso.Anchored = true
|
||||||
|
currentChildren = script.Parent:GetChildren()
|
||||||
|
backpackTools = game.Players:GetPlayerFromCharacter(script.Parent).Backpack:GetChildren()
|
||||||
|
for i = 1, #currentChildren do
|
||||||
|
if currentChildren[i].className == "Tool" then
|
||||||
|
inCharTag:Clone().Parent = currentChildren[i]
|
||||||
|
print(backpackTools)
|
||||||
|
table.insert(backpackTools, currentChildren[i])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
for i = 1, #backpackTools do
|
||||||
for i = 1, #backpackTools do
|
if backpackTools[i]:FindFirstChild "RobloxBuildTool" == nil then
|
||||||
if backpackTools[i]:FindFirstChild("RobloxBuildTool") == nil then
|
hider:Clone().Parent = backpackTools[i]
|
||||||
hider:Clone().Parent = backpackTools[i]
|
backpackTools[i].Parent = game.Lighting
|
||||||
backpackTools[i].Parent = game.Lighting
|
end
|
||||||
end
|
end
|
||||||
end
|
wait(0.2)
|
||||||
wait(0.2)
|
for i = 1, #backpackTools do
|
||||||
for i = 1, #backpackTools do
|
|
||||||
backpackTools[i].Parent = game.Players:GetPlayerFromCharacter(script.Parent).Backpack
|
|
||||||
end
|
|
||||||
stun.Value = stun.Value - s
|
|
||||||
else
|
|
||||||
Torso.Anchored = false
|
|
||||||
for i = 1, #backpackTools do
|
|
||||||
rbTool = backpackTools[i]:FindFirstChild("RobloxBuildTool")
|
|
||||||
if rbTool then rbTool:Remove() end
|
|
||||||
backpackTools[i].Parent = game.Lighting
|
|
||||||
end
|
|
||||||
wait(0.2)
|
|
||||||
for i = 1, #backpackTools do
|
|
||||||
wasInCharacter = backpackTools[i]:FindFirstChild("InCharTag")
|
|
||||||
if wasInChar then
|
|
||||||
wasInChar:Remove()
|
|
||||||
backpackTools[i].Parent = script.Parent
|
|
||||||
else
|
|
||||||
backpackTools[i].Parent = game.Players:GetPlayerFromCharacter(script.Parent).Backpack
|
backpackTools[i].Parent = game.Players:GetPlayerFromCharacter(script.Parent).Backpack
|
||||||
end
|
end
|
||||||
|
stun.Value = stun.Value - s
|
||||||
|
else
|
||||||
|
Torso.Anchored = false
|
||||||
|
for i = 1, #backpackTools do
|
||||||
|
rbTool = backpackTools[i]:FindFirstChild "RobloxBuildTool"
|
||||||
|
if rbTool then
|
||||||
|
rbTool:Remove()
|
||||||
|
end
|
||||||
|
backpackTools[i].Parent = game.Lighting
|
||||||
|
end
|
||||||
|
wait(0.2)
|
||||||
|
for i = 1, #backpackTools do
|
||||||
|
wasInCharacter = backpackTools[i]:FindFirstChild "InCharTag"
|
||||||
|
if wasInChar then
|
||||||
|
wasInChar:Remove()
|
||||||
|
backpackTools[i].Parent = script.Parent
|
||||||
|
else
|
||||||
|
backpackTools[i].Parent = game.Players:GetPlayerFromCharacter(script.Parent).Backpack
|
||||||
|
end
|
||||||
|
end
|
||||||
|
stun:Remove()
|
||||||
end
|
end
|
||||||
stun:Remove()
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if delta ~= 0 then
|
if delta ~= 0 then
|
||||||
newCo = coroutine.create(billboardHealthChange)
|
newCo = coroutine.create(billboardHealthChange)
|
||||||
coroutine.resume(newCo, delta)
|
coroutine.resume(newCo, delta)
|
||||||
|
end
|
||||||
|
--delta = delta * .01
|
||||||
end
|
end
|
||||||
--delta = delta * .01
|
--health = health + delta * s * Humanoid.MaxHealth
|
||||||
end
|
|
||||||
--health = health + delta * s * Humanoid.MaxHealth
|
|
||||||
|
|
||||||
health = Humanoid.Health + delta * s
|
health = Humanoid.Health + delta * s
|
||||||
if health * 1.01 < Humanoid.MaxHealth then
|
if health * 1.01 < Humanoid.MaxHealth then
|
||||||
Humanoid.Health = health
|
Humanoid.Health = health
|
||||||
--myHealth.Value = math.floor(Humanoid.Health)
|
--myHealth.Value = math.floor(Humanoid.Health)
|
||||||
elseif delta > 0 then
|
elseif delta > 0 then
|
||||||
Humanoid.Health = Humanoid.MaxHealth
|
Humanoid.Health = Humanoid.MaxHealth
|
||||||
--myHealth.Value = Humanoid.Health
|
--myHealth.Value = Humanoid.Health
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
|
||||||
284
39250920.lua
284
39250920.lua
|
|
@ -10,7 +10,6 @@ function waitForChild(instance, name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local mainFrame
|
local mainFrame
|
||||||
local choices = {}
|
local choices = {}
|
||||||
local lastChoice
|
local lastChoice
|
||||||
|
|
@ -19,15 +18,14 @@ local currentConversationDialog
|
||||||
local currentConversationPartner
|
local currentConversationPartner
|
||||||
local currentAbortDialogScript
|
local currentAbortDialogScript
|
||||||
|
|
||||||
local tooFarAwayMessage = "You are too far away to chat!"
|
local tooFarAwayMessage = "You are too far away to chat!"
|
||||||
local tooFarAwaySize = 300
|
local tooFarAwaySize = 300
|
||||||
local characterWanderedOffMessage = "Chat ended because you walked away"
|
local characterWanderedOffMessage = "Chat ended because you walked away"
|
||||||
local characterWanderedOffSize = 350
|
local characterWanderedOffSize = 350
|
||||||
local conversationTimedOut = "Chat ended because you didn't reply"
|
local conversationTimedOut = "Chat ended because you didn't reply"
|
||||||
local conversationTimedOutSize = 350
|
local conversationTimedOutSize = 350
|
||||||
|
|
||||||
local player
|
local player
|
||||||
local screenGui
|
|
||||||
local chatNotificationGui
|
local chatNotificationGui
|
||||||
local messageDialog
|
local messageDialog
|
||||||
local timeoutScript
|
local timeoutScript
|
||||||
|
|
@ -36,9 +34,9 @@ local dialogMap = {}
|
||||||
local dialogConnections = {}
|
local dialogConnections = {}
|
||||||
|
|
||||||
local gui = nil
|
local gui = nil
|
||||||
waitForChild(game,"CoreGui")
|
waitForChild(game, "CoreGui")
|
||||||
waitForChild(game.CoreGui,"RobloxGui")
|
waitForChild(game.CoreGui, "RobloxGui")
|
||||||
if game.CoreGui.RobloxGui:FindFirstChild("ControlFrame") then
|
if game.CoreGui.RobloxGui:FindFirstChild "ControlFrame" then
|
||||||
gui = game.CoreGui.RobloxGui.ControlFrame
|
gui = game.CoreGui.RobloxGui.ControlFrame
|
||||||
else
|
else
|
||||||
gui = game.CoreGui.RobloxGui
|
gui = game.CoreGui.RobloxGui
|
||||||
|
|
@ -52,37 +50,35 @@ function currentTone()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function createChatNotificationGui()
|
function createChatNotificationGui()
|
||||||
chatNotificationGui = Instance.new("BillboardGui")
|
chatNotificationGui = Instance.new "BillboardGui"
|
||||||
chatNotificationGui.Name = "ChatNotificationGui"
|
chatNotificationGui.Name = "ChatNotificationGui"
|
||||||
chatNotificationGui.ExtentsOffset = Vector3.new(0,1,0)
|
chatNotificationGui.ExtentsOffset = Vector3.new(0, 1, 0)
|
||||||
chatNotificationGui.Size = UDim2.new(4, 0, 5.42857122, 0)
|
chatNotificationGui.Size = UDim2.new(4, 0, 5.42857122, 0)
|
||||||
chatNotificationGui.SizeOffset = Vector2.new(0,0)
|
chatNotificationGui.SizeOffset = Vector2.new(0, 0)
|
||||||
chatNotificationGui.StudsOffset = Vector3.new(0.4, 4.3, 0)
|
chatNotificationGui.StudsOffset = Vector3.new(0.4, 4.3, 0)
|
||||||
chatNotificationGui.Enabled = true
|
chatNotificationGui.Enabled = true
|
||||||
chatNotificationGui.RobloxLocked = true
|
chatNotificationGui.RobloxLocked = true
|
||||||
chatNotificationGui.Active = true
|
chatNotificationGui.Active = true
|
||||||
|
|
||||||
local image = Instance.new("ImageLabel")
|
local image = Instance.new "ImageLabel"
|
||||||
image.Name = "Image"
|
image.Name = "Image"
|
||||||
image.Active = false
|
image.Active = false
|
||||||
image.BackgroundTransparency = 1
|
image.BackgroundTransparency = 1
|
||||||
image.Position = UDim2.new(0,0,0,0)
|
image.Position = UDim2.new(0, 0, 0, 0)
|
||||||
image.Size = UDim2.new(1.0,0,1.0,0)
|
image.Size = UDim2.new(1, 0, 1, 0)
|
||||||
image.Image = ""
|
image.Image = ""
|
||||||
image.RobloxLocked = true
|
image.RobloxLocked = true
|
||||||
image.Parent = chatNotificationGui
|
image.Parent = chatNotificationGui
|
||||||
|
|
||||||
|
local button = Instance.new "ImageButton"
|
||||||
local button = Instance.new("ImageButton")
|
|
||||||
button.Name = "Button"
|
button.Name = "Button"
|
||||||
button.AutoButtonColor = false
|
button.AutoButtonColor = false
|
||||||
button.Position = UDim2.new(0.0879999995, 0, 0.0529999994, 0)
|
button.Position = UDim2.new(0.0879999995, 0, 0.0529999994, 0)
|
||||||
button.Size = UDim2.new(0.829999983, 0, 0.460000008, 0)
|
button.Size = UDim2.new(0.829999983, 0, 0.460000008, 0)
|
||||||
button.Image = ""
|
button.Image = ""
|
||||||
button.BackgroundTransparency = 1
|
button.BackgroundTransparency = 1
|
||||||
button.RobloxLocked = true
|
button.RobloxLocked = true
|
||||||
button.Parent = image
|
button.Parent = image
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -97,7 +93,7 @@ function getChatColor(tone)
|
||||||
end
|
end
|
||||||
|
|
||||||
function styleChoices(tone)
|
function styleChoices(tone)
|
||||||
for i, obj in pairs(choices) do
|
for _, obj in pairs(choices) do
|
||||||
resetColor(obj, tone)
|
resetColor(obj, tone)
|
||||||
end
|
end
|
||||||
resetColor(lastChoice, tone)
|
resetColor(lastChoice, tone)
|
||||||
|
|
@ -135,26 +131,26 @@ function setChatNotificationTone(gui, purpose, tone)
|
||||||
end
|
end
|
||||||
|
|
||||||
function createMessageDialog()
|
function createMessageDialog()
|
||||||
messageDialog = Instance.new("Frame");
|
messageDialog = Instance.new "Frame"
|
||||||
messageDialog.Name = "DialogScriptMessage"
|
messageDialog.Name = "DialogScriptMessage"
|
||||||
messageDialog.Style = Enum.FrameStyle.RobloxRound
|
messageDialog.Style = Enum.FrameStyle.RobloxRound
|
||||||
messageDialog.Visible = false
|
messageDialog.Visible = false
|
||||||
|
|
||||||
local text = Instance.new("TextLabel")
|
local text = Instance.new "TextLabel"
|
||||||
text.Name = "Text"
|
text.Name = "Text"
|
||||||
text.Position = UDim2.new(0,0,0,-1)
|
text.Position = UDim2.new(0, 0, 0, -1)
|
||||||
text.Size = UDim2.new(1,0,1,0)
|
text.Size = UDim2.new(1, 0, 1, 0)
|
||||||
text.FontSize = Enum.FontSize.Size14
|
text.FontSize = Enum.FontSize.Size14
|
||||||
text.BackgroundTransparency = 1
|
text.BackgroundTransparency = 1
|
||||||
text.TextColor3 = Color3.new(1,1,1)
|
text.TextColor3 = Color3.new(1, 1, 1)
|
||||||
text.RobloxLocked = true
|
text.RobloxLocked = true
|
||||||
text.Parent = messageDialog
|
text.Parent = messageDialog
|
||||||
end
|
end
|
||||||
|
|
||||||
function showMessage(msg, size)
|
function showMessage(msg, size)
|
||||||
messageDialog.Text.Text = msg
|
messageDialog.Text.Text = msg
|
||||||
messageDialog.Size = UDim2.new(0,size,0,40)
|
messageDialog.Size = UDim2.new(0, size, 0, 40)
|
||||||
messageDialog.Position = UDim2.new(0.5, -size/2, 0.5, -40)
|
messageDialog.Position = UDim2.new(0.5, -size / 2, 0.5, -40)
|
||||||
messageDialog.Visible = true
|
messageDialog.Visible = true
|
||||||
wait(2)
|
wait(2)
|
||||||
messageDialog.Visible = false
|
messageDialog.Visible = false
|
||||||
|
|
@ -162,55 +158,55 @@ end
|
||||||
|
|
||||||
function variableDelay(str)
|
function variableDelay(str)
|
||||||
local length = math.min(string.len(str), 100)
|
local length = math.min(string.len(str), 100)
|
||||||
wait(0.75 + ((length/75) * 1.5))
|
wait(0.75 + ((length / 75) * 1.5))
|
||||||
end
|
end
|
||||||
|
|
||||||
function resetColor(frame, tone)
|
function resetColor(frame, tone)
|
||||||
if tone == Enum.DialogTone.Neutral then
|
if tone == Enum.DialogTone.Neutral then
|
||||||
frame.BackgroundColor3 = Color3.new(0/255, 0/255, 179/255)
|
frame.BackgroundColor3 = Color3.new(0 / 255, 0 / 255, 179 / 255)
|
||||||
frame.Number.TextColor3 = Color3.new(45/255, 142/255, 245/255)
|
frame.Number.TextColor3 = Color3.new(45 / 255, 142 / 255, 245 / 255)
|
||||||
elseif tone == Enum.DialogTone.Friendly then
|
elseif tone == Enum.DialogTone.Friendly then
|
||||||
frame.BackgroundColor3 = Color3.new(0/255, 77/255, 0/255)
|
frame.BackgroundColor3 = Color3.new(0 / 255, 77 / 255, 0 / 255)
|
||||||
frame.Number.TextColor3 = Color3.new(0/255, 190/255, 0/255)
|
frame.Number.TextColor3 = Color3.new(0 / 255, 190 / 255, 0 / 255)
|
||||||
elseif tone == Enum.DialogTone.Enemy then
|
elseif tone == Enum.DialogTone.Enemy then
|
||||||
frame.BackgroundColor3 = Color3.new(140/255, 0/255, 0/255)
|
frame.BackgroundColor3 = Color3.new(140 / 255, 0 / 255, 0 / 255)
|
||||||
frame.Number.TextColor3 = Color3.new(255/255,88/255, 79/255)
|
frame.Number.TextColor3 = Color3.new(255 / 255, 88 / 255, 79 / 255)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function highlightColor(frame, tone)
|
function highlightColor(frame, tone)
|
||||||
if tone == Enum.DialogTone.Neutral then
|
if tone == Enum.DialogTone.Neutral then
|
||||||
frame.BackgroundColor3 = Color3.new(2/255, 108/255, 255/255)
|
frame.BackgroundColor3 = Color3.new(2 / 255, 108 / 255, 255 / 255)
|
||||||
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
||||||
elseif tone == Enum.DialogTone.Friendly then
|
elseif tone == Enum.DialogTone.Friendly then
|
||||||
frame.BackgroundColor3 = Color3.new(0/255, 128/255, 0/255)
|
frame.BackgroundColor3 = Color3.new(0 / 255, 128 / 255, 0 / 255)
|
||||||
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
||||||
elseif tone == Enum.DialogTone.Enemy then
|
elseif tone == Enum.DialogTone.Enemy then
|
||||||
frame.BackgroundColor3 = Color3.new(204/255, 0/255, 0/255)
|
frame.BackgroundColor3 = Color3.new(204 / 255, 0 / 255, 0 / 255)
|
||||||
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function wanderDialog()
|
function wanderDialog()
|
||||||
print("Wander")
|
print "Wander"
|
||||||
mainFrame.Visible = false
|
mainFrame.Visible = false
|
||||||
endDialog()
|
endDialog()
|
||||||
showMessage(characterWanderedOffMessage, characterWanderedOffSize)
|
showMessage(characterWanderedOffMessage, characterWanderedOffSize)
|
||||||
end
|
end
|
||||||
|
|
||||||
function timeoutDialog()
|
function timeoutDialog()
|
||||||
print("Timeout")
|
print "Timeout"
|
||||||
mainFrame.Visible = false
|
mainFrame.Visible = false
|
||||||
endDialog()
|
endDialog()
|
||||||
showMessage(conversationTimedOut, conversationTimedOutSize)
|
showMessage(conversationTimedOut, conversationTimedOutSize)
|
||||||
end
|
end
|
||||||
function normalEndDialog()
|
function normalEndDialog()
|
||||||
print("Done")
|
print "Done"
|
||||||
endDialog()
|
endDialog()
|
||||||
end
|
end
|
||||||
|
|
||||||
function endDialog()
|
function endDialog()
|
||||||
if currentAbortDialogScript then
|
if currentAbortDialogScript then
|
||||||
currentAbortDialogScript:Remove()
|
currentAbortDialogScript:Remove()
|
||||||
currentAbortDialogScript = nil
|
currentAbortDialogScript = nil
|
||||||
end
|
end
|
||||||
|
|
@ -234,11 +230,11 @@ function endDialog()
|
||||||
end
|
end
|
||||||
|
|
||||||
function sanitizeMessage(msg)
|
function sanitizeMessage(msg)
|
||||||
if string.len(msg) == 0 then
|
if string.len(msg) == 0 then
|
||||||
return "..."
|
return "..."
|
||||||
else
|
else
|
||||||
return msg
|
return msg
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function selectChoice(choice)
|
function selectChoice(choice)
|
||||||
|
|
@ -253,10 +249,18 @@ function selectChoice(choice)
|
||||||
else
|
else
|
||||||
local dialogChoice = choiceMap[choice]
|
local dialogChoice = choiceMap[choice]
|
||||||
|
|
||||||
game.Chat:Chat(game.Players.LocalPlayer.Character, sanitizeMessage(dialogChoice.UserDialog), getChatColor(currentTone()))
|
game.Chat:Chat(
|
||||||
|
game.Players.LocalPlayer.Character,
|
||||||
|
sanitizeMessage(dialogChoice.UserDialog),
|
||||||
|
getChatColor(currentTone())
|
||||||
|
)
|
||||||
wait(1)
|
wait(1)
|
||||||
currentConversationDialog:SignalDialogChoiceSelected(player, dialogChoice)
|
currentConversationDialog:SignalDialogChoiceSelected(player, dialogChoice)
|
||||||
game.Chat:Chat(currentConversationPartner, sanitizeMessage(dialogChoice.ResponseDialog), getChatColor(currentTone()))
|
game.Chat:Chat(
|
||||||
|
currentConversationPartner,
|
||||||
|
sanitizeMessage(dialogChoice.ResponseDialog),
|
||||||
|
getChatColor(currentTone())
|
||||||
|
)
|
||||||
|
|
||||||
variableDelay(dialogChoice.ResponseDialog)
|
variableDelay(dialogChoice.ResponseDialog)
|
||||||
presentDialogChoices(currentConversationPartner, dialogChoice:GetChildren())
|
presentDialogChoices(currentConversationPartner, dialogChoice:GetChildren())
|
||||||
|
|
@ -264,77 +268,83 @@ function selectChoice(choice)
|
||||||
end
|
end
|
||||||
|
|
||||||
function newChoice(numberText)
|
function newChoice(numberText)
|
||||||
local frame = Instance.new("TextButton")
|
local frame = Instance.new "TextButton"
|
||||||
frame.BackgroundColor3 = Color3.new(0/255, 0/255, 179/255)
|
frame.BackgroundColor3 = Color3.new(0 / 255, 0 / 255, 179 / 255)
|
||||||
frame.AutoButtonColor = false
|
frame.AutoButtonColor = false
|
||||||
frame.BorderSizePixel = 0
|
frame.BorderSizePixel = 0
|
||||||
frame.Text = ""
|
frame.Text = ""
|
||||||
frame.MouseEnter:connect(function() highlightColor(frame, currentTone()) end)
|
frame.MouseEnter:connect(function()
|
||||||
frame.MouseLeave:connect(function() resetColor(frame, currentTone()) end)
|
highlightColor(frame, currentTone())
|
||||||
frame.MouseButton1Click:connect(function() selectChoice(frame) end)
|
end)
|
||||||
frame.RobloxLocked = true
|
frame.MouseLeave:connect(function()
|
||||||
|
resetColor(frame, currentTone())
|
||||||
|
end)
|
||||||
|
frame.MouseButton1Click:connect(function()
|
||||||
|
selectChoice(frame)
|
||||||
|
end)
|
||||||
|
frame.RobloxLocked = true
|
||||||
|
|
||||||
local number = Instance.new("TextLabel")
|
local number = Instance.new "TextLabel"
|
||||||
number.Name = "Number"
|
number.Name = "Number"
|
||||||
number.TextColor3 = Color3.new(127/255, 212/255, 255/255)
|
number.TextColor3 = Color3.new(127 / 255, 212 / 255, 255 / 255)
|
||||||
number.Text = numberText
|
number.Text = numberText
|
||||||
number.FontSize = Enum.FontSize.Size14
|
number.FontSize = Enum.FontSize.Size14
|
||||||
number.BackgroundTransparency = 1
|
number.BackgroundTransparency = 1
|
||||||
number.Position = UDim2.new(0,4,0,2)
|
number.Position = UDim2.new(0, 4, 0, 2)
|
||||||
number.Size = UDim2.new(0,20,0,24)
|
number.Size = UDim2.new(0, 20, 0, 24)
|
||||||
number.TextXAlignment = Enum.TextXAlignment.Left
|
number.TextXAlignment = Enum.TextXAlignment.Left
|
||||||
number.TextYAlignment = Enum.TextYAlignment.Top
|
number.TextYAlignment = Enum.TextYAlignment.Top
|
||||||
number.RobloxLocked = true
|
number.RobloxLocked = true
|
||||||
number.Parent = frame
|
number.Parent = frame
|
||||||
|
|
||||||
local prompt = Instance.new("TextLabel")
|
local prompt = Instance.new "TextLabel"
|
||||||
prompt.Name = "UserPrompt"
|
prompt.Name = "UserPrompt"
|
||||||
prompt.BackgroundTransparency = 1
|
prompt.BackgroundTransparency = 1
|
||||||
prompt.TextColor3 = Color3.new(1,1,1)
|
prompt.TextColor3 = Color3.new(1, 1, 1)
|
||||||
prompt.FontSize = Enum.FontSize.Size14
|
prompt.FontSize = Enum.FontSize.Size14
|
||||||
prompt.Position = UDim2.new(0,28, 0, 2)
|
prompt.Position = UDim2.new(0, 28, 0, 2)
|
||||||
prompt.Size = UDim2.new(1,-32, 1, -4)
|
prompt.Size = UDim2.new(1, -32, 1, -4)
|
||||||
prompt.TextXAlignment = Enum.TextXAlignment.Left
|
prompt.TextXAlignment = Enum.TextXAlignment.Left
|
||||||
prompt.TextYAlignment = Enum.TextYAlignment.Top
|
prompt.TextYAlignment = Enum.TextYAlignment.Top
|
||||||
prompt.TextWrap = true
|
prompt.TextWrap = true
|
||||||
prompt.RobloxLocked = true
|
prompt.RobloxLocked = true
|
||||||
prompt.Parent = frame
|
prompt.Parent = frame
|
||||||
|
|
||||||
return frame
|
return frame
|
||||||
end
|
end
|
||||||
function initialize(parent)
|
function initialize(parent)
|
||||||
choices[1] = newChoice("1)")
|
choices[1] = newChoice "1)"
|
||||||
choices[2] = newChoice("2)")
|
choices[2] = newChoice "2)"
|
||||||
choices[3] = newChoice("3)")
|
choices[3] = newChoice "3)"
|
||||||
choices[4] = newChoice("4)")
|
choices[4] = newChoice "4)"
|
||||||
|
|
||||||
lastChoice = newChoice("5)")
|
lastChoice = newChoice "5)"
|
||||||
lastChoice.UserPrompt.Text = "Goodbye!"
|
lastChoice.UserPrompt.Text = "Goodbye!"
|
||||||
lastChoice.Size = UDim2.new(1,0,0,28)
|
lastChoice.Size = UDim2.new(1, 0, 0, 28)
|
||||||
|
|
||||||
mainFrame = Instance.new("Frame")
|
mainFrame = Instance.new "Frame"
|
||||||
mainFrame.Name = "UserDialogArea"
|
mainFrame.Name = "UserDialogArea"
|
||||||
mainFrame.Size = UDim2.new(0, 350, 0, 200)
|
mainFrame.Size = UDim2.new(0, 350, 0, 200)
|
||||||
mainFrame.Style = Enum.FrameStyle.ChatBlue
|
mainFrame.Style = Enum.FrameStyle.ChatBlue
|
||||||
mainFrame.Visible = false
|
mainFrame.Visible = false
|
||||||
|
|
||||||
imageLabel = Instance.new("ImageLabel")
|
imageLabel = Instance.new "ImageLabel"
|
||||||
imageLabel.Name = "Tail"
|
imageLabel.Name = "Tail"
|
||||||
imageLabel.Size = UDim2.new(0,62,0,53)
|
imageLabel.Size = UDim2.new(0, 62, 0, 53)
|
||||||
imageLabel.Position = UDim2.new(1,8,0.25)
|
imageLabel.Position = UDim2.new(1, 8, 0.25)
|
||||||
imageLabel.Image = "rbxasset://textures/chatBubble_botBlue_tailRight.png"
|
imageLabel.Image = "rbxasset://textures/chatBubble_botBlue_tailRight.png"
|
||||||
imageLabel.BackgroundTransparency = 1
|
imageLabel.BackgroundTransparency = 1
|
||||||
imageLabel.RobloxLocked = true
|
imageLabel.RobloxLocked = true
|
||||||
imageLabel.Parent = mainFrame
|
imageLabel.Parent = mainFrame
|
||||||
|
|
||||||
for n, obj in pairs(choices) do
|
for n, obj in pairs(choices) do
|
||||||
obj.RobloxLocked = true
|
obj.RobloxLocked = true
|
||||||
obj.Parent = mainFrame
|
obj.Parent = mainFrame
|
||||||
end
|
end
|
||||||
lastChoice.RobloxLocked = true
|
lastChoice.RobloxLocked = true
|
||||||
lastChoice.Parent = mainFrame
|
lastChoice.Parent = mainFrame
|
||||||
|
|
||||||
mainFrame.RobloxLocked = true
|
mainFrame.RobloxLocked = true
|
||||||
mainFrame.Parent = parent
|
mainFrame.Parent = parent
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -346,11 +356,13 @@ function presentDialogChoices(talkingPart, dialogChoices)
|
||||||
currentConversationPartner = talkingPart
|
currentConversationPartner = talkingPart
|
||||||
sortedDialogChoices = {}
|
sortedDialogChoices = {}
|
||||||
for n, obj in pairs(dialogChoices) do
|
for n, obj in pairs(dialogChoices) do
|
||||||
if obj:IsA("DialogChoice") then
|
if obj:IsA "DialogChoice" then
|
||||||
table.insert(sortedDialogChoices, obj)
|
table.insert(sortedDialogChoices, obj)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.sort(sortedDialogChoices, function(a,b) return a.Name < b.Name end)
|
table.sort(sortedDialogChoices, function(a, b)
|
||||||
|
return a.Name < b.Name
|
||||||
|
end)
|
||||||
|
|
||||||
if #sortedDialogChoices == 0 then
|
if #sortedDialogChoices == 0 then
|
||||||
normalEndDialog()
|
normalEndDialog()
|
||||||
|
|
@ -358,7 +370,7 @@ function presentDialogChoices(talkingPart, dialogChoices)
|
||||||
end
|
end
|
||||||
|
|
||||||
local pos = 1
|
local pos = 1
|
||||||
local yPosition = 0
|
local yPosition = 0
|
||||||
choiceMap = {}
|
choiceMap = {}
|
||||||
for n, obj in pairs(choices) do
|
for n, obj in pairs(choices) do
|
||||||
obj.Visible = false
|
obj.Visible = false
|
||||||
|
|
@ -367,9 +379,9 @@ function presentDialogChoices(talkingPart, dialogChoices)
|
||||||
for n, obj in pairs(sortedDialogChoices) do
|
for n, obj in pairs(sortedDialogChoices) do
|
||||||
if pos <= #choices then
|
if pos <= #choices then
|
||||||
--3 lines is the maximum, set it to that temporarily
|
--3 lines is the maximum, set it to that temporarily
|
||||||
choices[pos].Size = UDim2.new(1, 0, 0, 24*3)
|
choices[pos].Size = UDim2.new(1, 0, 0, 24 * 3)
|
||||||
choices[pos].UserPrompt.Text = obj.UserDialog
|
choices[pos].UserPrompt.Text = obj.UserDialog
|
||||||
local height = math.ceil(choices[pos].UserPrompt.TextBounds.Y/24)*24
|
local height = math.ceil(choices[pos].UserPrompt.TextBounds.Y / 24) * 24
|
||||||
|
|
||||||
choices[pos].Position = UDim2.new(0, 0, 0, yPosition)
|
choices[pos].Position = UDim2.new(0, 0, 0, yPosition)
|
||||||
choices[pos].Size = UDim2.new(1, 0, 0, height)
|
choices[pos].Size = UDim2.new(1, 0, 0, height)
|
||||||
|
|
@ -382,11 +394,11 @@ function presentDialogChoices(talkingPart, dialogChoices)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
lastChoice.Position = UDim2.new(0,0,0,yPosition)
|
lastChoice.Position = UDim2.new(0, 0, 0, yPosition)
|
||||||
lastChoice.Number.Text = pos .. ")"
|
lastChoice.Number.Text = pos .. ")"
|
||||||
|
|
||||||
mainFrame.Size = UDim2.new(0, 350, 0, yPosition+24+32)
|
mainFrame.Size = UDim2.new(0, 350, 0, yPosition + 24 + 32)
|
||||||
mainFrame.Position = UDim2.new(0,20,0.0, -mainFrame.Size.Y.Offset-20)
|
mainFrame.Position = UDim2.new(0, 20, 0, -mainFrame.Size.Y.Offset - 20)
|
||||||
styleMainFrame(currentTone())
|
styleMainFrame(currentTone())
|
||||||
mainFrame.Visible = true
|
mainFrame.Visible = true
|
||||||
end
|
end
|
||||||
|
|
@ -425,7 +437,13 @@ end
|
||||||
|
|
||||||
function checkForLeaveArea()
|
function checkForLeaveArea()
|
||||||
while currentConversationDialog do
|
while currentConversationDialog do
|
||||||
if currentConversationDialog.Parent and (player:DistanceFromCharacter(currentConversationDialog.Parent.Position) >= currentConversationDialog.ConversationDistance) then
|
if
|
||||||
|
currentConversationDialog.Parent
|
||||||
|
and (
|
||||||
|
player:DistanceFromCharacter(currentConversationDialog.Parent.Position)
|
||||||
|
>= currentConversationDialog.ConversationDistance
|
||||||
|
)
|
||||||
|
then
|
||||||
wanderDialog()
|
wanderDialog()
|
||||||
end
|
end
|
||||||
wait(1)
|
wait(1)
|
||||||
|
|
@ -433,7 +451,7 @@ function checkForLeaveArea()
|
||||||
end
|
end
|
||||||
|
|
||||||
function startDialog(dialog)
|
function startDialog(dialog)
|
||||||
if dialog.Parent and dialog.Parent:IsA("BasePart") then
|
if dialog.Parent and dialog.Parent:IsA "BasePart" then
|
||||||
if player:DistanceFromCharacter(dialog.Parent.Position) >= dialog.ConversationDistance then
|
if player:DistanceFromCharacter(dialog.Parent.Position) >= dialog.ConversationDistance then
|
||||||
showMessage(tooFarAwayMessage, tooFarAwaySize)
|
showMessage(tooFarAwayMessage, tooFarAwaySize)
|
||||||
return
|
return
|
||||||
|
|
@ -453,10 +471,10 @@ function startDialog(dialog)
|
||||||
end
|
end
|
||||||
|
|
||||||
function removeDialog(dialog)
|
function removeDialog(dialog)
|
||||||
if dialogMap[dialog] then
|
if dialogMap[dialog] then
|
||||||
dialogMap[dialog]:Remove()
|
dialogMap[dialog]:Remove()
|
||||||
dialogMap[dialog] = nil
|
dialogMap[dialog] = nil
|
||||||
end
|
end
|
||||||
if dialogConnections[dialog] then
|
if dialogConnections[dialog] then
|
||||||
dialogConnections[dialog]:disconnect()
|
dialogConnections[dialog]:disconnect()
|
||||||
dialogConnections[dialog] = nil
|
dialogConnections[dialog] = nil
|
||||||
|
|
@ -465,13 +483,15 @@ end
|
||||||
|
|
||||||
function addDialog(dialog)
|
function addDialog(dialog)
|
||||||
if dialog.Parent then
|
if dialog.Parent then
|
||||||
if dialog.Parent:IsA("BasePart") then
|
if dialog.Parent:IsA "BasePart" then
|
||||||
local chatGui = chatNotificationGui:clone()
|
local chatGui = chatNotificationGui:clone()
|
||||||
chatGui.Enabled = not dialog.InUse
|
chatGui.Enabled = not dialog.InUse
|
||||||
chatGui.Adornee = dialog.Parent
|
chatGui.Adornee = dialog.Parent
|
||||||
chatGui.RobloxLocked = true
|
chatGui.RobloxLocked = true
|
||||||
chatGui.Parent = game.CoreGui
|
chatGui.Parent = game.CoreGui
|
||||||
chatGui.Image.Button.MouseButton1Click:connect(function() startDialog(dialog) end)
|
chatGui.Image.Button.MouseButton1Click:connect(function()
|
||||||
|
startDialog(dialog)
|
||||||
|
end)
|
||||||
setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone)
|
setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone)
|
||||||
|
|
||||||
dialogMap[dialog] = chatGui
|
dialogMap[dialog] = chatGui
|
||||||
|
|
@ -504,7 +524,7 @@ end
|
||||||
|
|
||||||
function fetchScripts()
|
function fetchScripts()
|
||||||
local model = game:GetService("InsertService"):LoadAsset(39226062)
|
local model = game:GetService("InsertService"):LoadAsset(39226062)
|
||||||
if type(model) == "string" then -- load failed, lets try again
|
if type(model) == "string" then -- load failed, lets try again
|
||||||
wait(0.1)
|
wait(0.1)
|
||||||
model = game:GetService("InsertService"):LoadAsset(39226062)
|
model = game:GetService("InsertService"):LoadAsset(39226062)
|
||||||
end
|
end
|
||||||
|
|
@ -512,49 +532,57 @@ function fetchScripts()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
waitForChild(model,"TimeoutScript")
|
waitForChild(model, "TimeoutScript")
|
||||||
timeoutScript = model.TimeoutScript
|
timeoutScript = model.TimeoutScript
|
||||||
waitForChild(model,"ReenableDialogScript")
|
waitForChild(model, "ReenableDialogScript")
|
||||||
reenableDialogScript = model.ReenableDialogScript
|
reenableDialogScript = model.ReenableDialogScript
|
||||||
end
|
end
|
||||||
|
|
||||||
function onLoad()
|
function onLoad()
|
||||||
waitForProperty(game.Players, "LocalPlayer")
|
waitForProperty(game.Players, "LocalPlayer")
|
||||||
player = game.Players.LocalPlayer
|
player = game.Players.LocalPlayer
|
||||||
waitForProperty(player, "Character")
|
waitForProperty(player, "Character")
|
||||||
|
|
||||||
--print("Fetching Scripts")
|
--print("Fetching Scripts")
|
||||||
fetchScripts()
|
fetchScripts()
|
||||||
|
|
||||||
--print("Creating Guis")
|
--print("Creating Guis")
|
||||||
createChatNotificationGui()
|
createChatNotificationGui()
|
||||||
|
|
||||||
--print("Creating MessageDialog")
|
--print("Creating MessageDialog")
|
||||||
createMessageDialog()
|
createMessageDialog()
|
||||||
messageDialog.RobloxLocked = true
|
messageDialog.RobloxLocked = true
|
||||||
messageDialog.Parent = gui
|
messageDialog.Parent = gui
|
||||||
|
|
||||||
--print("Waiting for BottomLeftControl")
|
--print("Waiting for BottomLeftControl")
|
||||||
waitForChild(gui, "BottomLeftControl")
|
waitForChild(gui, "BottomLeftControl")
|
||||||
|
|
||||||
--print("Initializing Frame")
|
--print("Initializing Frame")
|
||||||
local frame = Instance.new("Frame")
|
local frame = Instance.new "Frame"
|
||||||
frame.Name = "DialogFrame"
|
frame.Name = "DialogFrame"
|
||||||
frame.Position = UDim2.new(0,0,0,0)
|
frame.Position = UDim2.new(0, 0, 0, 0)
|
||||||
frame.Size = UDim2.new(0,0,0,0)
|
frame.Size = UDim2.new(0, 0, 0, 0)
|
||||||
frame.BackgroundTransparency = 1
|
frame.BackgroundTransparency = 1
|
||||||
frame.RobloxLocked = true
|
frame.RobloxLocked = true
|
||||||
frame.Parent = gui.BottomLeftControl
|
frame.Parent = gui.BottomLeftControl
|
||||||
initialize(frame)
|
initialize(frame)
|
||||||
|
|
||||||
--print("Adding Dialogs")
|
--print("Adding Dialogs")
|
||||||
game.CollectionService.ItemAdded:connect(function(obj) if obj:IsA("Dialog") then addDialog(obj) end end)
|
game.CollectionService.ItemAdded:connect(function(obj)
|
||||||
game.CollectionService.ItemRemoved:connect(function(obj) if obj:IsA("Dialog") then removeDialog(obj) end end)
|
if obj:IsA "Dialog" then
|
||||||
for i, obj in pairs(game.CollectionService:GetCollection("Dialog")) do
|
addDialog(obj)
|
||||||
if obj:IsA("Dialog") then
|
end
|
||||||
addDialog(obj)
|
end)
|
||||||
end
|
game.CollectionService.ItemRemoved:connect(function(obj)
|
||||||
end
|
if obj:IsA "Dialog" then
|
||||||
|
removeDialog(obj)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
for _, obj in pairs(game.CollectionService:GetCollection "Dialog") do
|
||||||
|
if obj:IsA "Dialog" then
|
||||||
|
addDialog(obj)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
onLoad()
|
onLoad()
|
||||||
2293
45284430.lua
2293
45284430.lua
File diff suppressed because it is too large
Load Diff
29
45374389.lua
29
45374389.lua
|
|
@ -1,23 +1,20 @@
|
||||||
local t = {}
|
local t = {}
|
||||||
|
|
||||||
t.Foo =
|
t.Foo = function()
|
||||||
function()
|
print "foo"
|
||||||
print("foo")
|
end
|
||||||
end
|
|
||||||
|
|
||||||
t.Bar =
|
t.Bar = function()
|
||||||
function()
|
print "bar"
|
||||||
print("bar")
|
end
|
||||||
end
|
|
||||||
|
|
||||||
t.Help =
|
t.Help = function(funcNameOrFunc)
|
||||||
function(funcNameOrFunc)
|
--input argument can be a string or a function. Should return a description (of arguments and expected side effects)
|
||||||
--input argument can be a string or a function. Should return a description (of arguments and expected side effects)
|
if funcNameOrFunc == "Foo" or funcNameOrFunc == t.Foo then
|
||||||
if funcNameOrFunc == "Foo" or funcNameOrFunc == t.Foo then
|
return "Function Foo. Arguments: None. Side effect: prints foo"
|
||||||
return "Function Foo. Arguments: None. Side effect: prints foo"
|
elseif funcNameOrFunc == "Bar" or funcNameOrFunc == t.Bar then
|
||||||
elseif funcNameOrFunc == "Bar" or funcNameOrFunc == t.Bar then
|
return "Function Bar. Arguments: None. Side effect: prints bar"
|
||||||
return "Function Bar. Arguments: None. Side effect: prints bar"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return t
|
return t
|
||||||
2234
46295863.lua
2234
46295863.lua
File diff suppressed because it is too large
Load Diff
2717
48488235.lua
2717
48488235.lua
File diff suppressed because it is too large
Load Diff
297
48488398.lua
297
48488398.lua
|
|
@ -9,101 +9,134 @@ function waitForChild(instance, name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
waitForProperty(game.Players,"LocalPlayer")
|
waitForProperty(game.Players, "LocalPlayer")
|
||||||
waitForChild(script.Parent,"Popup")
|
waitForChild(script.Parent, "Popup")
|
||||||
waitForChild(script.Parent.Popup,"AcceptButton")
|
waitForChild(script.Parent.Popup, "AcceptButton")
|
||||||
script.Parent.Popup.AcceptButton.Modal = true
|
script.Parent.Popup.AcceptButton.Modal = true
|
||||||
|
|
||||||
local localPlayer = game.Players.LocalPlayer
|
local localPlayer = game.Players.LocalPlayer
|
||||||
local teleportUI = nil
|
local teleportUI = nil
|
||||||
|
|
||||||
local acceptedTeleport = Instance.new("IntValue")
|
|
||||||
|
|
||||||
local friendRequestBlacklist = {}
|
local friendRequestBlacklist = {}
|
||||||
|
|
||||||
local teleportEnabled = true
|
local teleportEnabled = true
|
||||||
|
|
||||||
local makePopupInvisible = function()
|
local makePopupInvisible = function()
|
||||||
if script.Parent.Popup then script.Parent.Popup.Visible = false end
|
if script.Parent.Popup then
|
||||||
|
script.Parent.Popup.Visible = false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function makeFriend(fromPlayer,toPlayer)
|
function makeFriend(fromPlayer, toPlayer)
|
||||||
|
local popup = script.Parent:FindFirstChild "Popup"
|
||||||
local popup = script.Parent:FindFirstChild("Popup")
|
if popup == nil then
|
||||||
if popup == nil then return end -- there is no popup!
|
return
|
||||||
if popup.Visible then return end -- currently popping something, abort!
|
end -- there is no popup!
|
||||||
if friendRequestBlacklist[fromPlayer] then return end -- previously cancelled friend request, we don't want it!
|
if popup.Visible then
|
||||||
|
return
|
||||||
|
end -- currently popping something, abort!
|
||||||
|
if friendRequestBlacklist[fromPlayer] then
|
||||||
|
return
|
||||||
|
end -- previously cancelled friend request, we don't want it!
|
||||||
|
|
||||||
popup.PopupText.Text = "Accept Friend Request from " .. tostring(fromPlayer.Name) .. "?"
|
popup.PopupText.Text = "Accept Friend Request from " .. tostring(fromPlayer.Name) .. "?"
|
||||||
popup.PopupImage.Image = "http://www.roblox.com/thumbs/avatar.ashx?userId="..tostring(fromPlayer.userId).."&x=352&y=352"
|
popup.PopupImage.Image = "http://www.roblox.com/thumbs/avatar.ashx?userId="
|
||||||
|
.. tostring(fromPlayer.userId)
|
||||||
|
.. "&x=352&y=352"
|
||||||
|
|
||||||
showTwoButtons()
|
showTwoButtons()
|
||||||
popup.Visible = true
|
popup.Visible = true
|
||||||
popup.AcceptButton.Text = "Accept"
|
popup.AcceptButton.Text = "Accept"
|
||||||
popup.DeclineButton.Text = "Decline"
|
popup.DeclineButton.Text = "Decline"
|
||||||
popup:TweenSize(UDim2.new(0,330,0,350),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true)
|
popup:TweenSize(UDim2.new(0, 330, 0, 350), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true)
|
||||||
|
|
||||||
local yesCon, noCon
|
local yesCon, noCon
|
||||||
|
|
||||||
yesCon = popup.AcceptButton.MouseButton1Click:connect(function()
|
yesCon = popup.AcceptButton.MouseButton1Click:connect(function()
|
||||||
popup.Visible = false
|
popup.Visible = false
|
||||||
toPlayer:RequestFriendship(fromPlayer)
|
toPlayer:RequestFriendship(fromPlayer)
|
||||||
if yesCon then yesCon:disconnect() end
|
if yesCon then
|
||||||
if noCon then noCon:disconnect() end
|
yesCon:disconnect()
|
||||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
end
|
||||||
|
if noCon then
|
||||||
|
noCon:disconnect()
|
||||||
|
end
|
||||||
|
popup:TweenSize(
|
||||||
|
UDim2.new(0, 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quart,
|
||||||
|
1,
|
||||||
|
true,
|
||||||
|
makePopupInvisible()
|
||||||
|
)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
noCon = popup.DeclineButton.MouseButton1Click:connect(function()
|
noCon = popup.DeclineButton.MouseButton1Click:connect(function()
|
||||||
popup.Visible = false
|
popup.Visible = false
|
||||||
toPlayer:RevokeFriendship(fromPlayer)
|
toPlayer:RevokeFriendship(fromPlayer)
|
||||||
friendRequestBlacklist[fromPlayer] = true
|
friendRequestBlacklist[fromPlayer] = true
|
||||||
print("pop up blacklist")
|
print "pop up blacklist"
|
||||||
if yesCon then yesCon:disconnect() end
|
if yesCon then
|
||||||
if noCon then noCon:disconnect() end
|
yesCon:disconnect()
|
||||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
end
|
||||||
|
if noCon then
|
||||||
|
noCon:disconnect()
|
||||||
|
end
|
||||||
|
popup:TweenSize(
|
||||||
|
UDim2.new(0, 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quart,
|
||||||
|
1,
|
||||||
|
true,
|
||||||
|
makePopupInvisible()
|
||||||
|
)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
game.Players.FriendRequestEvent:connect(function(fromPlayer, toPlayer, event)
|
||||||
game.Players.FriendRequestEvent:connect(function(fromPlayer,toPlayer,event)
|
|
||||||
|
|
||||||
-- if this doesn't involve me, then do nothing
|
-- if this doesn't involve me, then do nothing
|
||||||
if fromPlayer ~= localPlayer and toPlayer ~= localPlayer then return end
|
if fromPlayer ~= localPlayer and toPlayer ~= localPlayer then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if fromPlayer == localPlayer then
|
if fromPlayer == localPlayer then
|
||||||
if event == Enum.FriendRequestEvent.Accept then
|
if event == Enum.FriendRequestEvent.Accept then
|
||||||
game:GetService("GuiService"):SendNotification("You are Friends",
|
game:GetService("GuiService"):SendNotification(
|
||||||
"With " .. toPlayer.Name .. "!",
|
"You are Friends",
|
||||||
"http://www.roblox.com/thumbs/avatar.ashx?userId="..tostring(toPlayer.userId).."&x=48&y=48",
|
"With " .. toPlayer.Name .. "!",
|
||||||
5,
|
"http://www.roblox.com/thumbs/avatar.ashx?userId=" .. tostring(toPlayer.userId) .. "&x=48&y=48",
|
||||||
function()
|
5,
|
||||||
|
function() end
|
||||||
end)
|
)
|
||||||
end
|
end
|
||||||
elseif toPlayer == localPlayer then
|
elseif toPlayer == localPlayer then
|
||||||
if event == Enum.FriendRequestEvent.Issue then
|
if event == Enum.FriendRequestEvent.Issue then
|
||||||
if friendRequestBlacklist[fromPlayer] then return end -- previously cancelled friend request, we don't want it!
|
if friendRequestBlacklist[fromPlayer] then
|
||||||
game:GetService("GuiService"):SendNotification("Friend Request",
|
return
|
||||||
|
end -- previously cancelled friend request, we don't want it!
|
||||||
|
game:GetService("GuiService"):SendNotification(
|
||||||
|
"Friend Request",
|
||||||
"From " .. fromPlayer.Name,
|
"From " .. fromPlayer.Name,
|
||||||
"http://www.roblox.com/thumbs/avatar.ashx?userId="..tostring(fromPlayer.userId).."&x=48&y=48",
|
"http://www.roblox.com/thumbs/avatar.ashx?userId=" .. tostring(fromPlayer.userId) .. "&x=48&y=48",
|
||||||
8,
|
8,
|
||||||
function()
|
function()
|
||||||
makeFriend(fromPlayer,toPlayer)
|
makeFriend(fromPlayer, toPlayer)
|
||||||
end)
|
end
|
||||||
|
)
|
||||||
elseif event == Enum.FriendRequestEvent.Accept then
|
elseif event == Enum.FriendRequestEvent.Accept then
|
||||||
game:GetService("GuiService"):SendNotification("You are Friends",
|
game:GetService("GuiService"):SendNotification(
|
||||||
"With " .. fromPlayer.Name .. "!",
|
"You are Friends",
|
||||||
"http://www.roblox.com/thumbs/avatar.ashx?userId="..tostring(fromPlayer.userId).."&x=48&y=48",
|
"With " .. fromPlayer.Name .. "!",
|
||||||
5,
|
"http://www.roblox.com/thumbs/avatar.ashx?userId=" .. tostring(fromPlayer.userId) .. "&x=48&y=48",
|
||||||
function()
|
5,
|
||||||
|
function() end
|
||||||
end)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function showOneButton()
|
function showOneButton()
|
||||||
local popup = script.Parent:FindFirstChild("Popup")
|
local popup = script.Parent:FindFirstChild "Popup"
|
||||||
if popup then
|
if popup then
|
||||||
popup.OKButton.Visible = true
|
popup.OKButton.Visible = true
|
||||||
popup.DeclineButton.Visible = false
|
popup.DeclineButton.Visible = false
|
||||||
|
|
@ -112,7 +145,7 @@ function showOneButton()
|
||||||
end
|
end
|
||||||
|
|
||||||
function showTwoButtons()
|
function showTwoButtons()
|
||||||
local popup = script.Parent:FindFirstChild("Popup")
|
local popup = script.Parent:FindFirstChild "Popup"
|
||||||
if popup then
|
if popup then
|
||||||
popup.OKButton.Visible = false
|
popup.OKButton.Visible = false
|
||||||
popup.DeclineButton.Visible = true
|
popup.DeclineButton.Visible = true
|
||||||
|
|
@ -120,7 +153,7 @@ function showTwoButtons()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function onTeleport(teleportState, placeId, spawnName)
|
function onTeleport(teleportState, _, _)
|
||||||
if game:GetService("TeleportService").CustomizedTeleportUI == false then
|
if game:GetService("TeleportService").CustomizedTeleportUI == false then
|
||||||
if teleportState == Enum.TeleportState.Started then
|
if teleportState == Enum.TeleportState.Started then
|
||||||
showTeleportUI("Teleport started...", 0)
|
showTeleportUI("Teleport started...", 0)
|
||||||
|
|
@ -139,8 +172,9 @@ function showTeleportUI(message, timer)
|
||||||
teleportUI:Remove()
|
teleportUI:Remove()
|
||||||
end
|
end
|
||||||
waitForChild(localPlayer, "PlayerGui")
|
waitForChild(localPlayer, "PlayerGui")
|
||||||
teleportUI = Instance.new("Message", localPlayer.PlayerGui)
|
teleportUI = Instance.new "Message"
|
||||||
teleportUI.Text = message
|
teleportUI.Text = message
|
||||||
|
teleportUI.Parent = localPlayer.PlayerGui
|
||||||
if timer > 0 then
|
if timer > 0 then
|
||||||
wait(timer)
|
wait(timer)
|
||||||
teleportUI:Remove()
|
teleportUI:Remove()
|
||||||
|
|
@ -148,100 +182,173 @@ function showTeleportUI(message, timer)
|
||||||
end
|
end
|
||||||
|
|
||||||
if teleportEnabled then
|
if teleportEnabled then
|
||||||
|
|
||||||
localPlayer.OnTeleport:connect(onTeleport)
|
localPlayer.OnTeleport:connect(onTeleport)
|
||||||
|
|
||||||
game:GetService("TeleportService").ErrorCallback = function(message)
|
game:GetService("TeleportService").ErrorCallback = function(message)
|
||||||
local popup = script.Parent:FindFirstChild("Popup")
|
local popup = script.Parent:FindFirstChild "Popup"
|
||||||
showOneButton()
|
showOneButton()
|
||||||
popup.PopupText.Text = message
|
popup.PopupText.Text = message
|
||||||
local clickCon
|
local clickCon
|
||||||
clickCon = popup.OKButton.MouseButton1Click:connect(function()
|
clickCon = popup.OKButton.MouseButton1Click:connect(function()
|
||||||
game:GetService("TeleportService"):TeleportCancel()
|
game:GetService("TeleportService"):TeleportCancel()
|
||||||
if clickCon then clickCon:disconnect() end
|
if clickCon then
|
||||||
game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild("Popup"))
|
clickCon:disconnect()
|
||||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
end
|
||||||
|
game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild "Popup")
|
||||||
|
popup:TweenSize(
|
||||||
|
UDim2.new(0, 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quart,
|
||||||
|
1,
|
||||||
|
true,
|
||||||
|
makePopupInvisible()
|
||||||
|
)
|
||||||
end)
|
end)
|
||||||
game.GuiService:AddCenterDialog(script.Parent:FindFirstChild("Popup"), Enum.CenterDialogType.QuitDialog,
|
game.GuiService:AddCenterDialog(
|
||||||
|
script.Parent:FindFirstChild "Popup",
|
||||||
|
Enum.CenterDialogType.QuitDialog,
|
||||||
--ShowFunction
|
--ShowFunction
|
||||||
function()
|
function()
|
||||||
showOneButton()
|
showOneButton()
|
||||||
script.Parent:FindFirstChild("Popup").Visible = true
|
script.Parent:FindFirstChild("Popup").Visible = true
|
||||||
popup:TweenSize(UDim2.new(0,330,0,350),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true)
|
popup:TweenSize(UDim2.new(0, 330, 0, 350), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true)
|
||||||
end,
|
end,
|
||||||
--HideFunction
|
--HideFunction
|
||||||
function()
|
function()
|
||||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
popup:TweenSize(
|
||||||
end)
|
UDim2.new(0, 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quart,
|
||||||
|
1,
|
||||||
|
true,
|
||||||
|
makePopupInvisible()
|
||||||
|
)
|
||||||
|
end
|
||||||
|
)
|
||||||
end
|
end
|
||||||
game:GetService("TeleportService").ConfirmationCallback = function(message, placeId, spawnName)
|
game:GetService("TeleportService").ConfirmationCallback = function(message, placeId, spawnName)
|
||||||
local popup = script.Parent:FindFirstChild("Popup")
|
local popup = script.Parent:FindFirstChild "Popup"
|
||||||
popup.PopupText.Text = message
|
popup.PopupText.Text = message
|
||||||
popup.PopupImage.Image = ""
|
popup.PopupImage.Image = ""
|
||||||
|
|
||||||
local yesCon, noCon
|
local yesCon, noCon
|
||||||
|
|
||||||
local function killCons()
|
local function killCons()
|
||||||
if yesCon then yesCon:disconnect() end
|
if yesCon then
|
||||||
if noCon then noCon:disconnect() end
|
yesCon:disconnect()
|
||||||
game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild("Popup"))
|
end
|
||||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
if noCon then
|
||||||
|
noCon:disconnect()
|
||||||
|
end
|
||||||
|
game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild "Popup")
|
||||||
|
popup:TweenSize(
|
||||||
|
UDim2.new(0, 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quart,
|
||||||
|
1,
|
||||||
|
true,
|
||||||
|
makePopupInvisible()
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
yesCon = popup.AcceptButton.MouseButton1Click:connect(function()
|
yesCon = popup.AcceptButton.MouseButton1Click:connect(function()
|
||||||
killCons()
|
killCons()
|
||||||
local success, err = pcall(function() game:GetService("TeleportService"):TeleportImpl(placeId,spawnName) end)
|
local success, err = pcall(function()
|
||||||
|
game:GetService("TeleportService"):TeleportImpl(placeId, spawnName)
|
||||||
|
end)
|
||||||
if not success then
|
if not success then
|
||||||
showOneButton()
|
showOneButton()
|
||||||
popup.PopupText.Text = err
|
popup.PopupText.Text = err
|
||||||
local clickCon
|
local clickCon
|
||||||
clickCon = popup.OKButton.MouseButton1Click:connect(function()
|
clickCon = popup.OKButton.MouseButton1Click:connect(function()
|
||||||
if clickCon then clickCon:disconnect() end
|
if clickCon then
|
||||||
game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild("Popup"))
|
clickCon:disconnect()
|
||||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
end
|
||||||
|
game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild "Popup")
|
||||||
|
popup:TweenSize(
|
||||||
|
UDim2.new(0, 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quart,
|
||||||
|
1,
|
||||||
|
true,
|
||||||
|
makePopupInvisible()
|
||||||
|
)
|
||||||
end)
|
end)
|
||||||
game.GuiService:AddCenterDialog(script.Parent:FindFirstChild("Popup"), Enum.CenterDialogType.QuitDialog,
|
game.GuiService:AddCenterDialog(
|
||||||
--ShowFunction
|
script.Parent:FindFirstChild "Popup",
|
||||||
function()
|
Enum.CenterDialogType.QuitDialog,
|
||||||
showOneButton()
|
--ShowFunction
|
||||||
script.Parent:FindFirstChild("Popup").Visible = true
|
function()
|
||||||
popup:TweenSize(UDim2.new(0,330,0,350),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true)
|
showOneButton()
|
||||||
end,
|
script.Parent:FindFirstChild("Popup").Visible = true
|
||||||
--HideFunction
|
popup:TweenSize(
|
||||||
function()
|
UDim2.new(0, 330, 0, 350),
|
||||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
Enum.EasingDirection.Out,
|
||||||
end)
|
Enum.EasingStyle.Quart,
|
||||||
|
1,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
--HideFunction
|
||||||
|
function()
|
||||||
|
popup:TweenSize(
|
||||||
|
UDim2.new(0, 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quart,
|
||||||
|
1,
|
||||||
|
true,
|
||||||
|
makePopupInvisible()
|
||||||
|
)
|
||||||
|
end
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
noCon = popup.DeclineButton.MouseButton1Click:connect(function()
|
noCon = popup.DeclineButton.MouseButton1Click:connect(function()
|
||||||
killCons()
|
killCons()
|
||||||
local success = pcall(function() game:GetService("TeleportService"):TeleportCancel() end)
|
pcall(function()
|
||||||
|
game:GetService("TeleportService"):TeleportCancel()
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local centerDialogSuccess = pcall(function() game.GuiService:AddCenterDialog(script.Parent:FindFirstChild("Popup"), Enum.CenterDialogType.QuitDialog,
|
local centerDialogSuccess = pcall(function()
|
||||||
--ShowFunction
|
game.GuiService:AddCenterDialog(
|
||||||
function()
|
script.Parent:FindFirstChild "Popup",
|
||||||
showTwoButtons()
|
Enum.CenterDialogType.QuitDialog,
|
||||||
popup.AcceptButton.Text = "Leave"
|
--ShowFunction
|
||||||
popup.DeclineButton.Text = "Stay"
|
function()
|
||||||
script.Parent:FindFirstChild("Popup").Visible = true
|
showTwoButtons()
|
||||||
popup:TweenSize(UDim2.new(0,330,0,350),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true)
|
popup.AcceptButton.Text = "Leave"
|
||||||
end,
|
popup.DeclineButton.Text = "Stay"
|
||||||
--HideFunction
|
script.Parent:FindFirstChild("Popup").Visible = true
|
||||||
function()
|
popup:TweenSize(
|
||||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
UDim2.new(0, 330, 0, 350),
|
||||||
end)
|
Enum.EasingDirection.Out,
|
||||||
end)
|
Enum.EasingStyle.Quart,
|
||||||
|
1,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
--HideFunction
|
||||||
|
function()
|
||||||
|
popup:TweenSize(
|
||||||
|
UDim2.new(0, 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quart,
|
||||||
|
1,
|
||||||
|
true,
|
||||||
|
makePopupInvisible()
|
||||||
|
)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end)
|
||||||
|
|
||||||
if centerDialogSuccess == false then
|
if centerDialogSuccess == false then
|
||||||
script.Parent:FindFirstChild("Popup").Visible = true
|
script.Parent:FindFirstChild("Popup").Visible = true
|
||||||
popup.AcceptButton.Text = "Leave"
|
popup.AcceptButton.Text = "Leave"
|
||||||
popup.DeclineButton.Text = "Stay"
|
popup.DeclineButton.Text = "Stay"
|
||||||
popup:TweenSize(UDim2.new(0,330,0,350),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true)
|
popup:TweenSize(UDim2.new(0, 330, 0, 350), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true)
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
38
48488451.lua
38
48488451.lua
|
|
@ -1,8 +1,8 @@
|
||||||
--build our gui
|
--build our gui
|
||||||
|
|
||||||
local popupFrame = Instance.new("Frame")
|
local popupFrame = Instance.new "Frame"
|
||||||
popupFrame.Position = UDim2.new(0.5,-165,0.5,-175)
|
popupFrame.Position = UDim2.new(0.5, -165, 0.5, -175)
|
||||||
popupFrame.Size = UDim2.new(0,330,0,350)
|
popupFrame.Size = UDim2.new(0, 330, 0, 350)
|
||||||
popupFrame.Style = Enum.FrameStyle.RobloxRound
|
popupFrame.Style = Enum.FrameStyle.RobloxRound
|
||||||
popupFrame.ZIndex = 4
|
popupFrame.ZIndex = 4
|
||||||
popupFrame.Name = "Popup"
|
popupFrame.Name = "Popup"
|
||||||
|
|
@ -10,26 +10,26 @@ popupFrame.Visible = false
|
||||||
popupFrame.Parent = script.Parent
|
popupFrame.Parent = script.Parent
|
||||||
|
|
||||||
local darken = popupFrame:clone()
|
local darken = popupFrame:clone()
|
||||||
darken.Size = UDim2.new(1,16,1,16)
|
darken.Size = UDim2.new(1, 16, 1, 16)
|
||||||
darken.Position = UDim2.new(0,-8,0,-8)
|
darken.Position = UDim2.new(0, -8, 0, -8)
|
||||||
darken.Name = "Darken"
|
darken.Name = "Darken"
|
||||||
darken.ZIndex = 1
|
darken.ZIndex = 1
|
||||||
darken.Parent = popupFrame
|
darken.Parent = popupFrame
|
||||||
|
|
||||||
local acceptButton = Instance.new("TextButton")
|
local acceptButton = Instance.new "TextButton"
|
||||||
acceptButton.Position = UDim2.new(0,20,0,270)
|
acceptButton.Position = UDim2.new(0, 20, 0, 270)
|
||||||
acceptButton.Size = UDim2.new(0,100,0,50)
|
acceptButton.Size = UDim2.new(0, 100, 0, 50)
|
||||||
acceptButton.Font = Enum.Font.ArialBold
|
acceptButton.Font = Enum.Font.ArialBold
|
||||||
acceptButton.FontSize = Enum.FontSize.Size24
|
acceptButton.FontSize = Enum.FontSize.Size24
|
||||||
acceptButton.Style = Enum.ButtonStyle.RobloxButton
|
acceptButton.Style = Enum.ButtonStyle.RobloxButton
|
||||||
acceptButton.TextColor3 = Color3.new(248/255,248/255,248/255)
|
acceptButton.TextColor3 = Color3.new(248 / 255, 248 / 255, 248 / 255)
|
||||||
acceptButton.Text = "Yes"
|
acceptButton.Text = "Yes"
|
||||||
acceptButton.ZIndex = 5
|
acceptButton.ZIndex = 5
|
||||||
acceptButton.Name = "AcceptButton"
|
acceptButton.Name = "AcceptButton"
|
||||||
acceptButton.Parent = popupFrame
|
acceptButton.Parent = popupFrame
|
||||||
|
|
||||||
local declineButton = acceptButton:clone()
|
local declineButton = acceptButton:clone()
|
||||||
declineButton.Position = UDim2.new(1,-120,0,270)
|
declineButton.Position = UDim2.new(1, -120, 0, 270)
|
||||||
declineButton.Text = "No"
|
declineButton.Text = "No"
|
||||||
declineButton.Name = "DeclineButton"
|
declineButton.Name = "DeclineButton"
|
||||||
declineButton.Parent = popupFrame
|
declineButton.Parent = popupFrame
|
||||||
|
|
@ -37,34 +37,34 @@ declineButton.Parent = popupFrame
|
||||||
local okButton = acceptButton:clone()
|
local okButton = acceptButton:clone()
|
||||||
okButton.Name = "OKButton"
|
okButton.Name = "OKButton"
|
||||||
okButton.Text = "OK"
|
okButton.Text = "OK"
|
||||||
okButton.Position = UDim2.new(0.5,-50,0,270)
|
okButton.Position = UDim2.new(0.5, -50, 0, 270)
|
||||||
okButton.Visible = false
|
okButton.Visible = false
|
||||||
okButton.Parent = popupFrame
|
okButton.Parent = popupFrame
|
||||||
|
|
||||||
local popupImage = Instance.new("ImageLabel")
|
local popupImage = Instance.new "ImageLabel"
|
||||||
popupImage.BackgroundTransparency = 1
|
popupImage.BackgroundTransparency = 1
|
||||||
popupImage.Position = UDim2.new(0.5,-140,0,0)
|
popupImage.Position = UDim2.new(0.5, -140, 0, 0)
|
||||||
popupImage.Size = UDim2.new(0,280,0,280)
|
popupImage.Size = UDim2.new(0, 280, 0, 280)
|
||||||
popupImage.ZIndex = 3
|
popupImage.ZIndex = 3
|
||||||
popupImage.Name = "PopupImage"
|
popupImage.Name = "PopupImage"
|
||||||
popupImage.Parent = popupFrame
|
popupImage.Parent = popupFrame
|
||||||
|
|
||||||
local backing = Instance.new("ImageLabel")
|
local backing = Instance.new "ImageLabel"
|
||||||
backing.BackgroundTransparency = 1
|
backing.BackgroundTransparency = 1
|
||||||
backing.Size = UDim2.new(1,0,1,0)
|
backing.Size = UDim2.new(1, 0, 1, 0)
|
||||||
backing.Image = "http://www.roblox.com/asset/?id=47574181"
|
backing.Image = "http://www.roblox.com/asset/?id=47574181"
|
||||||
backing.Name = "Backing"
|
backing.Name = "Backing"
|
||||||
backing.ZIndex = 2
|
backing.ZIndex = 2
|
||||||
backing.Parent = popupImage
|
backing.Parent = popupImage
|
||||||
|
|
||||||
local popupText = Instance.new("TextLabel")
|
local popupText = Instance.new "TextLabel"
|
||||||
popupText.Name = "PopupText"
|
popupText.Name = "PopupText"
|
||||||
popupText.Size = UDim2.new(1,0,0.8,0)
|
popupText.Size = UDim2.new(1, 0, 0.8, 0)
|
||||||
popupText.Font = Enum.Font.ArialBold
|
popupText.Font = Enum.Font.ArialBold
|
||||||
popupText.FontSize = Enum.FontSize.Size36
|
popupText.FontSize = Enum.FontSize.Size36
|
||||||
popupText.BackgroundTransparency = 1
|
popupText.BackgroundTransparency = 1
|
||||||
popupText.Text = "Hello I'm a popup"
|
popupText.Text = "Hello I'm a popup"
|
||||||
popupText.TextColor3 = Color3.new(248/255,248/255,248/255)
|
popupText.TextColor3 = Color3.new(248 / 255, 248 / 255, 248 / 255)
|
||||||
popupText.TextWrap = true
|
popupText.TextWrap = true
|
||||||
popupText.ZIndex = 5
|
popupText.ZIndex = 5
|
||||||
popupText.Parent = popupFrame
|
popupText.Parent = popupFrame
|
||||||
|
|
|
||||||
1467
53878047.lua
1467
53878047.lua
File diff suppressed because it is too large
Load Diff
669
53878057.lua
669
53878057.lua
File diff suppressed because it is too large
Load Diff
|
|
@ -1 +0,0 @@
|
||||||
|
|
||||||
610
60595411.lua
610
60595411.lua
File diff suppressed because it is too large
Load Diff
|
|
@ -3,12 +3,12 @@
|
||||||
-- access to all of the libraries (otherwise only local scripts do)
|
-- access to all of the libraries (otherwise only local scripts do)
|
||||||
|
|
||||||
local deepakTestingPlace = 3569749
|
local deepakTestingPlace = 3569749
|
||||||
local sc = game:GetService("ScriptContext")
|
local sc = game:GetService "ScriptContext"
|
||||||
local tries = 0
|
local tries = 0
|
||||||
|
|
||||||
while not sc and tries < 3 do
|
while not sc and tries < 3 do
|
||||||
tries = tries + 1
|
tries = tries + 1
|
||||||
sc = game:GetService("ScriptContext")
|
sc = game:GetService "ScriptContext"
|
||||||
wait(0.2)
|
wait(0.2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -22,5 +22,5 @@ if sc then
|
||||||
sc:RegisterLibrary("Libraries/RbxStamper", "73157242")
|
sc:RegisterLibrary("Libraries/RbxStamper", "73157242")
|
||||||
sc:LibraryRegistrationComplete()
|
sc:LibraryRegistrationComplete()
|
||||||
else
|
else
|
||||||
print("failed to find script context, libraries did not load")
|
print "failed to find script context, libraries did not load"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
1231
73157242.lua
1231
73157242.lua
File diff suppressed because it is too large
Load Diff
453
89449008.lua
453
89449008.lua
|
|
@ -3,7 +3,7 @@ local function waitForChild(instance, name)
|
||||||
assert(instance)
|
assert(instance)
|
||||||
assert(name)
|
assert(name)
|
||||||
while not instance:FindFirstChild(name) do
|
while not instance:FindFirstChild(name) do
|
||||||
print('Waiting for ...', instance, name)
|
print("Waiting for ...", instance, name)
|
||||||
instance.ChildAdded:wait()
|
instance.ChildAdded:wait()
|
||||||
end
|
end
|
||||||
return instance:FindFirstChild(name)
|
return instance:FindFirstChild(name)
|
||||||
|
|
@ -18,23 +18,26 @@ end
|
||||||
|
|
||||||
local function IsTouchDevice()
|
local function IsTouchDevice()
|
||||||
local touchEnabled = false
|
local touchEnabled = false
|
||||||
pcall(function() touchEnabled = Game:GetService('UserInputService').TouchEnabled end)
|
pcall(function()
|
||||||
|
touchEnabled = Game:GetService("UserInputService").TouchEnabled
|
||||||
|
end)
|
||||||
return touchEnabled
|
return touchEnabled
|
||||||
end
|
end
|
||||||
|
|
||||||
|
waitForChild(game, "Players")
|
||||||
waitForChild(game,"Players")
|
waitForProperty(game.Players, "LocalPlayer")
|
||||||
waitForProperty(game.Players,"LocalPlayer")
|
|
||||||
local player = game.Players.LocalPlayer
|
local player = game.Players.LocalPlayer
|
||||||
|
|
||||||
local RbxGui, msg = LoadLibrary("RbxGui")
|
local RbxGui, _ = LoadLibrary "RbxGui"
|
||||||
if not RbxGui then print("could not find RbxGui!") return end
|
if not RbxGui then
|
||||||
|
print "could not find RbxGui!"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
--- Begin Locals
|
--- Begin Locals
|
||||||
local StaticTabName = "gear"
|
local StaticTabName = "gear"
|
||||||
|
|
||||||
local backpack = script.Parent
|
local backpack = script.Parent
|
||||||
local screen = script.Parent.Parent
|
|
||||||
|
|
||||||
local backpackItems = {}
|
local backpackItems = {}
|
||||||
local buttons = {}
|
local buttons = {}
|
||||||
|
|
@ -49,67 +52,67 @@ local characterChildAddedCon = nil
|
||||||
local characterChildRemovedCon = nil
|
local characterChildRemovedCon = nil
|
||||||
local backpackAddCon = nil
|
local backpackAddCon = nil
|
||||||
|
|
||||||
local playerBackpack = waitForChild(player,"Backpack")
|
local playerBackpack = waitForChild(player, "Backpack")
|
||||||
|
|
||||||
waitForChild(backpack,"Tabs")
|
waitForChild(backpack, "Tabs")
|
||||||
|
|
||||||
waitForChild(backpack,"Gear")
|
waitForChild(backpack, "Gear")
|
||||||
local gearPreview = waitForChild(backpack.Gear,"GearPreview")
|
local gearPreview = waitForChild(backpack.Gear, "GearPreview")
|
||||||
|
|
||||||
local scroller = waitForChild(backpack.Gear,"GearGridScrollingArea")
|
local scroller = waitForChild(backpack.Gear, "GearGridScrollingArea")
|
||||||
|
|
||||||
local currentLoadout = waitForChild(backpack.Parent,"CurrentLoadout")
|
local currentLoadout = waitForChild(backpack.Parent, "CurrentLoadout")
|
||||||
|
|
||||||
local grid = waitForChild(backpack.Gear,"GearGrid")
|
local grid = waitForChild(backpack.Gear, "GearGrid")
|
||||||
local gearButton = waitForChild(grid,"GearButton")
|
local gearButton = waitForChild(grid, "GearButton")
|
||||||
|
|
||||||
local swapSlot = waitForChild(script.Parent,"SwapSlot")
|
local swapSlot = waitForChild(script.Parent, "SwapSlot")
|
||||||
|
|
||||||
local backpackManager = waitForChild(script.Parent,"CoreScripts/BackpackScripts/BackpackManager")
|
local backpackManager = waitForChild(script.Parent, "CoreScripts/BackpackScripts/BackpackManager")
|
||||||
local backpackOpenEvent = waitForChild(backpackManager,"BackpackOpenEvent")
|
local backpackOpenEvent = waitForChild(backpackManager, "BackpackOpenEvent")
|
||||||
local backpackCloseEvent = waitForChild(backpackManager,"BackpackCloseEvent")
|
local backpackCloseEvent = waitForChild(backpackManager, "BackpackCloseEvent")
|
||||||
local tabClickedEvent = waitForChild(backpackManager,"TabClickedEvent")
|
local tabClickedEvent = waitForChild(backpackManager, "TabClickedEvent")
|
||||||
local resizeEvent = waitForChild(backpackManager,"ResizeEvent")
|
local resizeEvent = waitForChild(backpackManager, "ResizeEvent")
|
||||||
local searchRequestedEvent = waitForChild(backpackManager,"SearchRequestedEvent")
|
local searchRequestedEvent = waitForChild(backpackManager, "SearchRequestedEvent")
|
||||||
local tellBackpackReadyFunc = waitForChild(backpackManager,"BackpackReady")
|
local tellBackpackReadyFunc = waitForChild(backpackManager, "BackpackReady")
|
||||||
|
|
||||||
-- creating scroll bar early as to make sure items get placed correctly
|
-- creating scroll bar early as to make sure items get placed correctly
|
||||||
local scrollFrame, scrollUp, scrollDown, recalculateScroll = RbxGui.CreateScrollingFrame(nil, "grid", Vector2.new(6, 6))
|
local scrollFrame, scrollUp, scrollDown, recalculateScroll = RbxGui.CreateScrollingFrame(nil, "grid", Vector2.new(6, 6))
|
||||||
|
|
||||||
scrollFrame.Position = UDim2.new(0,0,0,30)
|
scrollFrame.Position = UDim2.new(0, 0, 0, 30)
|
||||||
scrollFrame.Size = UDim2.new(1,0,1,-30)
|
scrollFrame.Size = UDim2.new(1, 0, 1, -30)
|
||||||
scrollFrame.Parent = backpack.Gear.GearGrid
|
scrollFrame.Parent = backpack.Gear.GearGrid
|
||||||
|
|
||||||
local scrollBar = Instance.new("Frame")
|
local scrollBar = Instance.new "Frame"
|
||||||
scrollBar.Name = "ScrollBar"
|
scrollBar.Name = "ScrollBar"
|
||||||
scrollBar.BackgroundTransparency = 0.9
|
scrollBar.BackgroundTransparency = 0.9
|
||||||
scrollBar.BackgroundColor3 = Color3.new(1,1,1)
|
scrollBar.BackgroundColor3 = Color3.new(1, 1, 1)
|
||||||
scrollBar.BorderSizePixel = 0
|
scrollBar.BorderSizePixel = 0
|
||||||
scrollBar.Size = UDim2.new(0, 17, 1, -36)
|
scrollBar.Size = UDim2.new(0, 17, 1, -36)
|
||||||
scrollBar.Position = UDim2.new(0,0,0,18)
|
scrollBar.Position = UDim2.new(0, 0, 0, 18)
|
||||||
scrollBar.Parent = scroller
|
scrollBar.Parent = scroller
|
||||||
|
|
||||||
scrollDown.Position = UDim2.new(0,0,1,-17)
|
scrollDown.Position = UDim2.new(0, 0, 1, -17)
|
||||||
|
|
||||||
scrollUp.Parent = scroller
|
scrollUp.Parent = scroller
|
||||||
scrollDown.Parent = scroller
|
scrollDown.Parent = scroller
|
||||||
|
|
||||||
local scrollFrameLoadout, scrollUpLoadout, scrollDownLoadout, recalculateScrollLoadout = RbxGui.CreateScrollingFrame()
|
local scrollFrameLoadout, scrollUpLoadout, scrollDownLoadout, recalculateScrollLoadout = RbxGui.CreateScrollingFrame()
|
||||||
|
|
||||||
scrollFrameLoadout.Position = UDim2.new(0,0,0,0)
|
scrollFrameLoadout.Position = UDim2.new(0, 0, 0, 0)
|
||||||
scrollFrameLoadout.Size = UDim2.new(1,0,1,0)
|
scrollFrameLoadout.Size = UDim2.new(1, 0, 1, 0)
|
||||||
scrollFrameLoadout.Parent = backpack.Gear.GearLoadouts.LoadoutsList
|
scrollFrameLoadout.Parent = backpack.Gear.GearLoadouts.LoadoutsList
|
||||||
|
|
||||||
local LoadoutButton = Instance.new("TextButton")
|
local LoadoutButton = Instance.new "TextButton"
|
||||||
LoadoutButton.RobloxLocked = true
|
LoadoutButton.RobloxLocked = true
|
||||||
LoadoutButton.Name = "LoadoutButton"
|
LoadoutButton.Name = "LoadoutButton"
|
||||||
LoadoutButton.Font = Enum.Font.ArialBold
|
LoadoutButton.Font = Enum.Font.ArialBold
|
||||||
LoadoutButton.FontSize = Enum.FontSize.Size14
|
LoadoutButton.FontSize = Enum.FontSize.Size14
|
||||||
LoadoutButton.Position = UDim2.new(0,0,0,0)
|
LoadoutButton.Position = UDim2.new(0, 0, 0, 0)
|
||||||
LoadoutButton.Size = UDim2.new(1,0,0,32)
|
LoadoutButton.Size = UDim2.new(1, 0, 0, 32)
|
||||||
LoadoutButton.Style = Enum.ButtonStyle.RobloxButton
|
LoadoutButton.Style = Enum.ButtonStyle.RobloxButton
|
||||||
LoadoutButton.Text = "Loadout #1"
|
LoadoutButton.Text = "Loadout #1"
|
||||||
LoadoutButton.TextColor3 = Color3.new(1,1,1)
|
LoadoutButton.TextColor3 = Color3.new(1, 1, 1)
|
||||||
LoadoutButton.Parent = scrollFrameLoadout
|
LoadoutButton.Parent = scrollFrameLoadout
|
||||||
|
|
||||||
local LoadoutButtonTwo = LoadoutButton:clone()
|
local LoadoutButtonTwo = LoadoutButton:clone()
|
||||||
|
|
@ -124,39 +127,38 @@ local LoadoutButtonFour = LoadoutButton:clone()
|
||||||
LoadoutButtonFour.Text = "Loadout #4"
|
LoadoutButtonFour.Text = "Loadout #4"
|
||||||
LoadoutButtonFour.Parent = scrollFrameLoadout
|
LoadoutButtonFour.Parent = scrollFrameLoadout
|
||||||
|
|
||||||
local scrollBarLoadout = Instance.new("Frame")
|
local scrollBarLoadout = Instance.new "Frame"
|
||||||
scrollBarLoadout.Name = "ScrollBarLoadout"
|
scrollBarLoadout.Name = "ScrollBarLoadout"
|
||||||
scrollBarLoadout.BackgroundTransparency = 0.9
|
scrollBarLoadout.BackgroundTransparency = 0.9
|
||||||
scrollBarLoadout.BackgroundColor3 = Color3.new(1,1,1)
|
scrollBarLoadout.BackgroundColor3 = Color3.new(1, 1, 1)
|
||||||
scrollBarLoadout.BorderSizePixel = 0
|
scrollBarLoadout.BorderSizePixel = 0
|
||||||
scrollBarLoadout.Size = UDim2.new(0, 17, 1, -36)
|
scrollBarLoadout.Size = UDim2.new(0, 17, 1, -36)
|
||||||
scrollBarLoadout.Position = UDim2.new(0,0,0,18)
|
scrollBarLoadout.Position = UDim2.new(0, 0, 0, 18)
|
||||||
scrollBarLoadout.Parent = backpack.Gear.GearLoadouts.GearLoadoutsScrollingArea
|
scrollBarLoadout.Parent = backpack.Gear.GearLoadouts.GearLoadoutsScrollingArea
|
||||||
|
|
||||||
scrollDownLoadout.Position = UDim2.new(0,0,1,-17)
|
scrollDownLoadout.Position = UDim2.new(0, 0, 1, -17)
|
||||||
|
|
||||||
scrollUpLoadout.Parent = backpack.Gear.GearLoadouts.GearLoadoutsScrollingArea
|
scrollUpLoadout.Parent = backpack.Gear.GearLoadouts.GearLoadoutsScrollingArea
|
||||||
scrollDownLoadout.Parent = backpack.Gear.GearLoadouts.GearLoadoutsScrollingArea
|
scrollDownLoadout.Parent = backpack.Gear.GearLoadouts.GearLoadoutsScrollingArea
|
||||||
|
|
||||||
|
|
||||||
-- Begin Functions
|
-- Begin Functions
|
||||||
function removeFromMap(map,object)
|
function removeFromMap(map, object)
|
||||||
for i = 1, #map do
|
for i = 1, #map do
|
||||||
if map[i] == object then
|
if map[i] == object then
|
||||||
table.remove(map,i)
|
table.remove(map, i)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function robloxLock(instance)
|
function robloxLock(instance)
|
||||||
instance.RobloxLocked = true
|
instance.RobloxLocked = true
|
||||||
children = instance:GetChildren()
|
children = instance:GetChildren()
|
||||||
if children then
|
if children then
|
||||||
for i, child in ipairs(children) do
|
for _, child in ipairs(children) do
|
||||||
robloxLock(child)
|
robloxLock(child)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function resize()
|
function resize()
|
||||||
|
|
@ -167,26 +169,30 @@ function resize()
|
||||||
size = gearPreview.AbsoluteSize.Y * 0.75
|
size = gearPreview.AbsoluteSize.Y * 0.75
|
||||||
end
|
end
|
||||||
|
|
||||||
waitForChild(gearPreview,"GearImage")
|
waitForChild(gearPreview, "GearImage")
|
||||||
gearPreview.GearImage.Size = UDim2.new(0,size,0,size)
|
gearPreview.GearImage.Size = UDim2.new(0, size, 0, size)
|
||||||
gearPreview.GearImage.Position = UDim2.new(0,gearPreview.AbsoluteSize.X/2 - size/2,0.75,-size)
|
gearPreview.GearImage.Position = UDim2.new(0, gearPreview.AbsoluteSize.X / 2 - size / 2, 0.75, -size)
|
||||||
|
|
||||||
resizeGrid()
|
resizeGrid()
|
||||||
end
|
end
|
||||||
|
|
||||||
function addToGrid(child)
|
function addToGrid(child)
|
||||||
if not child:IsA("Tool") then
|
if not child:IsA "Tool" then
|
||||||
if not child:IsA("HopperBin") then
|
if not child:IsA "HopperBin" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if child:FindFirstChild("RobloxBuildTool") then return end
|
if child:FindFirstChild "RobloxBuildTool" then
|
||||||
|
return
|
||||||
for i,v in pairs(backpackItems) do -- check to see if we already have this gear registered
|
|
||||||
if v == child then return end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(backpackItems,child)
|
for i, v in pairs(backpackItems) do -- check to see if we already have this gear registered
|
||||||
|
if v == child then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
table.insert(backpackItems, child)
|
||||||
|
|
||||||
local changeCon = child.Changed:connect(function(prop)
|
local changeCon = child.Changed:connect(function(prop)
|
||||||
if prop == "Name" then
|
if prop == "Name" then
|
||||||
|
|
@ -198,32 +204,40 @@ function addToGrid(child)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
local ancestryCon = nil
|
local ancestryCon = nil
|
||||||
ancestryCon = child.AncestryChanged:connect(function(theChild,theParent)
|
ancestryCon = child.AncestryChanged:connect(function(theChild, theParent)
|
||||||
local thisObject = nil
|
local thisObject = nil
|
||||||
for k,v in pairs(backpackItems) do
|
for k, v in pairs(backpackItems) do
|
||||||
if v == child then
|
if v == child then
|
||||||
thisObject = v
|
thisObject = v
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
waitForProperty(player,"Character")
|
waitForProperty(player, "Character")
|
||||||
waitForChild(player,"Backpack")
|
waitForChild(player, "Backpack")
|
||||||
if (child.Parent ~= player.Backpack and child.Parent ~= player.Character) then
|
if child.Parent ~= player.Backpack and child.Parent ~= player.Character then
|
||||||
if ancestryCon then ancestryCon:disconnect() end
|
if ancestryCon then
|
||||||
if changeCon then changeCon:disconnect() end
|
ancestryCon:disconnect()
|
||||||
|
end
|
||||||
|
if changeCon then
|
||||||
|
changeCon:disconnect()
|
||||||
|
end
|
||||||
|
|
||||||
for k,v in pairs(backpackItems) do
|
for k, v in pairs(backpackItems) do
|
||||||
if v == thisObject then
|
if v == thisObject then
|
||||||
if mouseEnterCons[buttons[v]] then mouseEnterCons[buttons[v]]:disconnect() end
|
if mouseEnterCons[buttons[v]] then
|
||||||
if mouseClickCons[buttons[v]] then mouseClickCons[buttons[v]]:disconnect() end
|
mouseEnterCons[buttons[v]]:disconnect()
|
||||||
|
end
|
||||||
|
if mouseClickCons[buttons[v]] then
|
||||||
|
mouseClickCons[buttons[v]]:disconnect()
|
||||||
|
end
|
||||||
buttons[v].Parent = nil
|
buttons[v].Parent = nil
|
||||||
buttons[v] = nil
|
buttons[v] = nil
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
removeFromMap(backpackItems,thisObject)
|
removeFromMap(backpackItems, thisObject)
|
||||||
|
|
||||||
resizeGrid()
|
resizeGrid()
|
||||||
else
|
else
|
||||||
|
|
@ -235,7 +249,7 @@ function addToGrid(child)
|
||||||
end
|
end
|
||||||
|
|
||||||
function buttonClick(button)
|
function buttonClick(button)
|
||||||
if button:FindFirstChild("UnequipContextMenu") and not button.Active then
|
if button:FindFirstChild "UnequipContextMenu" and not button.Active then
|
||||||
button.UnequipContextMenu.Visible = true
|
button.UnequipContextMenu.Visible = true
|
||||||
browsingMenu = true
|
browsingMenu = true
|
||||||
end
|
end
|
||||||
|
|
@ -253,26 +267,36 @@ function findEmptySlot()
|
||||||
local smallestNum = nil
|
local smallestNum = nil
|
||||||
local loadout = currentLoadout:GetChildren()
|
local loadout = currentLoadout:GetChildren()
|
||||||
for i = 1, #loadout do
|
for i = 1, #loadout do
|
||||||
if loadout[i]:IsA("Frame") and #loadout[i]:GetChildren() <= 0 then
|
if loadout[i]:IsA "Frame" and #loadout[i]:GetChildren() <= 0 then
|
||||||
local frameNum = tonumber(string.sub(loadout[i].Name,5))
|
local frameNum = tonumber(string.sub(loadout[i].Name, 5))
|
||||||
if frameNum == 0 then frameNum = 10 end
|
if frameNum == 0 then
|
||||||
|
frameNum = 10
|
||||||
|
end
|
||||||
if not smallestNum or (smallestNum > frameNum) then
|
if not smallestNum or (smallestNum > frameNum) then
|
||||||
smallestNum = frameNum
|
smallestNum = frameNum
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if smallestNum == 10 then smallestNum = 0 end
|
if smallestNum == 10 then
|
||||||
|
smallestNum = 0
|
||||||
|
end
|
||||||
return smallestNum
|
return smallestNum
|
||||||
end
|
end
|
||||||
|
|
||||||
function checkForSwap(button,x,y)
|
function checkForSwap(button, x, y)
|
||||||
local loadoutChildren = currentLoadout:GetChildren()
|
local loadoutChildren = currentLoadout:GetChildren()
|
||||||
for i = 1, #loadoutChildren do
|
for i = 1, #loadoutChildren do
|
||||||
if loadoutChildren[i]:IsA("Frame") and string.find(loadoutChildren[i].Name,"Slot") then
|
if loadoutChildren[i]:IsA "Frame" and string.find(loadoutChildren[i].Name, "Slot") then
|
||||||
if x >= loadoutChildren[i].AbsolutePosition.x and x <= (loadoutChildren[i].AbsolutePosition.x + loadoutChildren[i].AbsoluteSize.x) then
|
if
|
||||||
if y >= loadoutChildren[i].AbsolutePosition.y and y <= (loadoutChildren[i].AbsolutePosition.y + loadoutChildren[i].AbsoluteSize.y) then
|
x >= loadoutChildren[i].AbsolutePosition.x
|
||||||
local slot = tonumber(string.sub(loadoutChildren[i].Name,5))
|
and x <= (loadoutChildren[i].AbsolutePosition.x + loadoutChildren[i].AbsoluteSize.x)
|
||||||
swapGearSlot(slot,button)
|
then
|
||||||
|
if
|
||||||
|
y >= loadoutChildren[i].AbsolutePosition.y
|
||||||
|
and y <= (loadoutChildren[i].AbsolutePosition.y + loadoutChildren[i].AbsoluteSize.y)
|
||||||
|
then
|
||||||
|
local slot = tonumber(string.sub(loadoutChildren[i].Name, 5))
|
||||||
|
swapGearSlot(slot, button)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -282,8 +306,8 @@ function checkForSwap(button,x,y)
|
||||||
end
|
end
|
||||||
|
|
||||||
function resizeGrid()
|
function resizeGrid()
|
||||||
for k,v in pairs(backpackItems) do
|
for k, v in pairs(backpackItems) do
|
||||||
if not v:FindFirstChild("RobloxBuildTool") then
|
if not v:FindFirstChild "RobloxBuildTool" then
|
||||||
if not buttons[v] then
|
if not buttons[v] then
|
||||||
local buttonClone = gearButton:clone()
|
local buttonClone = gearButton:clone()
|
||||||
buttonClone.Parent = grid.ScrollingFrame
|
buttonClone.Parent = grid.ScrollingFrame
|
||||||
|
|
@ -297,31 +321,35 @@ function resizeGrid()
|
||||||
buttonClone.Draggable = true
|
buttonClone.Draggable = true
|
||||||
buttons[v] = buttonClone
|
buttons[v] = buttonClone
|
||||||
|
|
||||||
|
|
||||||
if not IsTouchDevice() then
|
if not IsTouchDevice() then
|
||||||
local unequipMenu = getGearContextMenu()
|
local unequipMenu = getGearContextMenu()
|
||||||
|
|
||||||
|
|
||||||
unequipMenu.Visible = false
|
unequipMenu.Visible = false
|
||||||
unequipMenu.Parent = buttonClone
|
unequipMenu.Parent = buttonClone
|
||||||
end
|
end
|
||||||
|
|
||||||
local beginPos = nil
|
local beginPos = nil
|
||||||
buttonClone.DragBegin:connect(function(value)
|
buttonClone.DragBegin:connect(function(value)
|
||||||
waitForChild(buttonClone, 'Background')
|
waitForChild(buttonClone, "Background")
|
||||||
buttonClone['Background'].ZIndex = 10
|
buttonClone["Background"].ZIndex = 10
|
||||||
buttonClone.ZIndex = 10
|
buttonClone.ZIndex = 10
|
||||||
beginPos = value
|
beginPos = value
|
||||||
end)
|
end)
|
||||||
buttonClone.DragStopped:connect(function(x,y)
|
buttonClone.DragStopped:connect(function(x, y)
|
||||||
waitForChild(buttonClone, 'Background')
|
waitForChild(buttonClone, "Background")
|
||||||
buttonClone['Background'].ZIndex = 1.0
|
buttonClone["Background"].ZIndex = 1
|
||||||
buttonClone.ZIndex = 2
|
buttonClone.ZIndex = 2
|
||||||
if beginPos ~= buttonClone.Position then
|
if beginPos ~= buttonClone.Position then
|
||||||
if not checkForSwap(buttonClone,x,y) then
|
if not checkForSwap(buttonClone, x, y) then
|
||||||
buttonClone:TweenPosition(beginPos,Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true)
|
buttonClone:TweenPosition(
|
||||||
|
beginPos,
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quad,
|
||||||
|
0.5,
|
||||||
|
true
|
||||||
|
)
|
||||||
buttonClone.Draggable = false
|
buttonClone.Draggable = false
|
||||||
delay(0.5,function()
|
delay(0.5, function()
|
||||||
buttonClone.Draggable = true
|
buttonClone.Draggable = true
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
|
|
@ -330,14 +358,16 @@ function resizeGrid()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
local clickTime = tick()
|
local clickTime = tick()
|
||||||
mouseEnterCons[buttonClone] = buttonClone.MouseEnter:connect(function() previewGear(buttonClone) end)
|
mouseEnterCons[buttonClone] = buttonClone.MouseEnter:connect(function()
|
||||||
|
previewGear(buttonClone)
|
||||||
|
end)
|
||||||
mouseClickCons[buttonClone] = buttonClone.MouseButton1Click:connect(function()
|
mouseClickCons[buttonClone] = buttonClone.MouseButton1Click:connect(function()
|
||||||
local newClickTime = tick()
|
local newClickTime = tick()
|
||||||
if buttonClone.Active and (newClickTime - clickTime) < 0.5 then
|
if buttonClone.Active and (newClickTime - clickTime) < 0.5 then
|
||||||
local slot = findEmptySlot()
|
local slot = findEmptySlot()
|
||||||
if slot then
|
if slot then
|
||||||
buttonClone.ZIndex = 1
|
buttonClone.ZIndex = 1
|
||||||
swapGearSlot(slot,buttonClone)
|
swapGearSlot(slot, buttonClone)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
buttonClick(buttonClone)
|
buttonClick(buttonClone)
|
||||||
|
|
@ -351,19 +381,19 @@ function resizeGrid()
|
||||||
end
|
end
|
||||||
|
|
||||||
function showPartialGrid(subset)
|
function showPartialGrid(subset)
|
||||||
for k,v in pairs(buttons) do
|
for _, v in pairs(buttons) do
|
||||||
v.Parent = nil
|
v.Parent = nil
|
||||||
end
|
end
|
||||||
if subset then
|
if subset then
|
||||||
for k,v in pairs(subset) do
|
for _, v in pairs(subset) do
|
||||||
v.Parent = grid.ScrollingFrame
|
v.Parent = grid.ScrollingFrame
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
recalculateScroll()
|
recalculateScroll()
|
||||||
end
|
end
|
||||||
|
|
||||||
function showEntireGrid()
|
function showEntireGrid()
|
||||||
for k,v in pairs(buttons) do
|
for _, v in pairs(buttons) do
|
||||||
v.Parent = grid.ScrollingFrame
|
v.Parent = grid.ScrollingFrame
|
||||||
end
|
end
|
||||||
recalculateScroll()
|
recalculateScroll()
|
||||||
|
|
@ -372,7 +402,7 @@ end
|
||||||
function inLoadout(gear)
|
function inLoadout(gear)
|
||||||
local children = currentLoadout:GetChildren()
|
local children = currentLoadout:GetChildren()
|
||||||
for i = 1, #children do
|
for i = 1, #children do
|
||||||
if children[i]:IsA("Frame") then
|
if children[i]:IsA "Frame" then
|
||||||
local button = children[i]:GetChildren()
|
local button = children[i]:GetChildren()
|
||||||
if #button > 0 then
|
if #button > 0 then
|
||||||
if button[1].GearReference.Value and button[1].GearReference.Value == gear then
|
if button[1].GearReference.Value and button[1].GearReference.Value == gear then
|
||||||
|
|
@ -385,16 +415,16 @@ function inLoadout(gear)
|
||||||
end
|
end
|
||||||
|
|
||||||
function updateGridActive()
|
function updateGridActive()
|
||||||
for k,v in pairs(backpackItems) do
|
for _, v in pairs(backpackItems) do
|
||||||
if buttons[v] then
|
if buttons[v] then
|
||||||
local gear = nil
|
local gear = nil
|
||||||
local gearRef = buttons[v]:FindFirstChild("GearReference")
|
local gearRef = buttons[v]:FindFirstChild "GearReference"
|
||||||
|
|
||||||
if gearRef then gear = gearRef.Value end
|
if gearRef then
|
||||||
|
gear = gearRef.Value
|
||||||
|
end
|
||||||
|
|
||||||
if not gear then
|
if (not gear) or inLoadout(gear) then
|
||||||
buttons[v].Active = false
|
|
||||||
elseif inLoadout(gear) then
|
|
||||||
buttons[v].Active = false
|
buttons[v].Active = false
|
||||||
else
|
else
|
||||||
buttons[v].Active = true
|
buttons[v].Active = true
|
||||||
|
|
@ -407,7 +437,7 @@ function centerGear(loadoutChildren)
|
||||||
local gearButtons = {}
|
local gearButtons = {}
|
||||||
local lastSlotAdd = nil
|
local lastSlotAdd = nil
|
||||||
for i = 1, #loadoutChildren do
|
for i = 1, #loadoutChildren do
|
||||||
if loadoutChildren[i]:IsA("Frame") and #loadoutChildren[i]:GetChildren() > 0 then
|
if loadoutChildren[i]:IsA "Frame" and #loadoutChildren[i]:GetChildren() > 0 then
|
||||||
if loadoutChildren[i].Name == "Slot0" then
|
if loadoutChildren[i].Name == "Slot0" then
|
||||||
lastSlotAdd = loadoutChildren[i]
|
lastSlotAdd = loadoutChildren[i]
|
||||||
else
|
else
|
||||||
|
|
@ -415,11 +445,19 @@ function centerGear(loadoutChildren)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if lastSlotAdd then table.insert(gearButtons,lastSlotAdd) end
|
if lastSlotAdd then
|
||||||
|
table.insert(gearButtons, lastSlotAdd)
|
||||||
|
end
|
||||||
|
|
||||||
local startPos = ( 1 - (#gearButtons * 0.1) ) / 2
|
local startPos = (1 - (#gearButtons * 0.1)) / 2
|
||||||
for i = 1, #gearButtons do
|
for i = 1, #gearButtons do
|
||||||
gearButtons[i]:TweenPosition(UDim2.new(startPos + ((i - 1) * 0.1),0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, true)
|
gearButtons[i]:TweenPosition(
|
||||||
|
UDim2.new(startPos + ((i - 1) * 0.1), 0, 0, 0),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quad,
|
||||||
|
0.25,
|
||||||
|
true
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -459,10 +497,12 @@ function backpackCloseHandler(currentTab)
|
||||||
end
|
end
|
||||||
|
|
||||||
function loadoutCheck(child, selectState)
|
function loadoutCheck(child, selectState)
|
||||||
if not child:IsA("ImageButton") then return end
|
if not child:IsA "ImageButton" then
|
||||||
for k,v in pairs(backpackItems) do
|
return
|
||||||
|
end
|
||||||
|
for k, v in pairs(backpackItems) do
|
||||||
if buttons[v] then
|
if buttons[v] then
|
||||||
if child:FindFirstChild("GearReference") and buttons[v]:FindFirstChild("GearReference") then
|
if child:FindFirstChild "GearReference" and buttons[v]:FindFirstChild "GearReference" then
|
||||||
if buttons[v].GearReference.Value == child.GearReference.Value then
|
if buttons[v].GearReference.Value == child.GearReference.Value then
|
||||||
buttons[v].Active = selectState
|
buttons[v].Active = selectState
|
||||||
break
|
break
|
||||||
|
|
@ -480,7 +520,7 @@ end
|
||||||
function removeAllEquippedGear(physGear)
|
function removeAllEquippedGear(physGear)
|
||||||
local stuff = player.Character:GetChildren()
|
local stuff = player.Character:GetChildren()
|
||||||
for i = 1, #stuff do
|
for i = 1, #stuff do
|
||||||
if ( stuff[i]:IsA("Tool") or stuff[i]:IsA("HopperBin") ) and stuff[i] ~= physGear then
|
if (stuff[i]:IsA "Tool" or stuff[i]:IsA "HopperBin") and stuff[i] ~= physGear then
|
||||||
stuff[i].Parent = playerBackpack
|
stuff[i].Parent = playerBackpack
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -498,15 +538,15 @@ function unequipGear(physGear)
|
||||||
end
|
end
|
||||||
|
|
||||||
function highlight(button)
|
function highlight(button)
|
||||||
button.TextColor3 = Color3.new(0,0,0)
|
button.TextColor3 = Color3.new(0, 0, 0)
|
||||||
button.BackgroundColor3 = Color3.new(0.8,0.8,0.8)
|
button.BackgroundColor3 = Color3.new(0.8, 0.8, 0.8)
|
||||||
end
|
end
|
||||||
function clearHighlight(button)
|
function clearHighlight(button)
|
||||||
button.TextColor3 = Color3.new(1,1,1)
|
button.TextColor3 = Color3.new(1, 1, 1)
|
||||||
button.BackgroundColor3 = Color3.new(0,0,0)
|
button.BackgroundColor3 = Color3.new(0, 0, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
function swapGearSlot(slot,gearButton)
|
function swapGearSlot(slot, gearButton)
|
||||||
if not swapSlot.Value then -- signal loadout to swap a gear out
|
if not swapSlot.Value then -- signal loadout to swap a gear out
|
||||||
swapSlot.Slot.Value = slot
|
swapSlot.Slot.Value = slot
|
||||||
swapSlot.GearButton.Value = gearButton
|
swapSlot.GearButton.Value = gearButton
|
||||||
|
|
@ -515,9 +555,10 @@ function swapGearSlot(slot,gearButton)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local UnequipGearMenuClick = function(element, menu)
|
local UnequipGearMenuClick = function(element, menu)
|
||||||
if type(element.Action) ~= "number" then return end
|
if type(element.Action) ~= "number" then
|
||||||
|
return
|
||||||
|
end
|
||||||
local num = element.Action
|
local num = element.Action
|
||||||
if num == 1 then -- remove from loadout
|
if num == 1 then -- remove from loadout
|
||||||
unequipGear(menu.Parent.GearReference.Value)
|
unequipGear(menu.Parent.GearReference.Value)
|
||||||
|
|
@ -526,7 +567,7 @@ local UnequipGearMenuClick = function(element, menu)
|
||||||
local loadoutChildren = currentLoadout:GetChildren()
|
local loadoutChildren = currentLoadout:GetChildren()
|
||||||
local slot = -1
|
local slot = -1
|
||||||
for i = 1, #loadoutChildren do
|
for i = 1, #loadoutChildren do
|
||||||
if loadoutChildren[i]:IsA("Frame") then
|
if loadoutChildren[i]:IsA "Frame" then
|
||||||
local button = loadoutChildren[i]:GetChildren()
|
local button = loadoutChildren[i]:GetChildren()
|
||||||
if button[1] and button[1].GearReference.Value == gearToUnequip then
|
if button[1] and button[1].GearReference.Value == gearToUnequip then
|
||||||
slot = button[1].SlotNumber.Text
|
slot = button[1].SlotNumber.Text
|
||||||
|
|
@ -534,14 +575,17 @@ local UnequipGearMenuClick = function(element, menu)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
swapGearSlot(slot,nil)
|
swapGearSlot(slot, nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function setupCharacterConnections()
|
function setupCharacterConnections()
|
||||||
|
if backpackAddCon then
|
||||||
if backpackAddCon then backpackAddCon:disconnect() end
|
backpackAddCon:disconnect()
|
||||||
backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded:connect(function(child) addToGrid(child) end)
|
end
|
||||||
|
backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded:connect(function(child)
|
||||||
|
addToGrid(child)
|
||||||
|
end)
|
||||||
|
|
||||||
-- make sure we get all the children
|
-- make sure we get all the children
|
||||||
local backpackChildren = game.Players.LocalPlayer.Backpack:GetChildren()
|
local backpackChildren = game.Players.LocalPlayer.Backpack:GetChildren()
|
||||||
|
|
@ -549,42 +593,50 @@ function setupCharacterConnections()
|
||||||
addToGrid(backpackChildren[i])
|
addToGrid(backpackChildren[i])
|
||||||
end
|
end
|
||||||
|
|
||||||
if characterChildAddedCon then characterChildAddedCon:disconnect() end
|
if characterChildAddedCon then
|
||||||
characterChildAddedCon =
|
characterChildAddedCon:disconnect()
|
||||||
game.Players.LocalPlayer.Character.ChildAdded:connect(function(child)
|
end
|
||||||
addToGrid(child)
|
characterChildAddedCon = game.Players.LocalPlayer.Character.ChildAdded:connect(function(child)
|
||||||
updateGridActive()
|
addToGrid(child)
|
||||||
end)
|
updateGridActive()
|
||||||
|
end)
|
||||||
|
|
||||||
if characterChildRemovedCon then characterChildRemovedCon:disconnect() end
|
if characterChildRemovedCon then
|
||||||
characterChildRemovedCon =
|
characterChildRemovedCon:disconnect()
|
||||||
game.Players.LocalPlayer.Character.ChildRemoved:connect(function(child)
|
end
|
||||||
updateGridActive()
|
characterChildRemovedCon = game.Players.LocalPlayer.Character.ChildRemoved:connect(function(_)
|
||||||
end)
|
updateGridActive()
|
||||||
|
end)
|
||||||
|
|
||||||
wait()
|
wait()
|
||||||
centerGear(currentLoadout:GetChildren())
|
centerGear(currentLoadout:GetChildren())
|
||||||
end
|
end
|
||||||
|
|
||||||
function removeCharacterConnections()
|
function removeCharacterConnections()
|
||||||
if characterChildAddedCon then characterChildAddedCon:disconnect() end
|
if characterChildAddedCon then
|
||||||
if characterChildRemovedCon then characterChildRemovedCon:disconnect() end
|
characterChildAddedCon:disconnect()
|
||||||
if backpackAddCon then backpackAddCon:disconnect() end
|
end
|
||||||
|
if characterChildRemovedCon then
|
||||||
|
characterChildRemovedCon:disconnect()
|
||||||
|
end
|
||||||
|
if backpackAddCon then
|
||||||
|
backpackAddCon:disconnect()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function trim(s)
|
function trim(s)
|
||||||
return (s:gsub("^%s*(.-)%s*$", "%1"))
|
return (s:gsub("^%s*(.-)%s*$", "%1"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function filterGear(terms)
|
function filterGear(terms)
|
||||||
local filteredGear = {}
|
local filteredGear = {}
|
||||||
for k,v in pairs(backpackItems) do
|
for k, v in pairs(backpackItems) do
|
||||||
if buttons[v] then
|
if buttons[v] then
|
||||||
local gearString = string.lower(buttons[v].GearReference.Value.Name)
|
local gearString = string.lower(buttons[v].GearReference.Value.Name)
|
||||||
gearString = trim(gearString)
|
gearString = trim(gearString)
|
||||||
for i = 1, #terms do
|
for i = 1, #terms do
|
||||||
if string.match(gearString,terms[i]) then
|
if string.match(gearString, terms[i]) then
|
||||||
table.insert(filteredGear,buttons[v])
|
table.insert(filteredGear, buttons[v])
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -594,18 +646,22 @@ function filterGear(terms)
|
||||||
return filteredGear
|
return filteredGear
|
||||||
end
|
end
|
||||||
function splitByWhitespace(text)
|
function splitByWhitespace(text)
|
||||||
if type(text) ~= "string" then return nil end
|
if type(text) ~= "string" then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
local terms = {}
|
local terms = {}
|
||||||
for token in string.gmatch(text, "[^%s]+") do
|
for token in string.gmatch(text, "[^%s]+") do
|
||||||
if string.len(token) > 0 then
|
if string.len(token) > 0 then
|
||||||
table.insert(terms,token)
|
table.insert(terms, token)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return terms
|
return terms
|
||||||
end
|
end
|
||||||
function showSearchGear(searchTerms)
|
function showSearchGear(searchTerms)
|
||||||
if not backpack.Gear.Visible then return end -- currently not active tab
|
if not backpack.Gear.Visible then
|
||||||
|
return
|
||||||
|
end -- currently not active tab
|
||||||
|
|
||||||
local searchTermTable = splitByWhitespace(searchTerms)
|
local searchTermTable = splitByWhitespace(searchTerms)
|
||||||
if searchTermTable and (#searchTermTable > 0) then
|
if searchTermTable and (#searchTermTable > 0) then
|
||||||
|
|
@ -639,15 +695,15 @@ function nukeBackpack()
|
||||||
end
|
end
|
||||||
|
|
||||||
function getGearContextMenu()
|
function getGearContextMenu()
|
||||||
local gearContextMenu = Instance.new("Frame")
|
local gearContextMenu = Instance.new "Frame"
|
||||||
gearContextMenu.Active = true
|
gearContextMenu.Active = true
|
||||||
gearContextMenu.Name = "UnequipContextMenu"
|
gearContextMenu.Name = "UnequipContextMenu"
|
||||||
gearContextMenu.Size = UDim2.new(0,115,0,70)
|
gearContextMenu.Size = UDim2.new(0, 115, 0, 70)
|
||||||
gearContextMenu.Position = UDim2.new(0,-16,0,-16)
|
gearContextMenu.Position = UDim2.new(0, -16, 0, -16)
|
||||||
gearContextMenu.BackgroundTransparency = 1
|
gearContextMenu.BackgroundTransparency = 1
|
||||||
gearContextMenu.Visible = false
|
gearContextMenu.Visible = false
|
||||||
|
|
||||||
local gearContextMenuButton = Instance.new("TextButton")
|
local gearContextMenuButton = Instance.new "TextButton"
|
||||||
gearContextMenuButton.Name = "UnequipContextMenuButton"
|
gearContextMenuButton.Name = "UnequipContextMenuButton"
|
||||||
gearContextMenuButton.Text = ""
|
gearContextMenuButton.Text = ""
|
||||||
gearContextMenuButton.Style = Enum.ButtonStyle.RobloxButtonDefault
|
gearContextMenuButton.Style = Enum.ButtonStyle.RobloxButtonDefault
|
||||||
|
|
@ -659,7 +715,7 @@ function getGearContextMenu()
|
||||||
local elementHeight = 12
|
local elementHeight = 12
|
||||||
|
|
||||||
local contextMenuElements = {}
|
local contextMenuElements = {}
|
||||||
local contextMenuElementsName = {"Remove Hotkey"}
|
local contextMenuElementsName = { "Remove Hotkey" }
|
||||||
|
|
||||||
for i = 1, #contextMenuElementsName do
|
for i = 1, #contextMenuElementsName do
|
||||||
local element = {}
|
local element = {}
|
||||||
|
|
@ -667,31 +723,32 @@ function getGearContextMenu()
|
||||||
element.Text = contextMenuElementsName[i]
|
element.Text = contextMenuElementsName[i]
|
||||||
element.Action = i
|
element.Action = i
|
||||||
element.DoIt = UnequipGearMenuClick
|
element.DoIt = UnequipGearMenuClick
|
||||||
table.insert(contextMenuElements,element)
|
table.insert(contextMenuElements, element)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i, contextElement in ipairs(contextMenuElements) do
|
for i, contextElement in ipairs(contextMenuElements) do
|
||||||
local element = contextElement
|
local element = contextElement
|
||||||
if element.Type == "Button" then
|
if element.Type == "Button" then
|
||||||
local button = Instance.new("TextButton")
|
local button = Instance.new "TextButton"
|
||||||
button.Name = "UnequipContextButton" .. i
|
button.Name = "UnequipContextButton" .. i
|
||||||
button.BackgroundColor3 = Color3.new(0,0,0)
|
button.BackgroundColor3 = Color3.new(0, 0, 0)
|
||||||
button.BorderSizePixel = 0
|
button.BorderSizePixel = 0
|
||||||
button.TextXAlignment = Enum.TextXAlignment.Left
|
button.TextXAlignment = Enum.TextXAlignment.Left
|
||||||
button.Text = " " .. contextElement.Text
|
button.Text = " " .. contextElement.Text
|
||||||
button.Font = Enum.Font.Arial
|
button.Font = Enum.Font.Arial
|
||||||
button.FontSize = Enum.FontSize.Size14
|
button.FontSize = Enum.FontSize.Size14
|
||||||
button.Size = UDim2.new(1, 8, 0, elementHeight)
|
button.Size = UDim2.new(1, 8, 0, elementHeight)
|
||||||
button.Position = UDim2.new(0,0,0,elementHeight * i)
|
button.Position = UDim2.new(0, 0, 0, elementHeight * i)
|
||||||
button.TextColor3 = Color3.new(1,1,1)
|
button.TextColor3 = Color3.new(1, 1, 1)
|
||||||
button.ZIndex = 9
|
button.ZIndex = 9
|
||||||
button.Parent = gearContextMenuButton
|
button.Parent = gearContextMenuButton
|
||||||
|
|
||||||
if not IsTouchDevice() then
|
if not IsTouchDevice() then
|
||||||
|
|
||||||
button.MouseButton1Click:connect(function()
|
button.MouseButton1Click:connect(function()
|
||||||
if button.Active and not gearContextMenu.Parent.Active then
|
if button.Active and not gearContextMenu.Parent.Active then
|
||||||
local success, result = pcall(function() element.DoIt(element, gearContextMenu) end)
|
pcall(function()
|
||||||
|
element.DoIt(element, gearContextMenu)
|
||||||
|
end)
|
||||||
browsingMenu = false
|
browsingMenu = false
|
||||||
gearContextMenu.Visible = false
|
gearContextMenu.Visible = false
|
||||||
clearHighlight(button)
|
clearHighlight(button)
|
||||||
|
|
@ -714,45 +771,45 @@ function getGearContextMenu()
|
||||||
contextElement.Button = button
|
contextElement.Button = button
|
||||||
contextElement.Element = button
|
contextElement.Element = button
|
||||||
elseif element.Type == "Label" then
|
elseif element.Type == "Label" then
|
||||||
local frame = Instance.new("Frame")
|
local frame = Instance.new "Frame"
|
||||||
frame.Name = "ContextLabel" .. i
|
frame.Name = "ContextLabel" .. i
|
||||||
frame.BackgroundTransparency = 1
|
frame.BackgroundTransparency = 1
|
||||||
frame.Size = UDim2.new(1, 8, 0, elementHeight)
|
frame.Size = UDim2.new(1, 8, 0, elementHeight)
|
||||||
|
|
||||||
local label = Instance.new("TextLabel")
|
local label = Instance.new "TextLabel"
|
||||||
label.Name = "Text1"
|
label.Name = "Text1"
|
||||||
label.BackgroundTransparency = 1
|
label.BackgroundTransparency = 1
|
||||||
label.BackgroundColor3 = Color3.new(1,1,1)
|
label.BackgroundColor3 = Color3.new(1, 1, 1)
|
||||||
label.BorderSizePixel = 0
|
label.BorderSizePixel = 0
|
||||||
label.TextXAlignment = Enum.TextXAlignment.Left
|
label.TextXAlignment = Enum.TextXAlignment.Left
|
||||||
label.Font = Enum.Font.ArialBold
|
label.Font = Enum.Font.ArialBold
|
||||||
label.FontSize = Enum.FontSize.Size14
|
label.FontSize = Enum.FontSize.Size14
|
||||||
label.Position = UDim2.new(0.0, 0, 0, 0)
|
label.Position = UDim2.new(0, 0, 0, 0)
|
||||||
label.Size = UDim2.new(0.5, 0, 1, 0)
|
label.Size = UDim2.new(0.5, 0, 1, 0)
|
||||||
label.TextColor3 = Color3.new(1,1,1)
|
label.TextColor3 = Color3.new(1, 1, 1)
|
||||||
label.ZIndex = 9
|
label.ZIndex = 9
|
||||||
label.Parent = frame
|
label.Parent = frame
|
||||||
element.Label1 = label
|
element.Label1 = label
|
||||||
|
|
||||||
if element.GetText2 then
|
if element.GetText2 then
|
||||||
label = Instance.new("TextLabel")
|
label = Instance.new "TextLabel"
|
||||||
label.Name = "Text2"
|
label.Name = "Text2"
|
||||||
label.BackgroundTransparency = 1
|
label.BackgroundTransparency = 1
|
||||||
label.BackgroundColor3 = Color3.new(1,1,1)
|
label.BackgroundColor3 = Color3.new(1, 1, 1)
|
||||||
label.BorderSizePixel = 0
|
label.BorderSizePixel = 0
|
||||||
label.TextXAlignment = Enum.TextXAlignment.Right
|
label.TextXAlignment = Enum.TextXAlignment.Right
|
||||||
label.Font = Enum.Font.Arial
|
label.Font = Enum.Font.Arial
|
||||||
label.FontSize = Enum.FontSize.Size14
|
label.FontSize = Enum.FontSize.Size14
|
||||||
label.Position = UDim2.new(0.5, 0, 0, 0)
|
label.Position = UDim2.new(0.5, 0, 0, 0)
|
||||||
label.Size = UDim2.new(0.5, 0, 1, 0)
|
label.Size = UDim2.new(0.5, 0, 1, 0)
|
||||||
label.TextColor3 = Color3.new(1,1,1)
|
label.TextColor3 = Color3.new(1, 1, 1)
|
||||||
label.ZIndex = 9
|
label.ZIndex = 9
|
||||||
label.Parent = frame
|
label.Parent = frame
|
||||||
element.Label2 = label
|
element.Label2 = label
|
||||||
end
|
end
|
||||||
frame.Parent = gearContextMenuButton
|
frame.Parent = gearContextMenuButton
|
||||||
element.Label = frame
|
element.Label = frame
|
||||||
element.Element = frame
|
element.Element = frame
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -767,7 +824,7 @@ function getGearContextMenu()
|
||||||
return gearContextMenu
|
return gearContextMenu
|
||||||
end
|
end
|
||||||
|
|
||||||
function coreGuiChanged(coreGuiType,enabled)
|
function coreGuiChanged(coreGuiType, enabled)
|
||||||
if coreGuiType == Enum.CoreGuiType.Backpack or coreGuiType == Enum.CoreGuiType.All then
|
if coreGuiType == Enum.CoreGuiType.Backpack or coreGuiType == Enum.CoreGuiType.All then
|
||||||
if not enabled then
|
if not enabled then
|
||||||
backpack.Gear.Visible = false
|
backpack.Gear.Visible = false
|
||||||
|
|
@ -775,7 +832,6 @@ function coreGuiChanged(coreGuiType,enabled)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local backpackChildren = player.Backpack:GetChildren()
|
local backpackChildren = player.Backpack:GetChildren()
|
||||||
for i = 1, #backpackChildren do
|
for i = 1, #backpackChildren do
|
||||||
addToGrid(backpackChildren[i])
|
addToGrid(backpackChildren[i])
|
||||||
|
|
@ -783,9 +839,10 @@ end
|
||||||
|
|
||||||
------------------------- Start Lifelong Connections -----------------------
|
------------------------- Start Lifelong Connections -----------------------
|
||||||
|
|
||||||
|
resizeEvent.Event:connect(function(_)
|
||||||
resizeEvent.Event:connect(function(absSize)
|
if debounce then
|
||||||
if debounce then return end
|
return
|
||||||
|
end
|
||||||
|
|
||||||
debounce = true
|
debounce = true
|
||||||
wait()
|
wait()
|
||||||
|
|
@ -794,35 +851,49 @@ resizeEvent.Event:connect(function(absSize)
|
||||||
debounce = false
|
debounce = false
|
||||||
end)
|
end)
|
||||||
|
|
||||||
currentLoadout.ChildAdded:connect(function(child) loadoutCheck(child, false) end)
|
currentLoadout.ChildAdded:connect(function(child)
|
||||||
currentLoadout.ChildRemoved:connect(function(child) loadoutCheck(child, true) end)
|
loadoutCheck(child, false)
|
||||||
|
end)
|
||||||
|
currentLoadout.ChildRemoved:connect(function(child)
|
||||||
|
loadoutCheck(child, true)
|
||||||
|
end)
|
||||||
|
|
||||||
currentLoadout.DescendantAdded:connect(function(descendant)
|
currentLoadout.DescendantAdded:connect(function(descendant)
|
||||||
if not backpack.Visible and ( descendant:IsA("ImageButton") or descendant:IsA("TextButton") ) then
|
if not backpack.Visible and (descendant:IsA "ImageButton" or descendant:IsA "TextButton") then
|
||||||
centerGear(currentLoadout:GetChildren())
|
centerGear(currentLoadout:GetChildren())
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
currentLoadout.DescendantRemoving:connect(function(descendant)
|
currentLoadout.DescendantRemoving:connect(function(descendant)
|
||||||
if not backpack.Visible and ( descendant:IsA("ImageButton") or descendant:IsA("TextButton") ) then
|
if not backpack.Visible and (descendant:IsA "ImageButton" or descendant:IsA "TextButton") then
|
||||||
wait()
|
wait()
|
||||||
centerGear(currentLoadout:GetChildren())
|
centerGear(currentLoadout:GetChildren())
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
grid.MouseEnter:connect(function() clearPreview() end)
|
grid.MouseEnter:connect(function()
|
||||||
grid.MouseLeave:connect(function() clearPreview() end)
|
clearPreview()
|
||||||
|
end)
|
||||||
|
grid.MouseLeave:connect(function()
|
||||||
|
clearPreview()
|
||||||
|
end)
|
||||||
|
|
||||||
player.CharacterRemoving:connect(function()
|
player.CharacterRemoving:connect(function()
|
||||||
removeCharacterConnections()
|
removeCharacterConnections()
|
||||||
nukeBackpack()
|
nukeBackpack()
|
||||||
end)
|
end)
|
||||||
player.CharacterAdded:connect(function() setupCharacterConnections() end)
|
player.CharacterAdded:connect(function()
|
||||||
|
setupCharacterConnections()
|
||||||
|
end)
|
||||||
|
|
||||||
player.ChildAdded:connect(function(child)
|
player.ChildAdded:connect(function(child)
|
||||||
if child:IsA("Backpack") then
|
if child:IsA "Backpack" then
|
||||||
playerBackpack = child
|
playerBackpack = child
|
||||||
if backpackAddCon then backpackAddCon:disconnect() end
|
if backpackAddCon then
|
||||||
backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded:connect(function(child) addToGrid(child) end)
|
backpackAddCon:disconnect()
|
||||||
|
end
|
||||||
|
backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded:connect(function(child)
|
||||||
|
addToGrid(child)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
@ -834,7 +905,7 @@ end)
|
||||||
|
|
||||||
local loadoutChildren = currentLoadout:GetChildren()
|
local loadoutChildren = currentLoadout:GetChildren()
|
||||||
for i = 1, #loadoutChildren do
|
for i = 1, #loadoutChildren do
|
||||||
if loadoutChildren[i]:IsA("Frame") and string.find(loadoutChildren[i].Name,"Slot") then
|
if loadoutChildren[i]:IsA "Frame" and string.find(loadoutChildren[i].Name, "Slot") then
|
||||||
loadoutChildren[i].ChildRemoved:connect(function()
|
loadoutChildren[i].ChildRemoved:connect(function()
|
||||||
updateGridActive()
|
updateGridActive()
|
||||||
end)
|
end)
|
||||||
|
|
@ -858,14 +929,18 @@ local loadoutChildren = currentLoadout:GetChildren()
|
||||||
for i = 1, #loadoutChildren do
|
for i = 1, #loadoutChildren do
|
||||||
loadoutCheck(loadoutChildren[i], false)
|
loadoutCheck(loadoutChildren[i], false)
|
||||||
end
|
end
|
||||||
if not backpack.Visible then centerGear(currentLoadout:GetChildren()) end
|
if not backpack.Visible then
|
||||||
|
centerGear(currentLoadout:GetChildren())
|
||||||
|
end
|
||||||
|
|
||||||
-- make sure that inventory is listening to gear reparenting
|
-- make sure that inventory is listening to gear reparenting
|
||||||
if characterChildAddedCon == nil and game.Players.LocalPlayer["Character"] then
|
if characterChildAddedCon == nil and game.Players.LocalPlayer["Character"] then
|
||||||
setupCharacterConnections()
|
setupCharacterConnections()
|
||||||
end
|
end
|
||||||
if not backpackAddCon then
|
if not backpackAddCon then
|
||||||
backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded:connect(function(child) addToGrid(child) end)
|
backpackAddCon = game.Players.LocalPlayer.Backpack.ChildAdded:connect(function(child)
|
||||||
|
addToGrid(child)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
backpackOpenEvent.Event:connect(backpackOpenHandler)
|
backpackOpenEvent.Event:connect(backpackOpenHandler)
|
||||||
|
|
|
||||||
200
89449093.lua
200
89449093.lua
|
|
@ -1,5 +1,7 @@
|
||||||
-- This script manages context switches in the backpack (Gear to Wardrobe, etc.) and player state changes. Also manages global functions across different tabs (currently only search)
|
-- This script manages context switches in the backpack (Gear to Wardrobe, etc.) and player state changes. Also manages global functions across different tabs (currently only search)
|
||||||
if game.CoreGui.Version < 7 then return end -- peace out if we aren't using the right client
|
if game.CoreGui.Version < 7 then
|
||||||
|
return
|
||||||
|
end -- peace out if we aren't using the right client
|
||||||
|
|
||||||
-- basic functions
|
-- basic functions
|
||||||
local function waitForChild(instance, name)
|
local function waitForChild(instance, name)
|
||||||
|
|
@ -15,23 +17,21 @@ local function waitForProperty(instance, property)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- don't do anything if we are in an empty game
|
-- don't do anything if we are in an empty game
|
||||||
waitForChild(game,"Players")
|
waitForChild(game, "Players")
|
||||||
if #game.Players:GetChildren() < 1 then
|
if #game.Players:GetChildren() < 1 then
|
||||||
game.Players.ChildAdded:wait()
|
game.Players.ChildAdded:wait()
|
||||||
end
|
end
|
||||||
-- make sure everything is loaded in before we do anything
|
-- make sure everything is loaded in before we do anything
|
||||||
-- get our local player
|
-- get our local player
|
||||||
waitForProperty(game.Players,"LocalPlayer")
|
waitForProperty(game.Players, "LocalPlayer")
|
||||||
local player = game.Players.LocalPlayer
|
local player = game.Players.LocalPlayer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
------------------------ Locals ------------------------------
|
------------------------ Locals ------------------------------
|
||||||
local backpack = script.Parent
|
local backpack = script.Parent
|
||||||
waitForChild(backpack,"Gear")
|
waitForChild(backpack, "Gear")
|
||||||
|
|
||||||
local screen = script.Parent.Parent
|
local screen = script.Parent.Parent
|
||||||
assert(screen:IsA("ScreenGui"))
|
assert(screen:IsA "ScreenGui")
|
||||||
|
|
||||||
waitForChild(backpack, "Tabs")
|
waitForChild(backpack, "Tabs")
|
||||||
waitForChild(backpack.Tabs, "CloseButton")
|
waitForChild(backpack.Tabs, "CloseButton")
|
||||||
|
|
@ -43,19 +43,19 @@ if game.CoreGui.Version >= 8 then
|
||||||
waitForChild(backpack.Tabs, "WardrobeButton")
|
waitForChild(backpack.Tabs, "WardrobeButton")
|
||||||
local wardrobeButton = backpack.Tabs.WardrobeButton
|
local wardrobeButton = backpack.Tabs.WardrobeButton
|
||||||
end
|
end
|
||||||
waitForChild(backpack.Parent,"ControlFrame")
|
waitForChild(backpack.Parent, "ControlFrame")
|
||||||
local backpackButton = waitForChild(backpack.Parent.ControlFrame,"BackpackButton")
|
local backpackButton = waitForChild(backpack.Parent.ControlFrame, "BackpackButton")
|
||||||
local currentTab = "gear"
|
local currentTab = "gear"
|
||||||
|
|
||||||
local searchFrame = waitForChild(backpack,"SearchFrame")
|
local searchFrame = waitForChild(backpack, "SearchFrame")
|
||||||
waitForChild(backpack.SearchFrame,"SearchBoxFrame")
|
waitForChild(backpack.SearchFrame, "SearchBoxFrame")
|
||||||
local searchBox = waitForChild(backpack.SearchFrame.SearchBoxFrame,"SearchBox")
|
local searchBox = waitForChild(backpack.SearchFrame.SearchBoxFrame, "SearchBox")
|
||||||
local searchButton = waitForChild(backpack.SearchFrame,"SearchButton")
|
local searchButton = waitForChild(backpack.SearchFrame, "SearchButton")
|
||||||
local resetButton = waitForChild(backpack.SearchFrame,"ResetButton")
|
local resetButton = waitForChild(backpack.SearchFrame, "ResetButton")
|
||||||
|
|
||||||
local robloxGui = waitForChild(Game.CoreGui, 'RobloxGui')
|
local robloxGui = waitForChild(Game.CoreGui, "RobloxGui")
|
||||||
local currentLoadout = waitForChild(robloxGui, 'CurrentLoadout')
|
local currentLoadout = waitForChild(robloxGui, "CurrentLoadout")
|
||||||
local loadoutBackground = waitForChild(currentLoadout, 'Background')
|
local loadoutBackground = waitForChild(currentLoadout, "Background")
|
||||||
|
|
||||||
local canToggle = true
|
local canToggle = true
|
||||||
local readyForNextEvent = true
|
local readyForNextEvent = true
|
||||||
|
|
@ -79,17 +79,15 @@ if robloxGui.AbsoluteSize.Y <= 320 then
|
||||||
backpackSize = UDim2.new(0, 200, 0, 140)
|
backpackSize = UDim2.new(0, 200, 0, 140)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
------------------------ End Locals ---------------------------
|
------------------------ End Locals ---------------------------
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------- Public Event Setup ----------------------------------------
|
---------------------------------------- Public Event Setup ----------------------------------------
|
||||||
|
|
||||||
function createPublicEvent(eventName)
|
function createPublicEvent(eventName)
|
||||||
assert(eventName, "eventName is nil")
|
assert(eventName, "eventName is nil")
|
||||||
assert(tostring(eventName),"eventName is not a string")
|
assert(tostring(eventName), "eventName is not a string")
|
||||||
|
|
||||||
local newEvent = Instance.new("BindableEvent")
|
local newEvent = Instance.new "BindableEvent"
|
||||||
newEvent.Name = tostring(eventName)
|
newEvent.Name = tostring(eventName)
|
||||||
newEvent.Parent = script
|
newEvent.Parent = script
|
||||||
|
|
||||||
|
|
@ -102,7 +100,7 @@ function createPublicFunction(funcName, invokeFunc)
|
||||||
assert(invokeFunc, "invokeFunc is nil")
|
assert(invokeFunc, "invokeFunc is nil")
|
||||||
assert(type(invokeFunc) == "function", "invokeFunc should be of type 'function'")
|
assert(type(invokeFunc) == "function", "invokeFunc should be of type 'function'")
|
||||||
|
|
||||||
local newFunction = Instance.new("BindableFunction")
|
local newFunction = Instance.new "BindableFunction"
|
||||||
newFunction.Name = tostring(funcName)
|
newFunction.Name = tostring(funcName)
|
||||||
newFunction.OnInvoke = invokeFunc
|
newFunction.OnInvoke = invokeFunc
|
||||||
newFunction.Parent = script
|
newFunction.Parent = script
|
||||||
|
|
@ -111,15 +109,13 @@ function createPublicFunction(funcName, invokeFunc)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Events
|
-- Events
|
||||||
local resizeEvent = createPublicEvent("ResizeEvent")
|
local resizeEvent = createPublicEvent "ResizeEvent"
|
||||||
local backpackOpenEvent = createPublicEvent("BackpackOpenEvent")
|
local backpackOpenEvent = createPublicEvent "BackpackOpenEvent"
|
||||||
local backpackCloseEvent = createPublicEvent("BackpackCloseEvent")
|
local backpackCloseEvent = createPublicEvent "BackpackCloseEvent"
|
||||||
local tabClickedEvent = createPublicEvent("TabClickedEvent")
|
local tabClickedEvent = createPublicEvent "TabClickedEvent"
|
||||||
local searchRequestedEvent = createPublicEvent("SearchRequestedEvent")
|
local searchRequestedEvent = createPublicEvent "SearchRequestedEvent"
|
||||||
---------------------------------------- End Public Event Setup ----------------------------------------
|
---------------------------------------- End Public Event Setup ----------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------------------- Internal Functions ----------------------------------------
|
--------------------------- Internal Functions ----------------------------------------
|
||||||
|
|
||||||
function deactivateBackpack()
|
function deactivateBackpack()
|
||||||
|
|
@ -140,8 +136,8 @@ function initHumanoidDiedConnections()
|
||||||
if humanoidDiedCon then
|
if humanoidDiedCon then
|
||||||
humanoidDiedCon:disconnect()
|
humanoidDiedCon:disconnect()
|
||||||
end
|
end
|
||||||
waitForProperty(game.Players.LocalPlayer,"Character")
|
waitForProperty(game.Players.LocalPlayer, "Character")
|
||||||
waitForChild(game.Players.LocalPlayer.Character,"Humanoid")
|
waitForChild(game.Players.LocalPlayer.Character, "Humanoid")
|
||||||
humanoidDiedCon = game.Players.LocalPlayer.Character.Humanoid.Died:connect(deactivateBackpack)
|
humanoidDiedCon = game.Players.LocalPlayer.Character.Humanoid.Died:connect(deactivateBackpack)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -153,13 +149,20 @@ local hideBackpack = function()
|
||||||
backpackCloseEvent:Fire(currentTab)
|
backpackCloseEvent:Fire(currentTab)
|
||||||
backpack.Tabs.Visible = false
|
backpack.Tabs.Visible = false
|
||||||
searchFrame.Visible = false
|
searchFrame.Visible = false
|
||||||
backpack:TweenSizeAndPosition(UDim2.new(0, backpackSize.X.Offset,0, 0), UDim2.new(0.5, -backpackSize.X.Offset/2, 1, -85), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, guiTweenSpeed, true,
|
backpack:TweenSizeAndPosition(
|
||||||
|
UDim2.new(0, backpackSize.X.Offset, 0, 0),
|
||||||
|
UDim2.new(0.5, -backpackSize.X.Offset / 2, 1, -85),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quad,
|
||||||
|
guiTweenSpeed,
|
||||||
|
true,
|
||||||
function()
|
function()
|
||||||
game.GuiService:RemoveCenterDialog(backpack)
|
game.GuiService:RemoveCenterDialog(backpack)
|
||||||
backpack.Visible = false
|
backpack.Visible = false
|
||||||
backpackButton.Selected = false
|
backpackButton.Selected = false
|
||||||
end)
|
end
|
||||||
delay(guiTweenSpeed,function()
|
)
|
||||||
|
delay(guiTweenSpeed, function()
|
||||||
game.GuiService:RemoveCenterDialog(backpack)
|
game.GuiService:RemoveCenterDialog(backpack)
|
||||||
backpack.Visible = false
|
backpack.Visible = false
|
||||||
backpackButton.Selected = false
|
backpackButton.Selected = false
|
||||||
|
|
@ -169,41 +172,54 @@ local hideBackpack = function()
|
||||||
end
|
end
|
||||||
|
|
||||||
function showBackpack()
|
function showBackpack()
|
||||||
game.GuiService:AddCenterDialog(backpack, Enum.CenterDialogType.PlayerInitiatedDialog,
|
game.GuiService:AddCenterDialog(backpack, Enum.CenterDialogType.PlayerInitiatedDialog, function()
|
||||||
function()
|
backpack.Visible = true
|
||||||
backpack.Visible = true
|
backpackButton.Selected = true
|
||||||
backpackButton.Selected = true
|
end, function()
|
||||||
end,
|
backpack.Visible = false
|
||||||
function()
|
backpackButton.Selected = false
|
||||||
backpack.Visible = false
|
|
||||||
backpackButton.Selected = false
|
|
||||||
end)
|
end)
|
||||||
backpack.Visible = true
|
backpack.Visible = true
|
||||||
backpackButton.Selected = true
|
backpackButton.Selected = true
|
||||||
backpack:TweenSizeAndPosition(backpackSize, UDim2.new(0.5, -backpackSize.X.Offset/2, 1, -backpackSize.Y.Offset - 88), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, guiTweenSpeed, true)
|
backpack:TweenSizeAndPosition(
|
||||||
delay(guiTweenSpeed,function()
|
backpackSize,
|
||||||
|
UDim2.new(0.5, -backpackSize.X.Offset / 2, 1, -backpackSize.Y.Offset - 88),
|
||||||
|
Enum.EasingDirection.Out,
|
||||||
|
Enum.EasingStyle.Quad,
|
||||||
|
guiTweenSpeed,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
delay(guiTweenSpeed, function()
|
||||||
backpack.Tabs.Visible = false
|
backpack.Tabs.Visible = false
|
||||||
searchFrame.Visible = true
|
searchFrame.Visible = true
|
||||||
backpackOpenEvent:Fire(currentTab)
|
backpackOpenEvent:Fire(currentTab)
|
||||||
canToggle = true
|
canToggle = true
|
||||||
readyForNextEvent = true
|
readyForNextEvent = true
|
||||||
backpackButton.Image = 'http://www.roblox.com/asset/?id=97644093'
|
backpackButton.Image = "http://www.roblox.com/asset/?id=97644093"
|
||||||
backpackButton.Position = UDim2.new(0.5, -60, 1, -backpackSize.Y.Offset - 103)
|
backpackButton.Position = UDim2.new(0.5, -60, 1, -backpackSize.Y.Offset - 103)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function toggleBackpack()
|
function toggleBackpack()
|
||||||
if not game.Players.LocalPlayer then return end
|
if not game.Players.LocalPlayer then
|
||||||
if not game.Players.LocalPlayer["Character"] then return end
|
return
|
||||||
if not canToggle then return end
|
end
|
||||||
if not readyForNextEvent then return end
|
if not game.Players.LocalPlayer["Character"] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not canToggle then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not readyForNextEvent then
|
||||||
|
return
|
||||||
|
end
|
||||||
readyForNextEvent = false
|
readyForNextEvent = false
|
||||||
canToggle = false
|
canToggle = false
|
||||||
|
|
||||||
backpackIsOpen = not backpackIsOpen
|
backpackIsOpen = not backpackIsOpen
|
||||||
|
|
||||||
if backpackIsOpen then
|
if backpackIsOpen then
|
||||||
loadoutBackground.Image = 'http://www.roblox.com/asset/?id=97623721'
|
loadoutBackground.Image = "http://www.roblox.com/asset/?id=97623721"
|
||||||
loadoutBackground.Position = UDim2.new(-0.03, 0, -0.17, 0)
|
loadoutBackground.Position = UDim2.new(-0.03, 0, -0.17, 0)
|
||||||
loadoutBackground.Size = UDim2.new(1.05, 0, 1.25, 0)
|
loadoutBackground.Size = UDim2.new(1.05, 0, 1.25, 0)
|
||||||
loadoutBackground.ZIndex = 2.0
|
loadoutBackground.ZIndex = 2.0
|
||||||
|
|
@ -214,21 +230,20 @@ function toggleBackpack()
|
||||||
loadoutBackground.Visible = false
|
loadoutBackground.Visible = false
|
||||||
backpackButton.Selected = false
|
backpackButton.Selected = false
|
||||||
backpackButton.Image = "http://www.roblox.com/asset/?id=97617958"
|
backpackButton.Image = "http://www.roblox.com/asset/?id=97617958"
|
||||||
loadoutBackground.Image = 'http://www.roblox.com/asset/?id=96536002'
|
loadoutBackground.Image = "http://www.roblox.com/asset/?id=96536002"
|
||||||
loadoutBackground.Position = UDim2.new(-0.1, 0, -0.1, 0)
|
loadoutBackground.Position = UDim2.new(-0.1, 0, -0.1, 0)
|
||||||
loadoutBackground.Size = UDim2.new(1.2, 0, 1.2, 0)
|
loadoutBackground.Size = UDim2.new(1.2, 0, 1.2, 0)
|
||||||
hideBackpack()
|
hideBackpack()
|
||||||
|
|
||||||
|
|
||||||
local clChildren = currentLoadout:GetChildren()
|
local clChildren = currentLoadout:GetChildren()
|
||||||
for i = 1, #clChildren do
|
for i = 1, #clChildren do
|
||||||
if clChildren[i] and clChildren[i]:IsA('Frame') then
|
if clChildren[i] and clChildren[i]:IsA "Frame" then
|
||||||
local frame = clChildren[i]
|
local frame = clChildren[i]
|
||||||
if #frame:GetChildren() > 0 then
|
if #frame:GetChildren() > 0 then
|
||||||
backpackButton.Position = UDim2.new(0.5, -60, 1, -108)
|
backpackButton.Position = UDim2.new(0.5, -60, 1, -108)
|
||||||
backpackButton.Visible = true
|
backpackButton.Visible = true
|
||||||
loadoutBackground.Visible = true
|
loadoutBackground.Visible = true
|
||||||
if frame:GetChildren()[1]:IsA('ImageButton') then
|
if frame:GetChildren()[1]:IsA "ImageButton" then
|
||||||
local imgButton = frame:GetChildren()[1]
|
local imgButton = frame:GetChildren()[1]
|
||||||
imgButton.Active = true
|
imgButton.Active = true
|
||||||
imgButton.Draggable = false
|
imgButton.Draggable = false
|
||||||
|
|
@ -236,7 +251,6 @@ function toggleBackpack()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -248,20 +262,20 @@ end
|
||||||
|
|
||||||
function setSelected(tab)
|
function setSelected(tab)
|
||||||
assert(tab)
|
assert(tab)
|
||||||
assert(tab:IsA("TextButton"))
|
assert(tab:IsA "TextButton")
|
||||||
|
|
||||||
tab.BackgroundColor3 = Color3.new(1,1,1)
|
tab.BackgroundColor3 = Color3.new(1, 1, 1)
|
||||||
tab.TextColor3 = Color3.new(0,0,0)
|
tab.TextColor3 = Color3.new(0, 0, 0)
|
||||||
tab.Selected = true
|
tab.Selected = true
|
||||||
tab.ZIndex = 3
|
tab.ZIndex = 3
|
||||||
end
|
end
|
||||||
|
|
||||||
function setUnselected(tab)
|
function setUnselected(tab)
|
||||||
assert(tab)
|
assert(tab)
|
||||||
assert(tab:IsA("TextButton"))
|
assert(tab:IsA "TextButton")
|
||||||
|
|
||||||
tab.BackgroundColor3 = Color3.new(0,0,0)
|
tab.BackgroundColor3 = Color3.new(0, 0, 0)
|
||||||
tab.TextColor3 = Color3.new(1,1,1)
|
tab.TextColor3 = Color3.new(1, 1, 1)
|
||||||
tab.Selected = false
|
tab.Selected = false
|
||||||
tab.ZIndex = 1
|
tab.ZIndex = 1
|
||||||
end
|
end
|
||||||
|
|
@ -280,20 +294,24 @@ end
|
||||||
|
|
||||||
function mouseLeaveTab(button)
|
function mouseLeaveTab(button)
|
||||||
assert(button)
|
assert(button)
|
||||||
assert(button:IsA("TextButton"))
|
assert(button:IsA "TextButton")
|
||||||
|
|
||||||
if button.Selected then return end
|
if button.Selected then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
button.BackgroundColor3 = Color3.new(0,0,0)
|
button.BackgroundColor3 = Color3.new(0, 0, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mouseOverTab(button)
|
function mouseOverTab(button)
|
||||||
assert(button)
|
assert(button)
|
||||||
assert(button:IsA("TextButton"))
|
assert(button:IsA "TextButton")
|
||||||
|
|
||||||
if button.Selected then return end
|
if button.Selected then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
button.BackgroundColor3 = Color3.new(39/255,39/255,39/255)
|
button.BackgroundColor3 = Color3.new(39 / 255, 39 / 255, 39 / 255)
|
||||||
end
|
end
|
||||||
|
|
||||||
function newTabClicked(tabName)
|
function newTabClicked(tabName)
|
||||||
|
|
@ -307,17 +325,19 @@ function newTabClicked(tabName)
|
||||||
end
|
end
|
||||||
|
|
||||||
function trim(s)
|
function trim(s)
|
||||||
return (s:gsub("^%s*(.-)%s*$", "%1"))
|
return (s:gsub("^%s*(.-)%s*$", "%1"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function splitByWhitespace(text)
|
function splitByWhitespace(text)
|
||||||
if type(text) ~= "string" then return nil end
|
if type(text) ~= "string" then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
local terms = {}
|
local terms = {}
|
||||||
for token in string.gmatch(text, "[^%s]+") do
|
for token in string.gmatch(text, "[^%s]+") do
|
||||||
if string.len(token) > 0 then
|
if string.len(token) > 0 then
|
||||||
table.insert(terms,token)
|
table.insert(terms, token)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return terms
|
return terms
|
||||||
end
|
end
|
||||||
|
|
@ -348,7 +368,7 @@ local backpackReady = function()
|
||||||
readyForNextEvent = true
|
readyForNextEvent = true
|
||||||
end
|
end
|
||||||
|
|
||||||
function coreGuiChanged(coreGuiType,enabled)
|
function coreGuiChanged(coreGuiType, enabled)
|
||||||
if coreGuiType == Enum.CoreGuiType.Backpack or coreGuiType == Enum.CoreGuiType.All then
|
if coreGuiType == Enum.CoreGuiType.Backpack or coreGuiType == Enum.CoreGuiType.All then
|
||||||
active = enabled
|
active = enabled
|
||||||
disabledByDeveloper = not enabled
|
disabledByDeveloper = not enabled
|
||||||
|
|
@ -374,13 +394,11 @@ end
|
||||||
|
|
||||||
--------------------------- End Internal Functions -------------------------------------
|
--------------------------- End Internal Functions -------------------------------------
|
||||||
|
|
||||||
|
|
||||||
------------------------------ Public Functions Setup -------------------------------------
|
------------------------------ Public Functions Setup -------------------------------------
|
||||||
createPublicFunction("CloseBackpack", hideBackpack)
|
createPublicFunction("CloseBackpack", hideBackpack)
|
||||||
createPublicFunction("BackpackReady", backpackReady)
|
createPublicFunction("BackpackReady", backpackReady)
|
||||||
------------------------------ End Public Functions Setup ---------------------------------
|
------------------------------ End Public Functions Setup ---------------------------------
|
||||||
|
|
||||||
|
|
||||||
------------------------ Connections/Script Main -------------------------------------------
|
------------------------ Connections/Script Main -------------------------------------------
|
||||||
|
|
||||||
pcall(function()
|
pcall(function()
|
||||||
|
|
@ -388,14 +406,26 @@ pcall(function()
|
||||||
Game.StarterGui.CoreGuiChangedSignal:connect(coreGuiChanged)
|
Game.StarterGui.CoreGuiChangedSignal:connect(coreGuiChanged)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
inventoryButton.MouseButton1Click:connect(function() newTabClicked("gear") end)
|
inventoryButton.MouseButton1Click:connect(function()
|
||||||
inventoryButton.MouseEnter:connect(function() mouseOverTab(inventoryButton) end)
|
newTabClicked "gear"
|
||||||
inventoryButton.MouseLeave:connect(function() mouseLeaveTab(inventoryButton) end)
|
end)
|
||||||
|
inventoryButton.MouseEnter:connect(function()
|
||||||
|
mouseOverTab(inventoryButton)
|
||||||
|
end)
|
||||||
|
inventoryButton.MouseLeave:connect(function()
|
||||||
|
mouseLeaveTab(inventoryButton)
|
||||||
|
end)
|
||||||
|
|
||||||
if game.CoreGui.Version >= 8 then
|
if game.CoreGui.Version >= 8 then
|
||||||
wardrobeButton.MouseButton1Click:connect(function() newTabClicked("wardrobe") end)
|
wardrobeButton.MouseButton1Click:connect(function()
|
||||||
wardrobeButton.MouseEnter:connect(function() mouseOverTab(wardrobeButton) end)
|
newTabClicked "wardrobe"
|
||||||
wardrobeButton.MouseLeave:connect(function() mouseLeaveTab(wardrobeButton) end)
|
end)
|
||||||
|
wardrobeButton.MouseEnter:connect(function()
|
||||||
|
mouseOverTab(wardrobeButton)
|
||||||
|
end)
|
||||||
|
wardrobeButton.MouseLeave:connect(function()
|
||||||
|
mouseLeaveTab(wardrobeButton)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
closeButton.MouseButton1Click:connect(closeBackpack)
|
closeButton.MouseButton1Click:connect(closeBackpack)
|
||||||
|
|
@ -410,13 +440,17 @@ end)
|
||||||
game:GetService("GuiService"):AddKey(tilde)
|
game:GetService("GuiService"):AddKey(tilde)
|
||||||
game:GetService("GuiService"):AddKey(backquote)
|
game:GetService("GuiService"):AddKey(backquote)
|
||||||
game:GetService("GuiService").KeyPressed:connect(function(key)
|
game:GetService("GuiService").KeyPressed:connect(function(key)
|
||||||
if not active or disabledByDeveloper then return end
|
if not active or disabledByDeveloper then
|
||||||
|
return
|
||||||
|
end
|
||||||
if key == tilde or key == backquote then
|
if key == tilde or key == backquote then
|
||||||
toggleBackpack()
|
toggleBackpack()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
backpackButton.MouseButton1Click:connect(function()
|
backpackButton.MouseButton1Click:connect(function()
|
||||||
if not active or disabledByDeveloper then return end
|
if not active or disabledByDeveloper then
|
||||||
|
return
|
||||||
|
end
|
||||||
toggleBackpack()
|
toggleBackpack()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
|
||||||
1733
97188756.lua
1733
97188756.lua
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1 @@
|
||||||
|
std = "mercury"
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
column_width = 120
|
||||||
|
line_endings = "Unix"
|
||||||
|
indent_type = "Tabs"
|
||||||
|
indent_width = 4
|
||||||
|
quote_style = "AutoPreferDouble"
|
||||||
|
call_parentheses = "None"
|
||||||
Loading…
Reference in New Issue