From 0cd83ccac7653a57d58971cb8e869bf07b329fde Mon Sep 17 00:00:00 2001 From: MuramasaM <107993352+MuramasaM@users.noreply.github.com> Date: Mon, 4 Jul 2022 13:51:03 -0700 Subject: [PATCH] New test cores --- public/asset/1 | 1 - public/asset/10 | 8 +- public/asset/11 | 4685 +++++++++++++++++++++++++--------------- public/asset/12 | 188 +- public/asset/13 | 77 +- public/asset/14 | 78 +- public/asset/15 | 225 +- public/asset/17 | 54 +- public/asset/20 | 2 +- public/asset/5 | 3924 ++++++++++++++++----------------- public/asset/7 | 2 +- public/asset/8 | 8 +- public/asset/9 | 285 +-- public/asset/index.php | 4 +- 14 files changed, 5324 insertions(+), 4217 deletions(-) diff --git a/public/asset/1 b/public/asset/1 index 4ab27cc..72ff10f 100644 --- a/public/asset/1 +++ b/public/asset/1 @@ -39,7 +39,6 @@ pcall(function() waitForProperty(game,"PlaceId") if game.PlaceId == deepakTestingPlace then scriptContext:AddCoreScript(52177626,screenGui,"RBXStatusBuffsGUIScript") - scriptContext:AddCoreScript(52177590,screenGui,"HealthScript v4.0") end end) diff --git a/public/asset/10 b/public/asset/10 index 201752e..0d7aeff 100644 --- a/public/asset/10 +++ b/public/asset/10 @@ -63,7 +63,7 @@ local hereText -- user facing images local assetUrls = {} -local assetUrl = "http://www.roblox.com/Asset/?id=" +local assetUrl = "http://www.morblox.us/Asset/?id=" local errorImageUrl = assetUrl .. "42557901" table.insert(assetUrls, errorImageUrl) local buyImageUrl = assetUrl .. "104651457" table.insert(assetUrls,buyImageUrl) local buyImageDownUrl = assetUrl .. "104651515" table.insert(assetUrls, buyImageDownUrl) @@ -661,9 +661,9 @@ function startSpinner() while pos < 8 do if pos == spinPos or pos == ((spinPos+1)%8) then - spinnerIcons[pos+1].Image = "http://www.roblox.com/Asset?id=45880668" + spinnerIcons[pos+1].Image = "http://www.morblox.us/Asset?id=45880668" else - spinnerIcons[pos+1].Image = "http://www.roblox.com/Asset?id=45880710" + spinnerIcons[pos+1].Image = "http://www.morblox.us/Asset?id=45880710" end pos = pos + 1 @@ -716,7 +716,7 @@ function createSpinner(size,position,parent) spinnerImage.Position = UDim2.new(.5+.3*math.cos(math.rad(45*spinnerNum)), -8, .5+.3*math.sin(math.rad(45*spinnerNum)), -8) spinnerImage.BackgroundTransparency = 1 spinnerImage.ZIndex = 10 - spinnerImage.Image = "http://www.roblox.com/Asset/?id=45880710" + spinnerImage.Image = "http://www.morblox.us/Asset/?id=45880710" spinnerImage.Parent = spinnerFrame spinnerIcons[spinnerNum] = spinnerImage diff --git a/public/asset/11 b/public/asset/11 index 87d19a1..d2dcc63 100644 --- a/public/asset/11 +++ b/public/asset/11 @@ -1,178 +1,1224 @@ -%11% -local RbxGui -local localTesting = true +--new playerlist by Zach Lindblad (fusroblox) +--contact him for any revisions/issues +-------------------- +-- Super Util +-------------------- -local screen = script.Parent -local screenResizeCon = nil +local ADMINS = +{ + thomas = 1, + morblox = 1, + conkley = 1, + josh = 1, + penguin = 1, + bagofdreams = 1, + template = 1, + AliMine8555 = 1, +} -local friendWord = "Friend" -local friendWordLowercase = "friend" +local Images = { + bottomDark = '94691904', + bottomLight = '94691940', + midDark = '94691980', + midLight = '94692025', + LargeDark = '96098866', + LargeLight = '96098920', + LargeHeader = '96097470', + NormalHeader = '94692054', + LargeBottom = '96397271', -- '96098152', + NormalBottom = '94754966', + DarkBluePopupMid = '97114905', + LightBluePopupMid = '97114905', + DarkPopupMid = '97112126', + LightPopupMid = '97109338', + DarkBluePopupTop = '97114838', + LightBluePopupTop = '', + DarkPopupTop = '', + LightPopupTop = '', + DarkBluePopupBottom = '97114758', + LightBluePopupBottom = '', + DarkPopupBottom = '100869219', + LightPopupBottom = '97109175', +} -local testFriendingPlaces = {} -testFriendingPlaces[41324860] = true -local enableFriendingGlobally = true -local testPlayerListPlaces = {} -testPlayerListPlaces[41324860] = true -testPlayerListPlaces[10042455] = true -local enablePlayerListGlobally = true - -local bigEasingStyle = Enum.EasingStyle.Back -local smallEasingStyle = Enum.EasingStyle.Quart -local lightBackground = true - -local function waitForChild(instance, name) - while not instance:FindFirstChild(name) do - instance.ChildAdded:wait() - end -end - -local function waitForProperty(instance, prop) - while not instance[prop] do - instance.Changed:wait() - end -end - -local function Color3I(r,g,b) - return Color3.new(r/255,g/255,b/255) -end - -function robloxLock(instance) - instance.RobloxLocked = true - children = instance:GetChildren() - if children then - for i, child in ipairs(children) do - robloxLock(child) - end - end -end - -function ArrayRemove(t, obj) - for i, obj2 in ipairs(t) do - if obj == obj2 then - table.remove(t, i) - return true - end - end - return false -end - -local function getPlayers() - local result = {} - local players = game:GetService("Players"):GetChildren() - if players then - for i, player in ipairs(players) do - if player:IsA("Player") then - table.insert(result, player) +--[[ + Generic object Create function, which I am using to create Gui's + Thanks to Stravant! +--]] +local Obj = {} +function Obj.Create(guiType) + return function(data) + local obj = Instance.new(guiType) + for k, v in pairs(data) do + if type(k) == 'number' then + v.Parent = obj + else + obj[k] = v end end + return obj end - return result +end + +--[[ + makes a full sized background for a guiobject + @Args: + imgName asset name of image to fill background + @Return: background gui object +--]] +function MakeBackgroundGuiObj(imgName) + return Obj.Create'ImageLabel' + { + Name = 'Background', + BackgroundTransparency = 1, + Image = imgName, + Position = UDim2.new(0, 0, 0, 0), + Size = UDim2.new(1,0,1,0), + } +end +--[[ turns 255 integer color value to a color3 --]] +function Color3I(r,g,b) + return Color3.new(r/255,g/255,b/255) end -local brickColorTable = {} -for i = 0, 63 do - brickColorTable[BrickColor.palette(i).Name] = BrickColor.palette(i).Color +--[[ + Gets correct icon for builder's club status to display by name + @Args: + membershipType Enum of membership status + @Return: string of image asset +--]] +function getMembershipTypeIcon(membershipType,playerName) + if ADMINS[playerName]~=nil then + if ADMINS[playerName] == 1 then + return "rbxasset://textures/ui/TinyAdminIcon.png" + else + return ADMINS[playerName] + end + elseif membershipType == Enum.MembershipType.None then + return "" + elseif membershipType == Enum.MembershipType.BuildersClub then + return "rbxasset://textures/ui/TinyBcIcon.png" + elseif membershipType == Enum.MembershipType.TurboBuildersClub then + return "rbxasset://textures/ui/TinyTbcIcon.png" + elseif membershipType == Enum.MembershipType.OutrageousBuildersClub then + return "rbxasset://textures/ui/TinyObcIcon.png" + else + error("Unknown membershipType" .. membershipType) + end end -local function remapColor(i, j) - brickColorTable[BrickColor.palette(i).Name] = BrickColor.palette(j).Color -end - -remapColor(13, 12) -remapColor(14, 12) -remapColor(15, 12) -remapColor(61, 29) -remapColor(63, 62) -remapColor(56, 50) -remapColor(45, 53) -remapColor(51, 20) -remapColor(4, 20) -remapColor(59, 35) -remapColor(60, 29) - -local function getColor(brickColor) - if brickColorTable[brickColor.Name] then - return brickColorTable[brickColor.Name] - else - return brickColor.Color; - end +local function getFriendStatusIcon(friendStatus) + if friendStatus == Enum.FriendStatus.Unknown or friendStatus == Enum.FriendStatus.NotFriend then + return "" + elseif friendStatus == Enum.FriendStatus.Friend then + return "http://www.morblox.us/asset/?id=99749771" + elseif friendStatus == Enum.FriendStatus.FriendRequestSent then + return "http://www.morblox.us/asset/?id=99776888" + elseif friendStatus == Enum.FriendStatus.FriendRequestReceived then + return "http://www.morblox.us/asset/?id=99776838" + else + error("Unknown FriendStatus: " .. friendStatus) + end end - -local function getTeams() - local result = {} - local teams = game:GetService("Teams"):GetChildren() - for i, team in ipairs(teams) do - if team:IsA("Team") then - table.insert(result, team) +--[[ + Utility function to create buttons for the popup menus + @Args: + nparent what to parent this button to + ntext text to put on this button + index number index of this entry in menu + last is this the last element of the popup menu + @Return: a popup menu button +--]] +function MakePopupButton(nparent,ntext,index,last) + local tobj = Obj.Create"ImageButton" + { + Name = 'ReportButton', + BackgroundTransparency = 1, + Position = UDim2.new(0,0,1*index,0), + Size = UDim2.new(1, 0, 1, 0), + ZIndex=9, + Obj.Create'TextLabel' + { + Name = 'ButtonText', + BackgroundTransparency = 1, + Position = UDim2.new(.07, 0, .07, 0), + Size = UDim2.new(.86,0,.86,0), + Parent = HeaderFrame, + Font = 'ArialBold', + Text = ntext, + FontSize = 'Size14', + TextScaled = true, + TextColor3 = Color3.new(1,1,1), + TextStrokeTransparency = 1, + ZIndex=9, + }, + Parent = nparent, + } + if index==0 then + tobj.Image = 'http://www.morblox.us/asset/?id=97108784' + elseif last then + if index%2==1 then + tobj.Image = 'http://www.morblox.us/asset/?id='.. Images['LightPopupBottom'] + else + tobj.Image = 'http://www.morblox.us/asset/?id='.. Images['DarkPopupBottom'] + end + else + if index%2==1 then + tobj.Image = 'http://www.morblox.us/asset/?id=97112126' + else + tobj.Image = 'http://www.morblox.us/asset/?id=97109338' end end - return result + return tobj end -local supportFriends = true -local currentBoardType = "PlayerList" -local currentStatCount = 0 -local createBoardsFunction = nil +--[[ + obligatory wait for child function + @Args: + parent Parent object to look for child in + child name of child object to look for + @Return: object waited for +--]] +function WaitForChild(parent,child) + while not parent:FindFirstChild(child) do + wait() debugprint(" child "..parent.Name.." waiting for "..child) + end + return parent[child] +end + + --------------------------- + -- Workspace Objects + --------------------------- + +-- might want to move all this to an init function, wait for localplayer elsewhere +local Players = game:GetService('Players') +-- make sure this doesn't run on the server(it will if you dont do this) +while not Players.LocalPlayer do + Players.Changed:wait() +end + +local LocalPlayer = Players.LocalPlayer +local Mouse = LocalPlayer:GetMouse() + +local ScreenGui = Obj.Create"Frame" +{ + Name = 'PlayerListScreen', + Size = UDim2.new(1, 0, 1, 0), + BackgroundTransparency = 1, + Parent = script.Parent -- LocalPlayer.PlayerGui -- use for switching into playergui mode +} +local MainFrame = Obj.Create"Frame" +{ + Name = 'LeaderBoardFrame', + Position = UDim2.new(1, -150, 0.005, 0), + Size = UDim2.new(0, 150, 0, 800), + BackgroundTransparency = 1, + Parent = ScreenGui, +} + +--frame used for expanding leaderstats when frame is 'focused' +local FocusFrame = Obj.Create"Frame" +{ + Name = 'FocusFrame', + Position = UDim2.new(0, 0, 0, 0), + Size = UDim2.new(1, 0, 0, 100), + BackgroundTransparency = 1, + Active = true, + Parent = MainFrame, +} + +local TemplateFrameYSize = 0.670000017 + + -- HEADER +local HeaderFrame = Obj.Create"Frame" +{ + Name = 'Header', + BackgroundTransparency = 1, + Position = UDim2.new(0,0,0,0), + Size = UDim2.new(1, 0, .07, 0), + Parent = MainFrame, + MakeBackgroundGuiObj('http://www.morblox.us/asset/?id=94692054'), +} + local HeaderFrameHeight = HeaderFrame.Size.Y.Scale + local MaximizeButton = Obj.Create"ImageButton" + { + Name = 'MaximizeButton', + Active = true, + BackgroundTransparency = 1, + Position = UDim2.new(0, 0, 0, 0), + Size = UDim2.new(1,0,1,0), + Parent = HeaderFrame, + } + local HeaderName = Obj.Create"TextLabel" + { + Name = 'PlayerName', + BackgroundTransparency = 1, + Position = UDim2.new(0, 0, .01, 0), + Size = UDim2.new(.98,0,.38,0), + Parent = HeaderFrame, + Font = 'ArialBold', + Text = LocalPlayer.Name, + FontSize='Size24', + --TextScaled = true, + TextColor3 = Color3.new(1,1,1), + TextStrokeColor3 = Color3.new(0,0,0), + TextStrokeTransparency = 0, + TextXAlignment = 'Right', + TextYAlignment = 'Center', + } + local HeaderScore = Obj.Create"TextLabel" + { + Name = 'PlayerScore', + BackgroundTransparency = 1, + Position = UDim2.new(0, 0, .4, 0), + Size = UDim2.new(.98,0,0,30), + Parent = HeaderFrame, + Font = 'ArialBold', + Text = '', + FontSize='Size24', + TextYAlignment = 'Top', + --TextScaled = true, + TextColor3 = Color3.new(1,1,1), + TextStrokeTransparency = 1, + TextXAlignment = 'Right', + TextYAlignment = 'Top', + } + -- BOTTOM + --used for shifting bottom frame for mouse over effects +local BottomShiftFrame = Obj.Create"Frame" +{ + Name= 'BottomShiftFrame', + BackgroundTransparency = 1, + Position = UDim2.new(0,0,HeaderFrameHeight,0), + Size = UDim2.new(1,0,1,0), + Parent=MainFrame, +} + local BottomFrame = Obj.Create"Frame" + { + Name = 'Bottom', + BackgroundTransparency = 1, + Position = UDim2.new(0,0,.07,0), + Size = UDim2.new(1, 0, .03, 0), + Parent = BottomShiftFrame, + MakeBackgroundGuiObj('http://www.morblox.us/asset/?id=94754966'), + } + local ExtendButton = Obj.Create"ImageButton" + { + Name = 'bigbutton', + Active = true, + BackgroundTransparency = 1, + Position = UDim2.new(0, 0, 0, 0), + Size = UDim2.new(1,0,1.5,0), + ZIndex = 3, + Parent = BottomFrame, + } + local ExtendTab = Obj.Create"ImageButton" + { + Name = 'extendTab', + Active = true, + BackgroundTransparency = 1, + Image = 'http://www.morblox.us/asset/?id=94692731', + Position = UDim2.new(.608, 0, .3, 0), + Size = UDim2.new(.3,0,.7,0), + Parent = BottomFrame, + } +local TopClipFrame = Obj.Create"Frame" +{ + Name = 'ListFrame', + BackgroundTransparency = 1, + Position = UDim2.new(-1,0,.07,0), + Size = UDim2.new(2, 0, 1, 0), + Parent = MainFrame, + ClipsDescendants = true, +} + local BottomClipFrame = Obj.Create"Frame" + { + Name = 'BottomFrame', + BackgroundTransparency = 1, + Position = UDim2.new(0,0, - .8,0), + Size = UDim2.new(1, 0, 1, 0), + Parent = TopClipFrame, + ClipsDescendants = true, + } + local ScrollBarFrame = Obj.Create"Frame" + { + Name = 'ScrollBarFrame', + BackgroundTransparency = 1, + Position = UDim2.new(.987,0,.8,0), + Size = UDim2.new(.01, 0, .2, 0), + Parent = BottomClipFrame, + } + local ScrollBar = Obj.Create"Frame" + { + Name = 'ScrollBar', + BackgroundTransparency = 0, + BackgroundColor3 = Color3.new(.2,.2,.2), + Position = UDim2.new(0,0,0,0), + Size = UDim2.new(1, 0, .5, 0), + ZIndex = 5, + Parent = ScrollBarFrame, + + } + local ListFrame = Obj.Create"Frame" + { + Name = 'SubFrame', + BackgroundTransparency = 1, + Position = UDim2.new(0,0,.8,0), + Size = UDim2.new(1, 0, 1, 0), + Parent = BottomClipFrame, + } +local PopUpClipFrame = Obj.Create"Frame" +{ + Name = 'PopUpFrame', + BackgroundTransparency = 1, + SizeConstraint='RelativeXX', + Position = MainFrame.Position + UDim2.new( 0,-150,0,0), + Size = UDim2.new(0,150,0,800), + Parent = MainFrame, + ClipsDescendants = true, + ZIndex=9, +} +local PopUpPanel = nil + local PopUpPanelTemplate = Obj.Create"Frame" + { + Name = 'Panel', + BackgroundTransparency = 1, + Position = UDim2.new(1,0,0,0), + Size = UDim2.new(1,0,.032,0), + Parent = PopUpClipFrame, + } + +local StatTitles = Obj.Create"Frame" +{ + Name = 'StatTitles', + BackgroundTransparency = 1, + Position = UDim2.new(0,0,1,-10), + Size = UDim2.new(1, 0, 0, 0), + Parent = HeaderFrame, +} + +local IsMinimized = Instance.new('BoolValue') +local IsMaximized = Instance.new('BoolValue') +local IsTabified = Instance.new('BoolValue') +local AreNamesExpanded = Instance.new('BoolValue') -local playerTable = {} -local teamTable = {} -local teamColorTable = {} +local MiddleTemplate = Obj.Create"Frame" +{ + Name = 'MidTemplate', + BackgroundTransparency = 1, + Position = UDim2.new(100,0,.07,0), + Size = UDim2.new(.5, 0, .025, 0),--UDim2.new(1, 0, .03, 0), + Obj.Create'ImageLabel' + { + Name = 'BCLabel', + Active = true, + BackgroundTransparency = 1, + Position = UDim2.new(.005, 5, .20, 0), + Size = UDim2.new(0,16,0,16), + SizeConstraint = 'RelativeYY', + Image = "", + ZIndex = 3, + }, + Obj.Create'ImageLabel' + { + Name = 'FriendLabel', + Active = true, + BackgroundTransparency = 1, + Position = UDim2.new(.005, 5, .15, 0), + Size = UDim2.new(0,16,0,16), + SizeConstraint = 'RelativeYY', + Image = "", + ZIndex = 3, + }, + Obj.Create"ImageButton" + { + Name = 'ClickListener', + Active = true, + BackgroundTransparency = 1, + Position = UDim2.new(.005, 1, 0, 0), + Size = UDim2.new(.96,0,1,0), + ZIndex = 3, + }, + Obj.Create"Frame" + { + Name = 'TitleFrame', + BackgroundTransparency = 1, + Position = UDim2.new(.01, 0, 0, 0), + Size = UDim2.new(0,140,1,0), + ClipsDescendants=true, + Obj.Create"TextLabel" + { + Name = 'Title', + BackgroundTransparency = 1, + Position = UDim2.new(0, 5, 0, 0), + Size = UDim2.new(100,0,1,0), + Font = 'Arial', + FontSize='Size14', + TextColor3 = Color3.new(1,1,1), + TextXAlignment = 'Left', + TextYAlignment = 'Center', + ZIndex = 3, + }, + }, + + Obj.Create"TextLabel" + { + Name = 'PlayerScore', + BackgroundTransparency = 1, + Position = UDim2.new(0, 0, 0, 0), + Size = UDim2.new(1,0,1,0), + Font = 'ArialBold', + Text = '', + FontSize='Size14', + TextColor3 = Color3.new(1,1,1), + TextXAlignment = 'Left', + TextYAlignment = 'Center', + ZIndex = 3, + }, + --Obj.Create'IntValue'{Name = 'ID'}, + --Obj.Create'ObjectValue'{Name = 'Player'}, + --Obj.Create'IntValue'{Name = 'Score'}, + ZIndex = 3, +} +local MiddleBGTemplate = Obj.Create"Frame" +{ + Name = 'MidBGTemplate', + BackgroundTransparency = 1, + Position = UDim2.new(100,0,.07,0), + Size = UDim2.new(.5, 0, .025, 0),--UDim2.new(1, 0, .03, 0), + MakeBackgroundGuiObj('http://www.morblox.us/asset/?id=94692025'), + +} -local removePlayerFunction = nil -local recreatePlayerFunction = nil -local addPlayerFunction = function(player) - if recreatePlayerFunction then - recreatePlayerFunction(player) + -- REPORT ABUSE OBJECTS + +local ReportAbuseShield = Obj.Create"TextButton" +{ + Name = "ReportAbuseShield", + Text = "", + AutoButtonColor = false, + Active = true, + Visible = true, + Size = UDim2.new(1,0,1,0), + BackgroundColor3 = Color3I(51,51,51), + BorderColor3 = Color3I(27,42,53), + BackgroundTransparency = 1, +} + +local ReportAbuseFrame = Obj.Create "Frame" +{ + Name = "Settings", + Position = UDim2.new(0.5, - 250, 0.5, - 200), + Size = UDim2.new(0.0, 500, 0.0, 400), + BackgroundTransparency = 1, + Active = true, + Parent = ReportAbuseShield, +} + +local AbuseSettingsFrame = Obj.Create"Frame" +{ + Name = "ReportAbuseStyle", + Size = UDim2.new(1, 0, 1, 0), + Active = true, + BackgroundTransparency = 1, + MakeBackgroundGuiObj('http://www.morblox.us/asset/?id=96488767'), -- 96480351'), + Obj.Create"TextLabel" + { + Name = "Title", + Text = "Report Abuse", + TextColor3 = Color3I(221,221,221), + Position = UDim2.new(0.5, 0, 0, 30), + Font = Enum.Font.ArialBold, + FontSize = Enum.FontSize.Size36, + }, + Obj.Create"TextLabel" + { + Name = "Description", + Text = "This will send a complete report to a moderator. The moderator will review the chat log and take appropriate action.", + TextColor3 = Color3I(221,221,221), + Position = UDim2.new(.01, 0, 0, 55), + Size = UDim2.new(.99, 0, 0, 40), + BackgroundTransparency = 1, + Font = Enum.Font.Arial, + FontSize = Enum.FontSize.Size18, + TextWrap = true, + TextXAlignment = Enum.TextXAlignment.Left, + TextYAlignment = Enum.TextYAlignment.Top, + }, + Obj.Create"TextLabel" + { + Name = "AbuseLabel", + Text = "What did they do?", + Font = Enum.Font.Arial, + BackgroundTransparency = 1, + FontSize = Enum.FontSize.Size18, + Position = UDim2.new(0.025,0,0,140), + Size = UDim2.new(0.4,0,0,36), + TextColor3 = Color3I(255,255,255), + TextXAlignment = Enum.TextXAlignment.Left, + }, + Obj.Create"TextLabel" + { + Name = "ShortDescriptionLabel", + Text = "Short Description: (optional)", + Font = Enum.Font.Arial, + FontSize = Enum.FontSize.Size18, + Position = UDim2.new(0.025,0,0,180), + Size = UDim2.new(0.95,0,0,36), + TextColor3 = Color3I(255,255,255), + TextXAlignment = Enum.TextXAlignment.Left, + BackgroundTransparency = 1, + }, + Obj.Create"TextLabel" + { + Name = "ReportingPlayerLabel", + Text = "Reporting Player", + BackgroundTransparency = 1, + Font = Enum.Font.Arial, + FontSize = Enum.FontSize.Size18, + Position = UDim2.new(0.025,0,0,100), + Size = UDim2.new(0.95,0,0,36), + TextColor3 = Color3I(255,255,255), + TextXAlignment = Enum.TextXAlignment.Left, + Parent = AbuseSettingsFrame + }, + + Parent = ReportAbuseFrame, +} + +local AbusePlayerLabel = Obj.Create"TextLabel" +{ + Name = "PlayerLabel", + Text = "", + BackgroundTransparency = 1, + Font = Enum.Font.ArialBold, + FontSize = Enum.FontSize.Size18, + Position = UDim2.new(0.025,0,0,100), + Size = UDim2.new(0.95,0,0,36), + TextColor3 = Color3I(255,255,255), + TextXAlignment = Enum.TextXAlignment.Right, + Parent = AbuseSettingsFrame +} + +local SubmitReportButton = Obj.Create"ImageButton" +{ + Name = "SubmitReportBtn", + Active = false, + BackgroundTransparency = 1, + Position = UDim2.new(.5, - 200, 1, - 80), + Size = UDim2.new(0,150,0,50), + AutoButtonColor = false, + Image = 'http://www.morblox.us/asset/?id=96502438', -- 96501119', + Parent = AbuseSettingsFrame, +} + +local CancelReportButton = Obj.Create"ImageButton" +{ + Name = "CancelBtn", + BackgroundTransparency = 1, + Position = UDim2.new(0.5, 50, 1, - 80), + Size = UDim2.new(0,150,0,50), + AutoButtonColor = true, + Image = 'http://www.morblox.us/asset/?id=96500683', + Parent = AbuseSettingsFrame, +} + +local AbuseDescriptionWrapper = Obj.Create"Frame" +{ + Name = "AbuseDescriptionWrapper", + Position = UDim2.new(0.025,0,0,220), + Size = UDim2.new(0.95,0,1, - 310), + BackgroundColor3 = Color3I(0,0,0), + BorderSizePixel = 0, + Parent = AbuseSettingsFrame, +} + +local AbuseDescriptionBox + +local OriginalAbuseDescriptionBox = Obj.Create"TextBox" +{ + Name = "TextBox", + Text = "", + ClearTextOnFocus = false, + Font = Enum.Font.Arial, + FontSize = Enum.FontSize.Size18, + Position = UDim2.new(0,3,0,3), + Size = UDim2.new(1, - 6,1, - 6), + TextColor3 = Color3I(255,255,255), + TextXAlignment = Enum.TextXAlignment.Left, + TextYAlignment = Enum.TextYAlignment.Top, + TextWrap = true, + BackgroundColor3 = Color3I(0,0,0), + BorderSizePixel = 0, +} + +local CalmingAbuseBox = Obj.Create'Frame' +{ + Name = 'AbuseFeedbackBox', + BackgroundTransparency = 1, + Position=UDim2.new(0.25, 0, 0.300000012, 0), + Size=UDim2.new(0.5, 0, 0.370000005, 0), + MakeBackgroundGuiObj('http://www.morblox.us/asset/?id=96506233'), + Obj.Create'TextLabel' + { + Name = 'Header', + Position=UDim2.new(0,10,.05,0), + Size=UDim2.new(1, -30, .15, 0), + TextScaled = true, + BackgroundTransparency = 1, + TextXAlignment = Enum.TextXAlignment.Center, + TextYAlignment = Enum.TextYAlignment.Top, + Text = 'Thanks for your report!', + TextColor3 = Color3.new(1,1,1), + FontSize = Enum.FontSize.Size48, + Font = 'ArialBold', + }, + Obj.Create'TextLabel' + { + Name = 'content', + Position = UDim2.new(0,10,.20,0), + Size = UDim2.new(1, -30, .40, 0), + TextScaled = true, + BackgroundTransparency = 1, + TextColor3 = Color3.new(1,1,1), + Text = 'Our moderators will review the chat logs and determine what happened. The other user is probably just trying to make you mad.\n\nIf anyone used swear words, inappropriate language, or threatened you in real life, please report them for Bad Words or Threats', + TextWrapped = true, + TextYAlignment = Enum.TextYAlignment.Top, + FontSize = Enum.FontSize.Size24, + Font = 'Arial', + }, + Obj.Create'ImageButton' + { + Name = "OkButton", + BackgroundTransparency = 1, + Position = UDim2.new(0.5, -75, 1, -80), + Size = UDim2.new(0,150,0,50), + AutoButtonColor = true, + Image = 'http://www.morblox.us/asset/?id=96507959', + } +} +local NormalAbuseBox = Obj.Create'Frame' +{ + Name = 'AbuseFeedbackBox', + BackgroundTransparency = 1, + Position = UDim2.new(0.25, 0, 0.300000012, 0), + Size = UDim2.new(0.5, 0, 0.370000005, 0), + MakeBackgroundGuiObj('http://www.morblox.us/asset/?id=96506233'), + Obj.Create'TextLabel' + { + Name = 'Header', + Position = UDim2.new(0,10,.05,0), + Size = UDim2.new(1, -30, .15, 0), + TextScaled = true, + BackgroundTransparency = 1, + TextColor3 = Color3.new(1,1,1), + TextXAlignment = Enum.TextXAlignment.Center, + TextYAlignment = Enum.TextYAlignment.Top, + Text = 'Thanks for your report!', + FontSize = Enum.FontSize.Size48, + Font ='ArialBold' + }, + Obj.Create'TextLabel' + { + Name = 'content', + Position = UDim2.new(0,10,.20,0), + Size = UDim2.new(1, -30, .15, 0), + TextScaled = true, + BackgroundTransparency = 1, + TextColor3 = Color3.new(1,1,1), + Text = "Our moderators will review the chat logs and determine what happened.", + TextWrapped = true, + TextYAlignment = Enum.TextYAlignment.Top, + FontSize = Enum.FontSize.Size24, + Font = 'Arial', + }, + Obj.Create'ImageButton' + { + Name = "OkButton", + BackgroundTransparency = 1, + Position = UDim2.new(0.5, -75, 1, -80), + Size = UDim2.new(0,150,0,50), + AutoButtonColor = true, + Image = 'http://www.morblox.us/asset/?id=96507959', + }, +} + +local BigButton=Instance.new('ImageButton') + BigButton.Size=UDim2.new(1,0,1,0) + BigButton.BackgroundTransparency=1 + BigButton.ZIndex=8 + BigButton.Visible=false + --BigButton.Active=false + BigButton.Parent=ScreenGui + + + local debugFrame = Obj.Create"Frame" + { + Name = 'debugframe', + Position = UDim2.new(0, 0, 0, 0), + Size = UDim2.new(0, 150, 0, 800),--0.99000001 + BackgroundTransparency = 1, + + } + local debugplayers = Obj.Create"TextLabel" + { + BackgroundTransparency = .8, + Position = UDim2.new(0, 0, .01, 0), + Size = UDim2.new(1,0,.5,0), + Parent = debugFrame, + Font = 'ArialBold', + Text = '--', + FontSize='Size14', + TextWrapped=true, + TextColor3 = Color3.new(1,1,1), + TextStrokeColor3 = Color3.new(0,0,0), + TextStrokeTransparency = 0, + TextXAlignment = 'Right', + TextYAlignment = 'Center', + } + local debugOutput = Obj.Create"TextLabel" + { + BackgroundTransparency = .8, + Position = UDim2.new(0, 0, .5, 0), + Size = UDim2.new(1,0,.5,0), + Parent = debugFrame, + Font = 'ArialBold', + Text = '--', + FontSize='Size14', + TextWrapped=true, + TextColor3 = Color3.new(1,1,1), + TextStrokeColor3 = Color3.new(0,0,0), + TextStrokeTransparency = 0, + TextXAlignment = 'Right', + TextYAlignment = 'Center', + } + + +--[[ + simple function to toggle the display of debug output +--]] +local DebugPrintEnabled=true +function debugprint(str) + if DebugPrintEnabled then + debugOutput.Text=str end end -local sortPlayerListsFunction = nil -local minimizedState = nil -local bigWindowImposter = nil -local smallWindowPosition = UDim2.new(0, -20, 0,5) -local smallWindowSize = UDim2.new(1,0,1,0) -local bigWindowSize = UDim2.new(0.6,0,0.6,0) -local bigWindowPosition = UDim2.new(.2, 0, .2,0) -local smallWindowHeaderYSize = 32 + ------------------------- + -- Script objects + ------------------------- +local RbxGui = assert(LoadLibrary('RbxGui')) -local debounceTeamsChanged = false + -- number of entries to show if you click minimize +local DefaultEntriesOnScreen = 8 -local currentWindowState = "Small" -local previousWindowState = nil -local transitionWindowsFunction = nil -local container = nil -local topRightTrayContainer = nil + -local playerContextMenu = nil -local contextMenuElements = {} -local function addContextMenuLabel(getText1, getText2, isVisible) - local t = {} - t.Type = "Label" - t.GetText1 = getText1 - t.GetText2 = getText2 - t.IsVisible = isVisible - table.insert(contextMenuElements, t) -end -local function addContextMenuButton(text, isVisible, isActive, doIt) - local t = {} - t.Text = text - t.Type = "Button" - t.IsVisible = isVisible - t.IsActive = isActive - t.DoIt = doIt - table.insert(contextMenuElements, t) +for _,i in pairs(Images) do + Game:GetService("ContentProvider"):Preload("http://www.morblox.us/asset/?id="..i) end -local function getFriendStatus(player) + -- ordered array of 'score data', each entry has: + -- Name(String) + -- Priority(number) + -- IsPrimary (bool, should it be shown in upper right) + -- MaxLength (integer, of the length of the longest element for this column) +local ScoreNames = {} + -- prevents flipping in playerlist panels +local AddId = 0 + -- intermediate table form of all player entries in format of: + -- Frame + -- Player + -- Score + -- ID + -- MyTeam (team ENRTY(not actual team) I am currently on) +local PlayerFrames = {} + -- intermediate ordered frame array, composed of Entrys of + -- Frame + -- MyTeam (my team object) + -- MyPlayers ( an ordered array of all player frames in team ) + -- AutoHide (bool saying whether it should be hidden) + -- IsHidden (bool) + -- ID (int to prevent flipping out of leaderboard, fun times) +local TeamFrames = {} + -- one special entry from teamFrames, for unaffiliated players, only shown if players non - empty +local NeutralTeam = nil + + -- final 'to be displayed' list of frames +local MiddleFrames = {} +local MiddleFrameBackgrounds = {} +local MiddleFrameHeight = .03 + -- time of last click +local LastClick = 0 +local ButtonCooldown = .25 + +local OnIos = false +pcall(function() OnIos = Game:GetService('UserInputService').TouchEnabled end) + + + -- you get 200 of x screen space per stat added, start width 16% +local BaseScreenXSize = 150 +local SpacingPerStat = 10 --spacing between stats + + +local MaximizedBounds = UDim2.new(.5,0,1,0) +local MaximizedPosition = UDim2.new(.25,0,.1,0) +local NormalBounds = UDim2.new(0,BaseScreenXSize, 0, 800) +local NormalPosition = UDim2.new(1 , - BaseScreenXSize, 0.005, 0) + +local MinimizedBounds = UDim2.new(0, BaseScreenXSize, 0.99000001, 0) + + + -- number of stats to show from leaderstats +local NumPrimaryStats = 0 + -- where the scroll par currently is positioned +local ScrollPosition = 0.75999999 +local IsDragging = false -- am I dragging the player list + +local DefaultBottomClipPos = BottomClipFrame.Position.Y.Scale + +local LastSelectedPlayerEntry = nil +local SelectedPlayerEntry = nil +local SelectedPlayer = nil + + -- locks(semaphores) for stopping race conditions +local AddingFrameLock = false +local ChangingOrderLock = false +local AddingStatLock = false +local BaseUpdateLock = false +local WaitForClickLock = false +local InPopupWaitForClick=false +local PlayerChangedLock = false +local NeutralTeamLock = false + +local ScrollWheelConnections = {} + + +local DefaultListSize = 8 +if not OnIos then DefaultListSize = 12 end +local DidMinimizeDrag = false + + -- report abuse objects +local AbuseName +local Abuses = { + "Bad Words or Threats", + "Bad Username", + "Talking about Dating", + "Account Trading or Sharing", + "Asking Personal Questions", + "Rude or Mean Behavior", + "False Reporting Me" +} +local UpdateAbuseFunction +local AbuseDropDown, UpdateAbuseSelection + +local PrivilegeLevel = +{ + Owner = 255, + Admin = 240, + Member = 128, + Visitor = 10, + Banned = 0, +} + + +local IsPersonalServer = not not game.Workspace:FindFirstChild("PSVariable") +if IsPersonalServer then + --THIS SHOULD NOT BE HERE GUYS, only keeping to perserve old functionality + game:GetService("ScriptContext"):AddCoreScript(64164692,game.Players.LocalPlayer,"BuildToolManager") +end +game.Workspace.ChildAdded:connect(function(nchild) + if nchild.Name=='PSVariable' and nchild:IsA('BoolValue') then + IsPersonalServer=true + --THIS SHOULD NOT BE HERE GUYS, only keeping to perserve old functionality + game:GetService("ScriptContext"):AddCoreScript(64164692,game.Players.LocalPlayer,"BuildToolManager") + end +end) + ------------------------------- + -- Static Functions + ------------------------------- +function GetTotalEntries() + return math.min(#MiddleFrameBackgrounds,DefaultEntriesOnScreen) +end + +function GetEntryListLength() + local numEnts=#PlayerFrames+#TeamFrames + if NeutralTeam then + numEnts=numEnts+1 + end + return numEnts +end + +function AreAllEntriesOnScreen() + return #MiddleFrameBackgrounds * MiddleTemplate.Size.Y.Scale <= 1 + DefaultBottomClipPos +end + +function GetLengthOfVisbleScroll() + return 1 + DefaultBottomClipPos +end + +function GetMaxScroll() + return DefaultBottomClipPos * - 1 +end + -- can be optimized by caching when this varible changes +function GetMinScroll() + if AreAllEntriesOnScreen() then + return GetMaxScroll() + else + return (GetMaxScroll() - (#MiddleFrameBackgrounds * MiddleTemplate.Size.Y.Scale)) + (1 + DefaultBottomClipPos) + end +end + +function AbsoluteToPercent(x,y) + return Vector2.new(x,y)/ScreenGui.AbsoluteSize +end +--[[ + tweens text transparency of element from starta to enda over length of time + Warning: should be put in a Spawn call + @Args: + element textobject to tween transparency on + starta alpha to start tweening + enda alpha to end tweening on + length how many seconds to spend tweening +--]] +function TweenTextTransparency(element,starta,enda,length) + local startTime = time() + while time() - startTime < length do + element.TextTransparency = ((enda - starta) * ((time() - startTime)/length)) + starta + wait(.01) + end + element.TextTransparency = enda +end +--[[ + tweens background transparency of element from starta to enda over length of time + Warning: should be put in a Spawn call + @Args: + element guiobject to tween transparency on + starta alpha to start tweening + enda alpha to end tweening on + length how many seconds to spend tweening +--]] +function TweenBackgroundTransparency(element,starta,enda,length) + local startTime = time() + while time() - startTime < length do + element.BackgroundTransparency = ((enda - starta) * ((time() - startTime)/length)) + starta + wait(.01) + end + element.BackgroundTransparency = enda +end + +--[[ + UGLY UGLY HACK FUNCTION + replace with some sort of global input catching A.S.A. FREAKING P. + creates a fullsize gui element to catch next mouse up event(completeing a click) + @Args: + frameParent Object to parent fullscreen gui to + polledFunction function to call on mouse moved events in this gui + exitFunction function to call when click event is fired +--]] +function WaitForClick(frameParent,polledFunction,exitFunction) + if WaitForClickLock then return end + debugprint('waiting for click!') + WaitForClickLock=true + BigButton.Visible=true + --BigButton.Active=true + --BigButton.Parent=frameParent + local upHappened=false + local connection, connection2 + connection2=BigButton.MouseMoved:connect( function(nx,ny) + polledFunction(nx,ny) + end) + connection=BigButton.MouseButton1Up:connect(function(nx,ny) + exitFunction(nx,ny) + BigButton.Visible=false + connection:disconnect() + connection2:disconnect() + debugprint('mouse up!') + end) + frameParent.AncestryChanged:connect(function(child,nparent) + if child == frameParent and nparent ==nil then + exitFunction(nx,ny) + BigButton.Visible=false + connection:disconnect() + connection2:disconnect() + debugprint("forced out of wait for click") + end + end) + WaitForClickLock=false +end + + +--------------------------- +--Personal Server Handling +--------------------------- +--[[ + returns privlage level based on integer rank + Note: these privilege levels seem completely arbitrary, but no documentation exists + this is all from the old player list, really weird + @Args: + rank Integer rank value for player + @Return Normalized integer value for rank? +--]] +function GetPrivilegeType(rank) + if rank <= PrivilegeLevel['Banned'] then + return PrivilegeLevel['Banned'] + elseif rank <= PrivilegeLevel['Visitor'] then + return PrivilegeLevel['Visitor'] + elseif rank <= PrivilegeLevel['Member'] then + return PrivilegeLevel['Member'] + elseif rank <= PrivilegeLevel['Admin'] then + return PrivilegeLevel['Admin'] + else + return PrivilegeLevel['Owner'] + end +end + +--[[ + gives a player a new privilage rank + Note: Very odd that I have to use loops with this instead of directly setting the rank + but no documentation for personal server service exists + @Args: + player player to change rank of + nrank new integer rank to give player +--]] +function SetPrivilegeRank(player,nrank) + while player.PersonalServerRanknrank do + game:GetService("PersonalServerService"):Demote(player) + end +end +--[[ + called when player selects new privilege level from popup menu + @Args: + player player to set privileges on + nlevel new privilege level for this player +--]] +function OnPrivilegeLevelSelect(player,nlevel,BanPlayerButton,VisitorButton,MemberButton,AdminButton) + debugprint('setting privilege level') + SetPrivilegeRank(player,nlevel) + HighlightMyRank(player,BanPlayerButton,VisitorButton,MemberButton,AdminButton) +end + +--[[ + Highlights current rank of this player in the popup menu + @Args: + player Player to check for rank on +--]] +function HighlightMyRank(player,BanPlayerButton,VisitorButton,MemberButton,AdminButton) + BanPlayerButton.Image= 'http://www.morblox.us/asset/?id='..Images['LightPopupMid'] + VisitorButton.Image= 'http://www.morblox.us/asset/?id='..Images['DarkPopupMid'] + MemberButton.Image= 'http://www.morblox.us/asset/?id='..Images['LightPopupMid'] + AdminButton.Image= 'http://www.morblox.us/asset/?id='..Images['DarkPopupBottom'] + + local rank=player.PersonalServerRank + if rank <= PrivilegeLevel['Banned'] then + BanPlayerButton.Image='http://www.morblox.us/asset/?id='..Images['LightBluePopupMid'] + elseif rank <= PrivilegeLevel['Visitor'] then + VisitorButton.Image='http://www.morblox.us/asset/?id='..Images['DarkBluePopupMid'] + elseif rank <= PrivilegeLevel['Member'] then + MemberButton.Image='http://www.morblox.us/asset/?id='..Images['LightBluePopupMid'] + elseif rank <= PrivilegeLevel['Admin'] then + AdminButton.Image= 'http://www.morblox.us/asset/?id='..Images['DarkBluePopupBottom'] + end +end + + -------------------------- + -- Report abuse handling + -------------------------- +--[[ + does final reporting of abuse on selected player, calls closeAbuseDialog +--]] +function OnSubmitAbuse() + if SubmitReportButton.Active then + if AbuseName and SelectedPlayer then + AbuseSettingsFrame.Visible = false + game.Players:ReportAbuse(SelectedPlayer, AbuseName, AbuseDescriptionBox.Text) + if AbuseName == "Rude or Mean Behavior" or AbuseName == "False Reporting Me" then + CalmingAbuseBox.Parent = ReportAbuseShield + else + debugprint('opening abuse box') + NormalAbuseBox.Parent = ReportAbuseShield + end + else + CloseAbuseDialog() + end + end +end + +--[[ + opens the abuse dialog, initialises text to display selectedplayer +--]] +function OpenAbuseDialog() + debugprint('adding report dialog') + AbusePlayerLabel.Text = SelectedPlayer.Name + --AbuseDescriptionBox.Text = "" + PopUpPanel:TweenPosition(UDim2.new(1,0,0,0), "Out", "Quad", .5,true) + AbuseDescriptionBox=OriginalAbuseDescriptionBox:Clone() + AbuseDescriptionBox.Parent = AbuseDescriptionWrapper + ReportAbuseShield.Parent = ScreenGui +end +--[[ + resets and closes abuse dialog +--]] +function CloseAbuseDialog() + AbuseName = nil + SubmitReportButton.Active = false + SubmitReportButton.Image = 'http://www.morblox.us/asset/?id=96502438' -- 96501119', + AbuseDescriptionBox:Destroy() + CalmingAbuseBox.Parent = nil + NormalAbuseBox.Parent = nil + ReportAbuseShield.Parent = nil + AbuseSettingsFrame.Visible = true +end + +--[[ + creates dropdownbox, registers all listeners for abuse dialog +--]] +function InitReportAbuse() + + UpdateAbuseFunction = function(abuseText) + AbuseName = abuseText + if AbuseName and SelectedPlayer then + SubmitReportButton.Active = true + SubmitReportButton.Image = 'http://www.morblox.us/asset/?id=96501119' + end + end + + AbuseDropDown, UpdateAbuseSelection = RbxGui.CreateDropDownMenu(Abuses, UpdateAbuseFunction, true) + AbuseDropDown.Name = "AbuseComboBox" + AbuseDropDown.Position = UDim2.new(0.425, 0, 0, 142) + AbuseDropDown.Size = UDim2.new(0.55,0,0,32) + AbuseDropDown.Parent = AbuseSettingsFrame + + + CancelReportButton.MouseButton1Click:connect(CloseAbuseDialog) + SubmitReportButton.MouseButton1Click:connect(OnSubmitAbuse) + + CalmingAbuseBox:FindFirstChild('OkButton').MouseButton1Down:connect(CloseAbuseDialog) + NormalAbuseBox:FindFirstChild('OkButton').MouseButton1Down:connect(CloseAbuseDialog) +end + +------------------------------------- +-- Friend/unfriending +------------------------------------- +--[[ + gets enum val of friend status, uses pcall for some reason?(from old playerlist) + @Args: + player player object to check if friends with + @Return: enum of friend status +--]] +local function GetFriendStatus(player) if player == game.Players.LocalPlayer then return Enum.FriendStatus.NotFriend else @@ -184,1735 +1230,1774 @@ local function getFriendStatus(player) end end end ---Populate the ContextMenus -addContextMenuLabel( - --GetText1 - function(player) - return "Loading..." - end, - --GetText2 - nil, - --IsVisible - function(player) - return getFriendStatus(player) == Enum.FriendStatus.Unknown - end) -addContextMenuButton("Send " .. friendWord .. " Request", - --IsVisible - function(player) - return getFriendStatus(player) == Enum.FriendStatus.NotFriend - end, - --IsActive - function(player) - return true - end, - --DoIt - function(player) - return game.Players.LocalPlayer:RequestFriendship(player) +--[[ + when friend button is clicked, tries to take appropriate action, + based on current friend status with SelectedPlayer +--]] +function OnFriendButtonSelect() + + local friendStatus=GetFriendStatus(SelectedPlayer) + if friendStatus==Enum.FriendStatus.Friend then + LocalPlayer:RevokeFriendship(SelectedPlayer) + elseif friendStatus==Enum.FriendStatus.Unknown or friendStatus==Enum.FriendStatus.NotFriend then + LocalPlayer:RequestFriendship(SelectedPlayer) + elseif friendStatus==Enum.FriendStatus.FriendRequestSent then + LocalPlayer:RevokeFriendship(SelectedPlayer) + elseif friendStatus==Enum.FriendStatus.FriendRequestReceived then + LocalPlayer:RequestFriendship(SelectedPlayer) end -) -addContextMenuButton("Un" .. friendWordLowercase, - --IsVisible - function(player) - return getFriendStatus(player) == Enum.FriendStatus.Friend - end, - --IsActive - function(player) - return true - end, - --DoIt - function(player) - return game.Players.LocalPlayer:RevokeFriendship(player) - end -) -addContextMenuButton("Accept " .. friendWord .. " Request", - --IsVisible - function(player) - return getFriendStatus(player) == Enum.FriendStatus.FriendRequestReceived - end, - --IsActive - function(player) - return true - end, - --DoIt - function(player) - return game.Players.LocalPlayer:RequestFriendship(player) - end -) - -addContextMenuButton("Deny " .. friendWord .. " Request", - --IsVisible - function(player) - return getFriendStatus(player) == Enum.FriendStatus.FriendRequestReceived - end, - --IsActive - function(player) - return true - end, - --DoIt - function(player) - return game.Players.LocalPlayer:RevokeFriendship(player) - end -) - -addContextMenuButton("Cancel " .. friendWord .. " Request", - --IsVisible - function(player) - return getFriendStatus(player) == Enum.FriendStatus.FriendRequestSent - end, - --IsActive - function(player) - return true - end, - --DoIt - function(player) - return game.Players.LocalPlayer:RevokeFriendship(player) - end -) - - -local function getStatColumns(players) - for i, player in ipairs(players) do - local leaderstats = player:FindFirstChild("leaderstats") - if leaderstats then - local stats = {} - local children = leaderstats:GetChildren() - if children then - for i, stat in ipairs(children) do - if stat:IsA("IntValue") then - table.insert(stats, stat.Name) - else - --TODO: This should check for IntValue only but current ScoreHud does not - table.insert(stats, stat.Name) - end - end - end - return stats - end - end - return nil + --PersonalServerPanel:TweenPosition(UDim2.new(1,0,0,0), "Out", "Quad", .5,true) + ClosePopUpPanel() + PopUpPanel:TweenPosition(UDim2.new(1,0,0,0), "Out", "Quad", .5,true) end -local function determineBoardType() - local players = getPlayers() +function OnFriendRefuseButtonSelect() - local foundLeaderstats = false - local numStats = 0 - local foundTeam = false - local stats = getStatColumns(players) - if stats then - foundLeaderstats = true - numStats = #stats + LocalPlayer:RevokeFriendship(SelectedPlayer) + ClosePopUpPanel() + PopUpPanel:TweenPosition(UDim2.new(1,0,0,0), "Out", "Quad", .5,true) +end +------------------------------------ +-- Player Entry Handling +------------------------------------ +--[[ + used by lua's table.sort to sort player entries +--]] +function PlayerSortFunction(a,b) + -- prevents flipping out leaderboard + if a['Score'] == b['Score'] then + --return a['ID'] < b['ID'] + return a['Player'].Name:upper() < b['Player'].Name:upper() end + if not a['Score'] then return false end + if not b['Score'] then return true end + return a['Score'] < b['Score'] +end - for i, player in ipairs(players) do - if not foundTeam then - if not player.Neutral then - foundTeam = true - break + --------------------------------- + -- Stat Handling + --------------------------------- + -- removes and closes all leaderboard stuffs +function BlowThisPopsicleStand() + --ScreenGui:Destroy() + --script:Destroy() + --time to make the fanboys rage... + Tabify() +end +--[[ + used by lua's table.sort to prioritize score entries +--]] +function StatSort(a,b) + -- primary stats should be shown before all others + if a.IsPrimary ~= b.IsPrimary then + return a.IsPrimary + end + -- if priorities are equal, then return the first added one + if a.Priority == b.Priority then + return a.AddId < b.AddId + end + return a.Priority < b.Priority +end +--[[ + doing WAAY too much here, for optimization update only your team + @Args: + playerEntry Entry of player who had a stat change + property Name of stat changed +--]] +function StatChanged(playerEntry,property) + + -- if(playerEntry['MyTeam']) then + -- UpdateSingleTeam(playerEntry['MyTeam']) + -- else + BaseUpdate() + -- end +end +--[[ + Called when stat is added + if playerEntry is localplayer, will add to score names and re-sort the stats, and resize the width of the leaderboard + for all players, will add a listener for if this stat changes + if stat is a string value, crashes the leaderboard + Note:change crash to a 'tabify' leaderboard later + @Args: + nchild new child value to leaderstats + playerEntry entry this stat was added to +--]] +function StatAdded(nchild,playerEntry) + -- dont re - add a leaderstat I alreday have + while AddingStatLock do debugprint('in stat added function lock') wait(1/30) end + AddingStatLock = true + if not (nchild:IsA('StringValue') or nchild:IsA('IntValue') or nchild:IsA('BoolValue') or nchild:IsA('NumberValue') or nchild:IsA('DoubleConstrainedValue') or nchild:IsA('IntConstrainedValue')) then + BlowThisPopsicleStand() + else + local haveScore = false + for _,i in pairs(ScoreNames) do + if i['Name']==nchild.Name then haveScore=true end + end + if not haveScore then + local nstat = {} + nstat['Name'] = nchild.Name + nstat['Priority'] = 0 + if(nchild:FindFirstChild('Priority')) then + nstat['Priority'] = nchild.Priority + end + nstat['IsPrimary'] = false + if(nchild:FindFirstChild('IsPrimary')) then + nstat['IsPrimary'] = true + end + if(nstat['IsPrimary']) then + NumPrimaryStats = NumPrimaryStats + 1 + end + nstat.AddId = AddId + AddId = AddId + 1 + table.insert(ScoreNames,nstat) + table.sort(ScoreNames,StatSort) + UpdateMaximize() + + end + end + AddingStatLock = false + StatChanged(playerEntry) + nchild.Changed:connect(function(property) StatChanged(playerEntry,property) end) + + +end +--[[ + Called when stat is removed from player + for all players, destroys the stat frame associated with this value, + then calls statchanged(to resize frame) + if playerEntry==localplayer, will remove from scorenames + @Args: + nchild ___value to be removed + playerEntry entry of player value is being removed from +--]] +function StatRemoved(nchild,playerEntry) + while AddingStatLock do debugprint('In Adding Stat Lock1') wait(1/30) end + AddingStatLock = true + if playerEntry['Frame']:FindFirstChild(nchild.Name) then + debugprint('Destroyed frame!') + playerEntry['Frame'][nchild.Name].Parent = nil + end + if playerEntry['Player'].Name == LocalPlayer.Name then + for i,val in ipairs(ScoreNames) do + if val['IsPrimary'] then + NumPrimaryStats = NumPrimaryStats - 1 + end + if val['Name'] == nchild.Name then + table.remove(ScoreNames,i) end end end - - if foundLeaderstats and foundTeam then - return "TeamScore", numStats - elseif foundLeaderstats then - return "PlayerScore", numStats - elseif foundTeam then - return "TeamList", numStats - else - return "PlayerList", numStats + AddingStatLock = false + StatChanged(playerEntry) +end +--[[ + clears all stats from a given playerEntry + used when leaderstats are removed, or when new leaderstats are added(for weird edge case)+ +--]] +function RemoveAllStats(playerEntry) + while AddingStatLock do debugprint('In Adding Stat Lock1') wait(1/30) end + AddingStatLock = true + + for i,val in ipairs(ScoreNames) do + if playerEntry['Frame']:FindFirstChild(val['Name']) then + debugprint('Destroyed frame!') + playerEntry['Frame'][val['Name']].Parent = nil + end + if playerEntry['Player'].Name == LocalPlayer.Name then + NumPrimaryStats = NumPrimaryStats - 1 + end end + if playerEntry['Player'].Name == LocalPlayer.Name then + NumPrimaryStats = NumPrimaryStats - 1 + end + + AddingStatLock = false + StatChanged(playerEntry) end -local function toggleBigWindow() - if container == nil then + +function GetScoreValue(score) + if score:IsA('DoubleConstrainedValue') or score:IsA('IntConstrainedValue') then + return score.ConstrainedValue + elseif score:IsA('BoolValue') then + if score.Value then return 1 else return 0 end + else + return score.Value + end +end +--[[ + +--]] +function MakeScoreEntry(entry,scoreval,panel) + if not panel:FindFirstChild('PlayerScore') then return end + local nscoretxt = panel:FindFirstChild('PlayerScore'):Clone() + local thisScore = nil + --here lies the resting place of a once great and terrible bug + --may its treachery never be forgoten, lest its survivors fall for it again + --RIP the leaderstat bug, oct 2012-nov 2012 + wait() + if entry['Player']:FindFirstChild('leaderstats') then + thisScore = entry['Player']:FindFirstChild('leaderstats'):FindFirstChild(scoreval['Name']) + else return end + + if not entry['Player'].Parent then return end + + nscoretxt.Name = scoreval['Name'] + nscoretxt.Text = tostring(GetScoreValue(thisScore)) + if scoreval['Name'] == ScoreNames[1]['Name'] then + debugprint('changing score') + entry['Score'] = GetScoreValue(thisScore) + if entry['Player'] == LocalPlayer then HeaderScore.Text = tostring(GetScoreValue(thisScore)) end + end - if currentWindowState == "Big" then - --Hide it - if previousWindowState == nil or previousWindowState == "Big" or previousWindowState == "None" then - transitionWindowsFunction("None") - else - transitionWindowsFunction("Small") + thisScore.Changed:connect(function() + if not thisScore.Parent then return end + if scoreval['Name'] == ScoreNames[1]['Name'] then + + entry['Score'] = GetScoreValue(thisScore) + if entry['Player'] == LocalPlayer then HeaderScore.Text = tostring(GetScoreValue(thisScore)) end end + nscoretxt.Text = tostring(GetScoreValue(thisScore)) + BaseUpdate() + end) + return nscoretxt + +end + +function CreateStatTitle(statName) + + local ntitle = MiddleTemplate:FindFirstChild('PlayerScore'):Clone() + ntitle.Name = statName + ntitle.Text = statName + -- ntitle + if IsMaximized.Value then + ntitle.TextTransparency = 0 else - previousWindowState = currentWindowState - transitionWindowsFunction("Big") + ntitle.TextTransparency = 1 end -end -local previousBigPlayerList = nil -local function rebuildBoard(owner, boardType, numStats) - if topRightTrayContainer == nil then - topRightTrayContainer = owner:FindFirstChild("PlayerListTopRightFrame") - if topRightTrayContainer == nil then - topRightTrayContainer = Instance.new("Frame") - topRightTrayContainer.Name = "PlayerListTopRightFrame" - topRightTrayContainer.BackgroundTransparency = 1 - topRightTrayContainer.Size = UDim2.new(0.2, 16, 0.42, 16) - topRightTrayContainer.Position = UDim2.new(0.8, 0, 0, 0) - topRightTrayContainer.Parent = container - end - end - if minimizedState == nil then - minimizedState = Instance.new("Frame") - minimizedState.Name = "MinimizedPlayerlist" - minimizedState.BackgroundTransparency = 1 - minimizedState.Position = UDim2.new(1, -166, 0,0) - minimizedState.Size = UDim2.new(0, 151, 0, 30) - - playerListButton = Instance.new("ImageButton") - playerListButton.Name = "GoSmallButton" - playerListButton.Image = "rbxasset://textures/ui/playerlist_hidden_small.png" - playerListButton.BackgroundTransparency = 1 - playerListButton.Size = UDim2.new(0.0, 35, 0, 30) - playerListButton.Position = UDim2.new(1, -35, 0, 0) - playerListButton.MouseButton1Click:connect( - function() - transitionWindowsFunction("Small") - end) - playerListButton.Parent = minimizedState - - minimizedState.Visible = false - robloxLock(minimizedState) - minimizedState.Parent = topRightTrayContainer - end - if bigWindowImposter == nil then - bigWindowImposter = owner:FindFirstChild("BigPlayerListWindowImposter") - if bigWindowImposter == nil then - bigWindowImposter = Instance.new("Frame") - bigWindowImposter.Name = "BigPlayerListWindowImposter" - bigWindowImposter.Visible = false - bigWindowImposter.BackgroundColor3 = Color3.new(0,0,0) - bigWindowImposter.BackgroundTransparency = 0.7 - bigWindowImposter.BorderSizePixel = 0 - bigWindowImposter.Size = UDim2.new(0.4, 7, 0.4, 7) - bigWindowImposter.Position = UDim2.new(0.3, 0, 0.3, 0) - robloxLock(bigWindowImposter) - bigWindowImposter.Parent = container - end - end - if container == nil or container ~= owner then - container = owner - - topRightTrayContainer.Parent = container - bigWindowImposter.Parent = container - end - - local smallVisible = true - local bigVisible = false - if container then - if topRightTrayContainer then - --Delete the old boards - if topRightTrayContainer:FindFirstChild("SmallPlayerlist") then - smallVisible = topRightTrayContainer.SmallPlayerlist.Visible - topRightTrayContainer.SmallPlayerlist.Parent = nil - end - end - if container:FindFirstChild("BigPlayerlist") then - bigVisible = container.BigPlayerlist.Visible or (previousBigPlayerList ~= nil) - container.BigPlayerlist.Parent = nil - if previousBigPlayerList ~= nil then - pcall(function() game.GuiService:RemoveCenterDialog(previousBigPlayerList) end) - previousBigPlayerList = nil - end - end - end - - local smallBoard, bigBoard = createBoardsFunction(boardType, numStats) - if smallBoard then - smallBoard.Visible = smallVisible - smallBoard.Parent = topRightTrayContainer - recalculateSmallPlayerListSize(smallBoard) - end - if bigBoard then - if bigVisible then - previousBigPlayerList = bigBoard - local centerDialogSupported, msg = pcall(function() game.GuiService:AddCenterDialog(previousBigPlayerList, Enum.CenterDialogType.PlayerInitiatedDialog, - function() - previousBigPlayerList.Visible = true - end) - end) - bigBoard.Visible = bigVisible - else - bigBoard.Visible = false - end - bigBoard.Parent = container - end - return container + ntitle.Parent = StatTitles end -function recalculateSmallPlayerListSize(smallPlayerList) - waitForChild(smallPlayerList,"ScrollingArea") - waitForChild(smallPlayerList.ScrollingArea, "ScrollingFrame") - local scrollingFrame = smallPlayerList.ScrollingArea.ScrollingFrame - local playerLines = scrollingFrame:GetChildren() - - local totalPlayerListSize = 0 - for i = 1, #playerLines do - totalPlayerListSize = totalPlayerListSize + playerLines[i].AbsoluteSize.Y - end - - local yOffset = math.max(0,(smallPlayerList.Size.Y.Scale * smallPlayerList.Parent.AbsoluteSize.Y) - totalPlayerListSize - smallWindowHeaderYSize) - smallPlayerList.Size = UDim2.new(smallPlayerList.Size.X.Scale,smallPlayerList.Size.X.Offset,smallPlayerList.Size.Y.Scale,-yOffset) -end - - -local function showBigPlayerWindow() - if container:FindFirstChild("BigPlayerlist") then - if container.BigPlayerlist.Visible then - return - end - end +function RecreateScoreColumns(ptable) + while AddingStatLock do debugprint ('In Adding Stat Lock2') wait(1/30) end + AddingStatLock = true + local Xoffset=BaseScreenXSize --current offset from left + local maxXOffset=Xoffset + local MaxSizeColumn=0 --max size for this column - bigWindowImposter.Visible = true - bigWindowImposter:TweenSizeAndPosition(bigWindowSize, bigWindowPosition, Enum.EasingDirection.Out, bigEasingStyle, 0.3, true, - function(state) - if state == Enum.TweenStatus.Completed then - bigWindowImposter.Visible = false - if container:FindFirstChild("BigPlayerlist") then - container.BigPlayerlist.Visible = true - end - end - end) -end - -local function hideBigPlayerWindow(completed) - if playerContextMenu then - playerContextMenu.Visible = false - end - - if container:FindFirstChild("BigPlayerlist") then - if container.BigPlayerlist.Visible == false and bigWindowImposter.Visible == false then - if completed then - completed() - end - --Already completely hidden - return - end - container.BigPlayerlist.Visible = false - end - - local completedFunction = completed - bigWindowImposter.Visible = true - bigWindowImposter:TweenSizeAndPosition(UDim2.new(0.4, 0, 0.4, 0), UDim2.new(0.3, 0, 0.3, 0), Enum.EasingDirection.In, Enum.EasingStyle.Quart, 0.15, true, - function(state) - if state == Enum.TweenStatus.Completed then - bigWindowImposter.Visible = false - if completedFunction then - completedFunction() - end - end - end) -end -local function hideSmallPlayerWindow(completed) - if playerContextMenu then - playerContextMenu.Visible = false - end - if topRightTrayContainer:FindFirstChild("SmallPlayerlist") then - local completedFunction = completed - if topRightTrayContainer.SmallPlayerlist.Visible then - topRightTrayContainer.SmallPlayerlist:TweenPosition(UDim2.new(1,0,smallWindowPosition.Y.Scale, smallWindowPosition.Y.Offset), Enum.EasingDirection.Out, smallEasingStyle, 0.3, true, - function(state) - if state == Enum.TweenStatus.Completed then - if topRightTrayContainer:FindFirstChild("SmallPlayerlist") then - topRightTrayContainer.SmallPlayerlist.Visible = false - end - if completedFunction then - completedFunction() - end + -- foreach known leaderstat + for j = 1, #ScoreNames,1 do + local scoreval = ScoreNames[j] + --if scoreval['ColumnSize'] then + -- MaxSizeColumn=0--scoreval['ColumnSize'] + --else + MaxSizeColumn=0 + --end + -- for each entry in this player table + for i,entry in ipairs(ptable) do + local panel = entry['Frame'] + local tplayer = entry['Player'] + -- if this panel does not have an element named after this stat + if not panel:FindFirstChild(scoreval['Name']) then + -- make an entry for this object + local nentry = MakeScoreEntry(entry,scoreval,panel) + if nentry then + debugprint('adding '..nentry.Name..' to '..entry['Player'].Name ) + nentry.Parent = panel + -- add score to team + if entry['MyTeam'] and entry['MyTeam'] ~= NeutralTeam and not entry['MyTeam']['Frame']:FindFirstChild(scoreval['Name']) then + local ntitle = nentry:Clone() + ntitle.Parent = entry['MyTeam']['Frame'] end - end) - return + + end + end + scoreval['XOffset']=Xoffset + + if panel:FindFirstChild(scoreval['Name']) then + MaxSizeColumn=math.max(MaxSizeColumn,panel[scoreval['Name']].TextBounds.X) + end end + -- add stat title to top bar + if not StatTitles:FindFirstChild(scoreval['Name']) then + CreateStatTitle(scoreval['Name']) + end + + if AreNamesExpanded.Value then + MaxSizeColumn=math.max(MaxSizeColumn,StatTitles[scoreval['Name'] ].TextBounds.X) + StatTitles[scoreval['Name'] ]:TweenPosition(UDim2.new(0,Xoffset,0,0),'Out','Quad',.25,true) + else + StatTitles[scoreval['Name'] ]:TweenPosition(UDim2.new(.4+((.6/#ScoreNames)*(j-1)),0,0,0),'Out','Quad',.25,true) + end + scoreval['ColumnSize']=MaxSizeColumn + Xoffset= Xoffset+SpacingPerStat+MaxSizeColumn + maxXOffset=math.max(Xoffset,maxXOffset) end - if completed then - completed() - end -end - - -transitionWindowsFunction = function(desiredState) - if desiredState == "Big" then - minimizedState.Visible = false - hideSmallPlayerWindow() + --print(maxXOffset) + NormalBounds = UDim2.new(0, maxXOffset,0,800) + NormalPosition = UDim2.new(1 , -NormalBounds.X.Offset, NormalPosition.Y.Scale, 0) + UpdateHeaderNameSize() + UpdateMaximize() - if previousBigPlayerList ~= nil then - if previousBigPlayerList ~= container:FindFirstChild("BigPlayerlist") then - pcall(function() game.GuiService:RemoveCenterDialog(previousBigPlayerList) end) - previousBigPlayerList = nil - previousBigPlayerList = container:FindFirstChild("BigPlayerlist") - end - else - previousBigPlayerList = container:FindFirstChild("BigPlayerlist") - end + AddingStatLock = false +end + --------------------------- + -- Minimizing and maximizing + --------------------------- - if previousBigPlayerList then - local firstShow = false - local centerDialogSupported, msg = pcall(function() game.GuiService:AddCenterDialog(previousBigPlayerList, Enum.CenterDialogType.PlayerInitiatedDialog, - function() - if not firstShow then - showBigPlayerWindow() - firstShow = true - else - previousBigPlayerList.Visible = true - end - end) - end) - if centerDialogSupported == false then - print("Exception", msg) - showBigPlayerWindow() - end - else - showBigPlayerWindow() - end - currentWindowState = "Big" - elseif desiredState == "Small" then - minimizedState.Visible = false - if previousBigPlayerList ~= nil then - pcall(function() game.GuiService:RemoveCenterDialog(previousBigPlayerList) end) - previousBigPlayerList = nil - end - - hideBigPlayerWindow() - if topRightTrayContainer:FindFirstChild("SmallPlayerlist") then - if not topRightTrayContainer.SmallPlayerlist.Visible or topRightTrayContainer.SmallPlayerlist.Position ~= smallWindowPosition then - topRightTrayContainer.SmallPlayerlist.Visible = true - topRightTrayContainer.SmallPlayerlist:TweenPosition(smallWindowPosition, Enum.EasingDirection.Out, smallEasingStyle, 0.3, true) - end - end - currentWindowState = "Small" - elseif desiredState == "None" then - if previousBigPlayerList ~= nil then - pcall(function() game.GuiService:RemoveCenterDialog(previousBigPlayerList) end) - previousBigPlayerList = nil - end - - local smallDone = false - local bigDone = false - hideSmallPlayerWindow( - function() - smallDone = true - if bigDone and smallDone then - minimizedState.Visible = true - end - end) - hideBigPlayerWindow( - function() - bigDone = true - if bigDone and smallDone then - minimizedState.Visible = true - end - end) - currentWindowState = "None" +function ToggleMinimize() + IsMinimized.Value = not IsMinimized.Value + UpdateStatNames() +end + +function ToggleMaximize() + IsMaximized.Value = not IsMaximized.Value + RecreateScoreColumns(PlayerFrames) --done to re-position stat names NOTE: optimize-able +end + +function Tabify() + IsTabified.Value= true + IsMaximized.Value=false + IsMinimized.Value=true + UpdateMinimize() + IsTabified.Value= true + ScreenGui:TweenPosition(UDim2.new(NormalBounds.X.Scale, NormalBounds.X.Offset-10, 0,0),'Out','Quad',1,true) +end + +function UnTabify() + if IsTabified.Value then + IsTabified.Value= false + ScreenGui:TweenPosition(UDim2.new(0, 0, 0,0),'Out','Quad',1,true) end end -local function getStatValuesForPlayer(player) - local leaderstats = player:FindFirstChild("leaderstats") - if leaderstats then - local children = leaderstats:GetChildren() - if children then - local result = {} - --Just go based on position - for i, stat in ipairs(children) do - if stat:IsA("IntValue") then - table.insert(result, stat) - else - table.insert(result, 0) - end - end +--[[ + Does more than it looks like + monitors positions of the clipping frames and bottom frames + called from EVERYWHERE, too much probably +--]] +function UpdateMinimize() - return result, leaderstats + if IsMinimized.Value then + if IsMaximized.Value then + ToggleMaximize() end - end - return nil -end - ---ChildAdded on Player (if it's name is "leaderstats") - -if UserSettings and LoadLibrary then - - RbxGui,msg = LoadLibrary("RbxGui") - - local function createTeamName(name, color) - local fontHeight = 20 - local frame = Instance.new("Frame") - frame.Name = "Team-" .. name - frame.BorderSizePixel = 0 - frame.BackgroundTransparency = 0.5 - frame.BackgroundColor3 = Color3.new(1,1,1) - frame.Size = UDim2.new(1, 0, 0, fontHeight) - frame.Position = UDim2.new(0,0,0,0) - - local label = Instance.new("TextLabel") - label.Name = "NameLabel" - label.Text = " " .. name - label.Font = Enum.Font.ArialBold - label.FontSize = Enum.FontSize.Size18 - label.Position = UDim2.new(0,0,0,0) - label.Size = UDim2.new(1,0,1,0) - label.TextColor3 = Color3.new(1,1,1) - label.BackgroundTransparency = 0.5 - label.BackgroundColor3 = getColor(color) - label.BorderSizePixel = 0 - label.TextXAlignment = Enum.TextXAlignment.Left - label = RbxGui.AutoTruncateTextObject(label) - label.Parent = frame - - return frame - end - - local function getFriendStatusIcon(friendStatus) - if friendStatus == Enum.FriendStatus.Unknown or friendStatus == Enum.FriendStatus.NotFriend then - return nil - elseif friendStatus == Enum.FriendStatus.Friend then - return "rbxasset://textures/ui/PlayerlistFriendIcon.png" - elseif friendStatus == Enum.FriendStatus.FriendRequestSent then - return "rbxasset://textures/ui/PlayerlistFriendRequestSentIcon.png" - elseif friendStatus == Enum.FriendStatus.FriendRequestReceived then - return "rbxasset://textures/ui/PlayerlistFriendRequestReceivedIcon.png" - else - error("Unknown FriendStatus: " .. friendStatus) - end - end - - local function getMembershipTypeIcon(membershipType) - if membershipType == Enum.MembershipType.None then - return "" - elseif membershipType == Enum.MembershipType.BuildersClub then - return "rbxasset://textures/ui/TinyBcIcon.png" - elseif membershipType == Enum.MembershipType.TurboBuildersClub then - return "rbxasset://textures/ui/TinyTbcIcon.png" - elseif membershipType == Enum.MembershipType.OutrageousBuildersClub then - return "rbxasset://textures/ui/TinyObcIcon.png" - else - error("Uknown membershipType" .. membershipType) - end - end - - - local function updatePlayerFriendStatus(nameObject, friendStatus) - local fontHeight = 20 - - local friendIconImage = getFriendStatusIcon(friendStatus) - nameObject.MembershipTypeLabel.FriendStatusLabel.Visible = (friendIconImage ~= nil) - - if friendIconImage ~= nil then - --Show friend icon - nameObject.MembershipTypeLabel.FriendStatusLabel.Image = friendIconImage - nameObject.NameLabel.Position =UDim2.new(0,2*fontHeight,0,1) - nameObject.NameLabel.Size = UDim2.new(1,-2*fontHeight,1,-2) - else - --Hide the friend icon - nameObject.NameLabel.Position = UDim2.new(0,fontHeight+1,0,1) - nameObject.NameLabel.Size = UDim2.new(1,-(fontHeight+1),1,-2) - end - end - local function updatePlayerName(nameObject, membershipStatus, teamColor) - local fontHeight = 20 - - nameObject.Size = UDim2.new(1,0,0,fontHeight) - nameObject.MembershipTypeLabel.Image = getMembershipTypeIcon(membershipStatus) - end - - - local function updatePlayerNameColor(player, teamColor) - local function updatePlayerNameColorHelper(nameObject) - if teamColor ~= nil then - nameObject.NameLabel.TextColor3 = getColor(teamColor) - nameObject.NameLabel.FullNameLabel.TextColor3 = getColor(teamColor) - else - nameObject.NameLabel.TextColor3 = Color3.new(1,1,1) - nameObject.NameLabel.FullNameLabel.TextColor3 = Color3.new(1,1,1) - end - end - - updatePlayerNameColorHelper(playerTable[player].NameObjectSmall) - updatePlayerNameColorHelper(playerTable[player].NameObjectBig) - end - - - local function createPlayerName(name, membershipStatus, teamColor, friendStatus) - local frame = Instance.new("Frame") - frame.Name = "Player_" .. name - if lightBackground then - frame.BackgroundColor3 = Color3.new(1,1,1) - else - frame.BackgroundColor3 = Color3.new(1,1,1) - end - frame.BackgroundTransparency = 0.5 - frame.BorderSizePixel = 0 - - local membershipStatusLabel = Instance.new("ImageLabel") - membershipStatusLabel.Name = "MembershipTypeLabel" - membershipStatusLabel.BackgroundTransparency = 1 - membershipStatusLabel.Size = UDim2.new(1,0,1,0) - membershipStatusLabel.Position = UDim2.new(0,0,0,0) - membershipStatusLabel.SizeConstraint = Enum.SizeConstraint.RelativeYY - membershipStatusLabel.Parent = frame - - local friendStatusLabel = Instance.new("ImageLabel") - friendStatusLabel.Name = "FriendStatusLabel" - friendStatusLabel.Visible = false - friendStatusLabel.BackgroundTransparency = 1 - friendStatusLabel.Size = UDim2.new(1,0,1,0) - friendStatusLabel.Position = UDim2.new(1,0,0,0) - friendStatusLabel.Parent = membershipStatusLabel - - local changeNameFunction - local nameLabel = Instance.new("TextLabel") - nameLabel.Name = "NameLabel" - nameLabel.Text = name - nameLabel.Font = Enum.Font.ArialBold - nameLabel.FontSize = Enum.FontSize.Size14 - nameLabel.TextColor3 = Color3.new(1,1,1) - nameLabel.BackgroundTransparency = 1 - nameLabel.BackgroundColor3 = Color3.new(0,0,0) - nameLabel.TextXAlignment = Enum.TextXAlignment.Left - nameLabel, changeNameFunction = RbxGui.AutoTruncateTextObject(nameLabel) - nameLabel.Parent = frame - - updatePlayerName(frame, membershipStatus, teamColor) - if supportFriends then - updatePlayerFriendStatus(frame, friendStatus) - else - updatePlayerFriendStatus(frame, Enum.FriendStatus.NotFriend) - end - return frame, changeNameFunction - end - - local function createStatColumn(i, numColumns, isTeam, color3, isHeader) - local textLabel = Instance.new("TextLabel") - textLabel.Name = "Stat" .. i - textLabel.TextColor3 = Color3.new(1,1,1) - textLabel.TextXAlignment = Enum.TextXAlignment.Right - textLabel.TextYAlignment = Enum.TextYAlignment.Center - textLabel.FontSize = Enum.FontSize.Size14 - if isHeader then - textLabel.FontSize = Enum.FontSize.Size18 - else - textLabel.FontSize = Enum.FontSize.Size14 - end - if isHeader or isTeam then - textLabel.Font = Enum.Font.ArialBold + if not IsTabified.Value then + MainFrame:TweenSizeAndPosition(UDim2.new(0.010, HeaderName.TextBounds.X, NormalBounds.Y.Scale,NormalBounds.Y.Offset), + UDim2.new(.990, -HeaderName.TextBounds.X, NormalPosition.Y.Scale,0),'Out','Quad',1,true) else - textLabel.Font = Enum.Font.Arial + MainFrame:TweenSizeAndPosition(NormalBounds,NormalPosition,'Out','Quad',1,true) end - - if isTeam then - textLabel.BackgroundColor3 = color3 - textLabel.Text = 0 - else - textLabel.BackgroundColor3 = Color3.new(0,0,0) - textLabel.Text = "" - end - textLabel.BackgroundTransparency = 1 - if i == numColumns then - textLabel.Size = UDim2.new(1/numColumns, -6, 1, 0) - else - textLabel.Size = UDim2.new(1/numColumns, -4, 1, 0) + --(#MiddleFrameBackgrounds*MiddleBGTemplate.Size.Y.Scale) + BottomClipFrame:TweenPosition(UDim2.new(0,0,-1,0), "Out", "Linear", .25,true) + BottomFrame:TweenPosition(UDim2.new(0,0,0,0), "Out", "Linear", .25,true) + FocusFrame.Size=UDim2.new(1,0,HeaderFrameHeight,0) + ExtendTab.Image = 'http://www.morblox.us/asset/?id=94692731' + else + if not IsMaximized.Value then + MainFrame:TweenSizeAndPosition(NormalBounds,NormalPosition,'Out','Quad',1,true) end + --do limiting + DefaultBottomClipPos = math.min(math.max(DefaultBottomClipPos,-1),-1+(#MiddleFrameBackgrounds*MiddleBGTemplate.Size.Y.Scale)) + UpdateScrollPosition() + -- + --BottomClipFrame:TweenPosition(UDim2.new(0,0,DefaultBottomClipPos,0), "Out", "Linear", .25,true) + BottomClipFrame.Position=UDim2.new(0,0,DefaultBottomClipPos,0) + --BottomFrame:TweenPosition(UDim2.new(0,0,((GetTotalEntries()) * MiddleTemplate.Size.Y.Scale),0), "Out", "Linear", .25,true) + local bottomPositon = (DefaultBottomClipPos+BottomClipFrame.Size.Y.Scale) + --BottomFrame:TweenPosition(UDim2.new(0,0,bottomPositon,0), "Out", "Linear", .25,true) + BottomFrame.Position=UDim2.new(0,0,bottomPositon,0) + FocusFrame.Size=UDim2.new(1,0,bottomPositon + HeaderFrameHeight,0) + ExtendTab.Image = 'http://www.morblox.us/asset/?id=94825585' --wat, why did I put this here? + + - textLabel.Position = UDim2.new((i-1) * (1/numColumns), 0, 0, 0) - return RbxGui.AutoTruncateTextObject(textLabel) end +end - local function createStatHeaders(stats, numColumns, isBig) - local frame = Instance.new("Frame") - frame.Name = "Headers" - frame.BorderSizePixel = 0 - frame.BackgroundColor3 = Color3.new(0,0,0) - frame.BackgroundTransparency = 1 - - local nameSize - if isBig then - nameSize = 0.5 - elseif numColumns == 1 then - nameSize = 0.7 - elseif numColumns == 2 then - nameSize = 0.6 - else - nameSize = 0.45 - end - frame.Size = UDim2.new(1-nameSize, 0, 1,0) - if isBig then - frame.Position = UDim2.new(nameSize,-25, 0,0) - else - frame.Position = UDim2.new(nameSize,0, 0,0) - end - - local i = 1 - while i <= numColumns do - local headerColumn, changeText = createStatColumn(i, numColumns, false, nil, true) - changeText(stats[i]) - headerColumn.Parent = frame - i = i + 1 - end - return frame, textChangers - end - - local function createStatColumns(nameObject, numColumns, isTeam, isBig) - local frame = Instance.new("Frame") - frame.Name = nameObject.Name .. "_WithStats" - frame.BorderSizePixel = 0 - frame.BackgroundColor3 = nameObject.BackgroundColor3 - frame.BackgroundTransparency = nameObject.BackgroundTransparency - frame.Size = nameObject.Size - frame.Position = nameObject.Position - - nameObject.BackgroundTransparency = 1 - - if numColumns == 0 then - nameObject.Size = UDim2.new(1,0,1,0) - nameObject.Position = UDim2.new(0,0,0,0) - nameObject.Parent = frame - return frame - end - - local statFrame = Instance.new("Frame") - statFrame.Name = "Stats" - if isTeam then - statFrame.BorderSizePixel = 0 - statFrame.BackgroundColor3 = nameObject.NameLabel.BackgroundColor3 - statFrame.BackgroundTransparency = nameObject.NameLabel.BackgroundTransparency - else - statFrame.BackgroundTransparency = 1 +--[[ + Manages the position/size of the mainFrame, swaps out different resolution images for the frame + fades in and out the stat names, moves position of headername and header score +--]] +function UpdateMaximize() + if IsMaximized.Value then + for j = 1, #ScoreNames,1 do + local scoreval = ScoreNames[j] + StatTitles[scoreval['Name'] ]:TweenPosition(UDim2.new(.4+((.6/#ScoreNames)*(j-1)),0,0,0),'Out','Quad',.25,true) end - local nameSize - if isBig then - nameSize = 0.5 - elseif numColumns == 1 then - nameSize = 0.7 - elseif numColumns == 2 then - nameSize = 0.6 + if IsMinimized.Value then + ToggleMinimize() else - nameSize = 0.45 + UpdateMinimize() end - nameObject.Size = UDim2.new(nameSize, 0, 1, 0) - nameObject.Position = UDim2.new(0, 0, 0, 0) - statFrame.Size = UDim2.new(1-nameSize,0, 1,0) - statFrame.Position = UDim2.new(nameSize,0, 0,0) - - nameObject.Parent = frame - statFrame.Parent = frame - local textChangers = {} - local i = 1 - while i <= numColumns do - local statColumn, changeText = createStatColumn(i, numColumns, isTeam, statFrame.BackgroundColor3) - statColumn.Parent = statFrame - table.insert(textChangers, changeText) - i = i + 1 - end - - return frame, statFrame, textChangers - end - - local function createAlternatingRows(objects) - for i, line in ipairs(objects) do - if i % 2 == 0 then - line.BackgroundTransparency = 1 + MainFrame:TweenSizeAndPosition(MaximizedBounds,MaximizedPosition,'Out','Quad',1,true) + HeaderScore:TweenPosition(UDim2.new(0,0,HeaderName.Position.Y.Scale,0), "Out", "Linear", .25,true) + HeaderName:TweenPosition(UDim2.new( - .1, - HeaderScore.TextBounds.x,HeaderName.Position.Y.Scale,0), "Out", "Linear", .25,true) + HeaderFrame.Background.Image = 'http://www.morblox.us/asset/?id='..Images['LargeHeader'] + BottomFrame.Background.Image = 'http://www.morblox.us/asset/?id='..Images['LargeBottom'] + for index, i in ipairs(MiddleFrameBackgrounds) do + if (index%2) ~= 1 then + i.Background.Image = 'http://www.morblox.us/asset/?id='..Images['LargeDark'] else - line.BackgroundTransparency = 0.95 + i.Background.Image = 'http://www.morblox.us/asset/?id='..Images['LargeLight'] end end - end - local removeFromTeam = nil - - local function clearTableEntry(obj, tableInfo) - if tableInfo.MainObjectSmall then - tableInfo.MainObjectSmall.Parent = nil - tableInfo.MainObjectSmall = nil - end - if tableInfo.MainObjectBig then - tableInfo.MainObjectBig.Parent = nil - tableInfo.MainObjectBig = nil - end - if tableInfo.Connections then - for i, connection in ipairs(tableInfo.Connections) do - connection:disconnect() + for index, i in ipairs(MiddleFrames) do + if i:FindFirstChild('ClickListener') then + i.ClickListener.Size = UDim2.new(.974,0,i.ClickListener.Size.Y.Scale,0) end - tableInfo.Connections = nil - end - if tableInfo.LeaderStatConnections then - for i, connection in ipairs(tableInfo.LeaderStatConnections) do - connection:disconnect() + for j=1, #ScoreNames,1 do + local scoreval = ScoreNames[j] + if i:FindFirstChild(scoreval['Name']) then + i[scoreval['Name']]:TweenPosition(UDim2.new(.4+((.6/#ScoreNames)*(j-1)),0,0,0), "Out", "Linear", .25,true) + end end - tableInfo.LeaderStatConnections = nil end - if tableInfo.CurrentTeam then - removeFromTeam(obj) - tableInfo.CurrentTeam = nil - end - if tableInfo.Players then - for i, player in ipairs(tableInfo.Players) do - playerTable[player].CurrentTeam = nil - end - tableInfo.Players = {} - end - if tableInfo.StatValues then - tableInfo.StatValues = nil - end - end - - local function resetPlayerTable() - for player, info in pairs(playerTable) do - clearTableEntry(player, info) - playerTable[player] = nil - end - playerTable = {} - end - - local function resetTeamTable() - for team, info in pairs(teamTable) do - clearTableEntry(team, info) - teamTable[team] = nil - end - teamTable = {} - teamColorTable = {} - end - - local function getBoardTypeInfo() - local isTeam = (currentBoardType == "TeamScore" or currentBoardType == "TeamList") - local isScore = (currentBoardType == "TeamScore" or currentBoardType == "PlayerScore") - return isTeam, isScore - end - - - local function recomputeTeamScore(team, column) - if not team or team == "Neutral" then - return + for i,entry in ipairs(PlayerFrames) do + WaitForChild(entry['Frame'],'TitleFrame').Size=UDim2.new(.38,0,entry['Frame'].TitleFrame.Size.Y.Scale,0) end - local function recomputeScoreHelper(statChangers) - if statChangers and column <= #statChangers then - local sum = 0 - for i, p in ipairs(teamTable[team].Players) do - if playerTable[p].StatValues and column <= #playerTable[p].StatValues then - sum = sum + playerTable[p].StatValues[column].Value - end - end - statChangers[column](sum) - end + for i,entry in ipairs(TeamFrames) do + WaitForChild(entry['Frame'],'TitleFrame').Size=UDim2.new(.38,0,entry['Frame'].TitleFrame.Size.Y.Scale,0) end - - recomputeScoreHelper(teamTable[team].StatChangersSmall) - recomputeScoreHelper(teamTable[team].StatChangersBig) - end - local function recomputeCompleteTeamScore(team) - local col = 1 - while col <= currentStatCount do - recomputeTeamScore(team, col) - col = col + 1 + + else + if not IsMinimized.Value then + MainFrame:TweenSizeAndPosition(NormalBounds,NormalPosition,'Out','Quad',1,true) end - end - removeFromTeam = function(player) - if playerTable[player].CurrentTeam ~= nil and teamTable[playerTable[player].CurrentTeam] ~= nil then - ArrayRemove(teamTable[playerTable[player].CurrentTeam].Players, player) - recomputeCompleteTeamScore(playerTable[player].CurrentTeam) - playerTable[player].CurrentTeam = nil - end - end - - local function assignToTeam(player) - local isTeam, isScore = getBoardTypeInfo() - - if isTeam then - local newTeam = nil - - if player.Neutral or teamColorTable[player.TeamColor.Name] == nil then - newTeam = "Neutral" + HeaderScore:TweenPosition(UDim2.new(0,0,.4,0), "Out", "Linear", .25,true) + HeaderName:TweenPosition(UDim2.new(0,0,HeaderName.Position.Y.Scale,0), "Out", "Linear", .25,true) + HeaderFrame.Background.Image = 'http://www.morblox.us/asset/?id='..Images['NormalHeader'] + BottomFrame.Background.Image = 'http://www.morblox.us/asset/?id='..Images['NormalBottom'] + for index, i in ipairs(MiddleFrameBackgrounds) do + if index%2 ~= 1 then + i.Background.Image = 'http://www.morblox.us/asset/?id='..Images['midDark'] else - newTeam = teamColorTable[player.TeamColor.Name] - end - - if playerTable[player].CurrentTeam == newTeam then - return - end - - removeFromTeam(player) - - playerTable[player].CurrentTeam = newTeam - if teamTable[newTeam] then table.insert(teamTable[newTeam].Players, player) end - - if newTeam == "Neutral" then - updatePlayerNameColor(player, nil) - else - updatePlayerNameColor(player, player.TeamColor) - end - - recomputeCompleteTeamScore(newTeam) - - --Relayout - if sortPlayerListsFunction then - sortPlayerListsFunction() + i.Background.Image = 'http://www.morblox.us/asset/?id='..Images['midLight'] end end + for index, i in ipairs(MiddleFrames) do + if i:FindFirstChild('ClickListener') then + i.ClickListener.Size = UDim2.new(.96,0,i.ClickListener.Size.Y.Scale,0) + for j=1, #ScoreNames,1 do + local scoreval = ScoreNames[j] + --print(scoreval['XOffset']) + if i:FindFirstChild(scoreval['Name']) and scoreval['XOffset'] then + --print('updateing stat position: ' .. scoreval['Name']) + i[scoreval['Name']]:TweenPosition(UDim2.new(0,scoreval['XOffset'],0,0), "Out", "Linear", .25,true) + end + end + end + end + + for i,entry in ipairs(TeamFrames) do + WaitForChild(entry['Frame'],'TitleFrame').Size=UDim2.new(0,BaseScreenXSize*.9,entry['Frame'].TitleFrame.Size.Y.Scale,0) + + end + for i,entry in ipairs(PlayerFrames) do + WaitForChild(entry['Frame'],'TitleFrame').Size=UDim2.new(0,BaseScreenXSize*.9,entry['Frame'].TitleFrame.Size.Y.Scale,0) + end + end +end + +function UpdateStatNames() + if not AreNamesExpanded.Value or IsMinimized.Value then + CloseNames() + else + ExpandNames() + end +end + +function ExpandNames() + --print('enered expand names') + if #ScoreNames ~= 0 then + for _,i in pairs(StatTitles:GetChildren()) do + --print (tostring(#ScoreNames) .. " is expanding") + Spawn(function()TweenTextTransparency(i,i.TextTransparency,0,.25) end) + end + HeaderFrameHeight=.09 + --as of writing, this and 'CloseNames' are the only places headerframe is resized + HeaderFrame:TweenSizeAndPosition(UDim2.new(HeaderFrame.Size.X.Scale, HeaderFrame.Size.X.Offset, HeaderFrameHeight,0), + HeaderFrame.Position,'Out','Quad',.25,true) + TopClipFrame:TweenPosition(UDim2.new(TopClipFrame.Position.X.Scale,0,HeaderFrameHeight,0),'Out','Quad',.25,true) + BottomShiftFrame:TweenPosition(UDim2.new(0,0,HeaderFrameHeight,0), "Out", 'Quad', .25,true) + end - local function buildTeamObject(team, numStatColumns, suffix) - local isTeam, isScore = getBoardTypeInfo() - local teamObject = createTeamName(team.Name, team.TeamColor) - if not teamTable[team] then - teamTable[team] = {} +end + +function CloseNames() + --print('close names called') + if #ScoreNames ~= 0 then + HeaderFrameHeight=.07 + if not (IsMaximized.Value) then + for _,i in pairs(StatTitles:GetChildren()) do + Spawn(function()TweenTextTransparency(i,i.TextTransparency,1,.25) end) + end end - teamTable[team]["NameObject" .. suffix] = teamObject - if isScore then - local statObject - local textChangers - teamObject, statObject, textChangers = createStatColumns(teamObject, numStatColumns, true, suffix == "Big") - teamTable[team]["StatObject" .. suffix] = statObject - teamTable[team]["StatChangers" .. suffix] = textChangers - end - teamTable[team]["MainObject" .. suffix] = teamObject - if not teamTable[team].Players then - teamTable[team].Players = {} - end - return teamObject + BottomShiftFrame:TweenPosition(UDim2.new(0,0,HeaderFrameHeight,0), "Out", 'Quad', .25,true) + HeaderFrame:TweenSizeAndPosition(UDim2.new(HeaderFrame.Size.X.Scale, HeaderFrame.Size.X.Offset, HeaderFrameHeight,0), + HeaderFrame.Position,'Out','Quad',.25,true) + TopClipFrame:TweenPosition(UDim2.new(TopClipFrame.Position.X.Scale,0,HeaderFrameHeight,0),'Out','Quad',.25,true) end - - local currentContextMenuPlayer = nil - local function updatePlayerContextMenu(player) - currentContextMenuPlayer = player - local elementHeight = 20 - local function highlight(button) - button.TextColor3 = Color3.new(0,0,0) - button.BackgroundColor3 = Color3.new(0.8,0.8,0.8) - end - local function clearHighlight(button) - button.TextColor3 = Color3.new(1,1,1) - button.BackgroundColor3 = Color3.new(0,0,0) - end - if playerContextMenu == nil then - playerContextMenu = Instance.new("Frame") - playerContextMenu.Name = "PlayerListContextMenu" - playerContextMenu.BackgroundTransparency = 1 - playerContextMenu.Visible = false - - local playerContextMenuButton = Instance.new("TextButton") - playerContextMenuButton.Name = "PlayerListContextMenuButton" - playerContextMenuButton.Text = "" - playerContextMenuButton.Style = Enum.ButtonStyle.RobloxButtonDefault - playerContextMenuButton.ZIndex = 4 - playerContextMenuButton.Size = UDim2.new(1, 0, 1, -20) - playerContextMenuButton.Visible = true - playerContextMenuButton.Parent = playerContextMenu +end - for i, contextElement in ipairs(contextMenuElements) do - local element = contextElement - if element.Type == "Button" then - local button = Instance.new("TextButton") - button.Name = "ContextButton" .. i - button.BackgroundColor3 = Color3.new(0,0,0) - button.BorderSizePixel = 0 - button.TextXAlignment = Enum.TextXAlignment.Left - button.Text = " " .. contextElement.Text - button.Font = Enum.Font.Arial - button.FontSize = Enum.FontSize.Size14 - button.Size = UDim2.new(1, 8, 0, elementHeight) - button.TextColor3 = Color3.new(1,1,1) - button.ZIndex = 4 - button.Parent = playerContextMenuButton - button.MouseButton1Click:connect(function() - if button.Active then - local success, result = pcall(function() element.DoIt(currentContextMenuPlayer) end) - playerContextMenu.Visible = false - end - end) - - button.MouseEnter:connect(function() - if button.Active then - highlight(button) - end - end) - button.MouseLeave:connect(function() - if button.Active then - clearHighlight(button) - end - end) - - contextElement.Button = button - contextElement.Element = button - elseif element.Type == "Label" then - local frame = Instance.new("Frame") - frame.Name = "ContextLabel" .. i - frame.BackgroundTransparency = 1 - frame.Size = UDim2.new(1, 8, 0, elementHeight) - - local label = Instance.new("TextLabel") - label.Name = "Text1" - label.BackgroundTransparency = 1 - label.BackgroundColor3 = Color3.new(1,1,1) - label.BorderSizePixel = 0 - label.TextXAlignment = Enum.TextXAlignment.Left - label.Font = Enum.Font.ArialBold - label.FontSize = Enum.FontSize.Size14 - label.Position = UDim2.new(0.0, 0, 0, 0) - label.Size = UDim2.new(0.5, 0, 1, 0) - label.TextColor3 = Color3.new(1,1,1) - label.ZIndex = 4 - label.Parent = frame - element.Label1 = label - - if element.GetText2 then - label = Instance.new("TextLabel") - label.Name = "Text2" - label.BackgroundTransparency = 1 - label.BackgroundColor3 = Color3.new(1,1,1) - label.BorderSizePixel = 0 - label.TextXAlignment = Enum.TextXAlignment.Right - label.Font = Enum.Font.Arial - label.FontSize = Enum.FontSize.Size14 - label.Position = UDim2.new(0.5, 0, 0, 0) - label.Size = UDim2.new(0.5, 0, 1, 0) - label.TextColor3 = Color3.new(1,1,1) - label.ZIndex = 4 - label.Parent = frame - element.Label2 = label - end - frame.Parent = playerContextMenuButton - element.Label = frame - element.Element = frame - end - end +function OnScrollWheelMove(direction) + if not (IsTabified.Value or IsMinimized.Value or InPopupWaitForClick) then + local StartFrame = ListFrame.Position + local newFrameY = math.max(math.min(StartFrame.Y.Scale + (direction),GetMaxScroll()),GetMinScroll()) - playerContextMenu.ZIndex = 4 - playerContextMenu.MouseLeave:connect(function() playerContextMenu.Visible = false end) - robloxLock(playerContextMenu) - playerContextMenu.Parent = script.Parent - - end - - local elementPos = 0 - for i, contextElement in ipairs(contextMenuElements) do - local isVisible = false - - if contextElement.IsVisible then - local success, visible = pcall(function() return contextElement.IsVisible(currentContextMenuPlayer) end) - if success then - isVisible = visible - else - print("Error in IsVisible call: " .. visible) - end - end - - if contextElement.Type == "Button" then - contextElement.Button.Visible = isVisible - if contextElement.Button.Visible then - isVisible = true - clearHighlight(contextElement.Button) - if contextElement.IsActive then - local success, active = pcall(function() return contextElement.IsActive(currentContextMenuPlayer) end) - if success then - contextElement.Button.Active = active - else - print("Error in IsActive call: " .. active) - end - end - if contextElement.Button.Active then - contextElement.Button.TextColor3 = Color3.new(1,1,1) - else - contextElement.Button.TextColor3 = Color3.new(0.7,0.7,0.7) - end - end - elseif contextElement.Type == "Label" then - contextElement.Label.Visible = isVisible - if contextElement.Label.Visible then - local success, text = pcall(function() return contextElement.GetText1(currentContextMenuPlayer) end) - if success then - contextElement.Label1.Text = " " .. text - else - print("Error in GetText1 call: " .. text) - end - - if contextElement.GetText2 then - local success, text = pcall(function() return contextElement.GetText2(currentContextMenuPlayer) end) - if success then - contextElement.Label2.Text = " " .. text - else - print("Error in GetText2 call: " .. text) - end - end - end - end - if isVisible then - contextElement.Element.Position = UDim2.new(0,-4, 0, elementPos * elementHeight - 4) - elementPos = elementPos + 1 - end - end - playerContextMenu.Size = UDim2.new(0, 150, 0, elementPos*elementHeight + 13 + 20) - end - local function showPlayerMenu(player, x, y) - updatePlayerContextMenu(player) - x = x - (playerContextMenu.AbsoluteSize.X/2) - if x + playerContextMenu.AbsoluteSize.X >= script.Parent.AbsoluteSize.X then - x = script.Parent.AbsoluteSize.X - playerContextMenu.AbsoluteSize.X - end - playerContextMenu.Visible = true - playerContextMenu.Position = UDim2.new(0, x, 0, y-playerContextMenu.AbsoluteSize.Y) + ListFrame.Position = UDim2.new(StartFrame.X.Scale,StartFrame.X.Offset,newFrameY,StartFrame.Y.Offset) + UpdateScrollPosition() end +end - local function buildPlayerObject(player, numStatColumns, suffix) - if not player then return nil end - - local isTeam, isScore = getBoardTypeInfo() +function AttachScrollWheel() + if ScrollWheelConnections then return end + local pmouse = LocalPlayer:GetMouse() + ScrollWheelConnections = {} + table.insert(ScrollWheelConnections,pmouse.WheelForward:connect(function() + OnScrollWheelMove(.05) + end)) + table.insert(ScrollWheelConnections,pmouse.WheelBackward:connect(function() + OnScrollWheelMove(-.05) + end)) +end - local playerObject = nil - local changePlayerNameFunction = nil - local currentColor = nil - if isTeam and not player.Neutral then - currentColor = player.TeamColor.Color - else - currentColor = Color3.new(1,1,1) - end - playerObject, changePlayerNameFunction = createPlayerName(player.Name, player.MembershipType, currentColor, getFriendStatus(player)) - - if not playerTable[player] then - playerTable[player] = {} - end - if not playerTable[player].Connections then - playerTable[player].Connections = {} - end - if not playerTable[player].CurrentTeam then - playerTable[player].CurrentTeam = nil - end - playerTable[player]["NameObject" .. suffix] = playerObject - playerTable[player]["ChangeName" .. suffix] = changePlayerNameFunction - - if isScore then - local statObject = nil - local textChangers = nil - playerObject, statObject, textChangers = createStatColumns(playerObject, numStatColumns, false, suffix == "Big") - playerTable[player]["StatObject" .. suffix]= statObject - playerTable[player]["StatChangers" .. suffix] = textChangers - - local statValues, leaderstats = getStatValuesForPlayer(player) - if not statValues or #statValues < numStatColumns then - if not playerTable[player].LeaderStatConnections then - playerTable[player].LeaderStatConnections = {} - end - --Setup a listener to see when this data gets filled in - if not leaderstats then - --We don't even have a leaderstats child, wait for one - table.insert(playerTable[player].LeaderStatConnections, - player.ChildAdded:connect( - function(child) - if child.Name == "leaderstats" then - --Connections will be torn down - recreatePlayerFunction(player) - else - table.insert(playerTable[player].LeaderStatConnections, - child.Changed:connect( - function(prop) - if prop == "Name" and child.Name == "leaderstats" then - --Connections will be torn down - recreatePlayerFunction(player) - end - end)) - end - end)) - else - --We have a leaderstats, but not enough children, recreate if we get them - table.insert(playerTable[player].LeaderStatConnections, - leaderstats.ChildAdded:connect( - function(child) - --TODO only look for IntValue - recreatePlayerFunction(player) - end) - ) - table.insert(playerTable[player].LeaderStatConnections, - leaderstats.AncestryChanged:connect( - function(child) - --We got deleted, try again - recreatePlayerFunction(player) - end) - ) - end - end - if statValues then - if not playerTable[player].StatValues then - playerTable[player].StatValues = {} - end - local pos = 1 - while pos <= numStatColumns and pos <= #statValues do - local currentColumn = pos - local statValue = statValues[pos] - local statChanger = textChangers[pos] - - local updateStat = function(val) - statChanger(val) - if playerTable[player] ~= nil then recomputeTeamScore(playerTable[player].CurrentTeam, currentColumn) end - end - if pos > #playerTable[player].StatValues then - table.insert(playerTable[player].StatValues, statValue) - end - - if type(statValue) ~= "number" and statValue["Changed"] then - table.insert(playerTable[player].Connections, - statValue.Changed:connect(updateStat) - ) - end - - table.insert(playerTable[player].Connections, - statValue.AncestryChanged:connect( - function() - recreatePlayerFunction(player) - end) - ) - updateStat(statValue.Value) - pos = pos + 1 - end - end - end - - if supportFriends and player ~= game.Players.LocalPlayer and player.userId > 0 and game.Players.LocalPlayer.userId > 0 then - local button = Instance.new("TextButton") - button.Name = playerObject.Name .. "Button" - button.Text = "" - button.Active = false - button.Size = playerObject.Size - button.Position = playerObject.Position - button.BackgroundColor3 = playerObject.BackgroundColor3 - - local secondButton = Instance.new("TextButton") - secondButton.Name = playerObject.Name .. "RealButton" - secondButton.Text = "" - secondButton.BackgroundTransparency = 1 - secondButton.BackgroundColor3 = playerObject.BackgroundColor3 - local theNameLabel = playerObject:findFirstChild("NameLabel",true) - if theNameLabel then - theNameLabel.TextColor3 = Color3.new(0,0,0) - secondButton.Parent = theNameLabel.FullNameLabel - end - secondButton.Parent.BackgroundTransparency = 1 - secondButton.Parent.Visible = true - secondButton.ZIndex = 2 - secondButton.Size = UDim2.new(1,0,1,0) - - local previousTransparency = nil - table.insert(playerTable[player].Connections, - secondButton.MouseEnter:connect( - function() - if previousTransparency == nil then - previousTransparency = secondButton.BackgroundTransparency - end - - if lightBackground then - secondButton.Parent.BackgroundTransparency = 0 - else - secondButton.Parent.BackgroundTransparency = 1 - end - end)) - table.insert(playerTable[player].Connections, - secondButton.MouseLeave:connect( - function() - if previousTransparency ~= nil then - previousTransparency = nil - end - secondButton.Parent.BackgroundTransparency = 1 - end)) - - local mouseDownX, mouseDownY - table.insert(playerTable[player].Connections, - secondButton.MouseButton1Down:connect(function(x,y) - mouseDownX = x - mouseDownY = y - end)) - table.insert(playerTable[player].Connections, - secondButton.MouseButton1Click:connect(function() - showPlayerMenu(player, mouseDownX, secondButton.AbsolutePosition.Y + secondButton.AbsoluteSize.Y ) - end)) - playerObject.BackgroundTransparency = 1 - playerObject.Size = UDim2.new(1,0,1,0) - playerObject.Position = UDim2.new(0,0,0,0) - playerObject.Parent = button - - playerTable[player]["MainObject" .. suffix] = button - - playerObject = button - else - playerTable[player]["MainObject" .. suffix] = playerObject - - if player == game.Players.LocalPlayer and supportFriends then - table.insert(playerTable[player].Connections, - player.FriendStatusChanged:connect( - function(otherPlayer, friendStatus) - if playerTable[otherPlayer] then - updatePlayerFriendStatus(playerTable[otherPlayer]["NameObject" .. suffix], friendStatus) - end - end) - ) - end - end - table.insert(playerTable[player].Connections, - player.Changed:connect( - function(prop) - if prop == "MembershipType" then - updatePlayerName(playerTable[player]["NameObject" .. suffix], player.MembershipType, currentColor) - elseif prop == "Name" then - playerTable[player]["ChangeName" .. suffix](player.Name) - elseif prop == "Neutral" or prop == "TeamColor" then - assignToTeam(player) - end - end) - ) - return playerObject - end - - local function orderScrollList(scrollOrder, objectName, scrollFrame) - local pos = 0 - local order = {} - local isTeam, isScore = getBoardTypeInfo() - for i, obj in ipairs(scrollOrder) do - order[obj] = 0 - end - - if isTeam then - local teams = getTeams() - for i, team in ipairs(teams) do - if teamTable[team][objectName] then order[teamTable[team][objectName]] = pos end - pos = pos + 1 - for i, player in ipairs(teamTable[team].Players) do - if playerTable[player] then - if playerTable[player][objectName] ~= nil then order[playerTable[player][objectName]] = pos end - pos = pos + 1 - end - end - end - - if #teamTable["Neutral"].Players > 0 then - teamTable["Neutral"][objectName].Parent = scrollFrame - order[teamTable["Neutral"][objectName]] = pos - pos = pos + 1 - for i, player in ipairs(teamTable["Neutral"].Players) do - if playerTable[player][objectName] ~= nil then order[playerTable[player][objectName]] = pos end - pos = pos + 1 - end - else - teamTable["Neutral"][objectName].Parent = nil - end - else - local players = getPlayers() - for i, player in ipairs(players) do - if playerTable[player] and playerTable[player][objectName] ~= nil then order[playerTable[player][objectName]] = pos end - pos = pos + 1 - end - end - - table.sort(scrollOrder, - function(a,b) - return order[a] < order[b] - end) - end - - local function createPlayerListBasics(frame, isBig) - local headerFrame = Instance.new("Frame") - headerFrame.Name = "Header" - headerFrame.BackgroundTransparency = 1 - headerFrame.Size = UDim2.new(1,-13,0,26) - headerFrame.Position = UDim2.new(0,0,0,0) - headerFrame.Parent = frame - - local lowerPaneFrame = Instance.new("Frame") - lowerPaneFrame.Name = "ScrollingArea" - lowerPaneFrame.BackgroundTransparency = 1 - lowerPaneFrame.Size = UDim2.new(1,-3,1,-26) - if not isBig then lowerPaneFrame.Size = UDim2.new(1,-3,1,-30) end - lowerPaneFrame.Position = UDim2.new(0,0,0,26) - lowerPaneFrame.Parent = frame - - local scrollOrder = {} - local scrollFrame, scrollUp, scrollDown, recalculateScroll = RbxGui.CreateScrollingFrame(scrollOrder) - - local scrollBar = Instance.new("Frame") - scrollBar.Name = "ScrollBar" - scrollBar.BackgroundTransparency = 0.9 - scrollBar.BackgroundColor3 = Color3.new(1,1,1) - scrollBar.BorderSizePixel = 0 - scrollBar.Size = UDim2.new(0, 17, 1, -36) - if isBig then scrollBar.Size = UDim2.new(0, 17, 1, -61) end - scrollBar.Parent = lowerPaneFrame - - scrollFrame.Parent = lowerPaneFrame - scrollUp.Parent = lowerPaneFrame - scrollDown.Parent = lowerPaneFrame - - if isBig then - scrollFrame.Position = UDim2.new(0,0,0,0) - scrollUp.Position = UDim2.new(1,-41,0,5) - scrollDown.Position = UDim2.new(1,-41,1,-35) - scrollBar.Position = UDim2.new(1, -41, 0, 24) - - scrollFrame.Size = UDim2.new(1,-48,1,-16) - headerFrame.Size = UDim2.new(1,-20,0,32) - - else - scrollBar.Position = UDim2.new(1, -15, 0, 14) - scrollBar.Size = UDim2.new(0,17,1,-36) - scrollFrame.Position = UDim2.new(0,1,0,0) - scrollUp.Position = UDim2.new(1,-15,0,-5) - scrollDown.Position = UDim2.new(1,-15,1,-20) - - lowerPaneFrame.Position = UDim2.new(0,0,0,30) - - local toggleScrollBar = function(visible) - if visible then - scrollFrame.Size = UDim2.new(1,-16,1,0) - headerFrame.Size = UDim2.new(1,-16,0,smallWindowHeaderYSize) - else - scrollFrame.Size = UDim2.new(1,0,1,0) - headerFrame.Size = UDim2.new(1,5,0,smallWindowHeaderYSize) - end - scrollUp.Visible = visible - scrollDown.Visible = visible - scrollBar.Visible = visible - end - scrollUp.Changed:connect(function(prop) - if prop == "Active" then - toggleScrollBar(scrollUp.Active or scrollDown.Active) - end - end) - - scrollDown.Changed:connect(function(prop) - if prop == "Active" then - toggleScrollBar(scrollUp.Active or scrollDown.Active) - end - end) - - toggleScrollBar(scrollUp.Active or scrollDown.Active) - end - return headerFrame, scrollFrame, recalculateScroll, scrollOrder - end - - createBoardsFunction = function (boardType, numStatColumns) - local smallFrame = Instance.new("Frame") - smallFrame.Name = "SmallPlayerlist" - smallFrame.Position = smallWindowPosition - smallFrame.Active = false - smallFrame.Size = smallWindowSize - smallFrame.BackgroundColor3 = Color3.new(0,0,0) - smallFrame.BackgroundTransparency = 0.7 - smallFrame.BorderSizePixel = 0 - - local bigFrame = Instance.new("Frame") - bigFrame.Name = "BigPlayerlist" - bigFrame.Size = bigWindowSize - bigFrame.Position = bigWindowPosition - bigFrame.BackgroundColor3 = Color3.new(0,0,0) - bigFrame.BackgroundTransparency = 0.7 - bigFrame.BorderSizePixel = 0 - bigFrame.Visible = false - - local bigFrameWrapper = Instance.new("Frame") - bigFrameWrapper.Name = "Expander" - bigFrameWrapper.Size = UDim2.new(1,21,1,16) - bigFrameWrapper.Position = UDim2.new(0, 0, 0,0) - bigFrameWrapper.BackgroundTransparency = 1 - bigFrameWrapper.Parent = bigFrame - - local smallHeaderFrame, scrollFrameSmall, recalculateScrollSmall, scrollOrderSmall = createPlayerListBasics(smallFrame, false) - local bigHeaderFrame, scrollFrameBig, recalculateScrollBig, scrollOrderBig = createPlayerListBasics(bigFrameWrapper, true) - - local playerListButton = Instance.new("ImageButton") - playerListButton.Name = "GoBigButton" - playerListButton.BackgroundTransparency = 1 - playerListButton.Image = "rbxasset://textures/ui/playerlist_small_maximize.png" - playerListButton.Size = UDim2.new(0.0, 35, 0, 29) - playerListButton.Position = UDim2.new(0, 0, 0, 0) - playerListButton.MouseButton1Click:connect( - function() - toggleBigWindow() - end) - playerListButton.Parent = smallHeaderFrame - - playerListButton = Instance.new("ImageButton") - playerListButton.Name = "CloseButton" - playerListButton.BackgroundTransparency = 1 - playerListButton.Image = "rbxasset://textures/ui/playerlist_small_hide.png" - playerListButton.Size = UDim2.new(0.0, 38, 0, 29) - playerListButton.Position = UDim2.new(0, 35, 0, 0) - playerListButton.MouseButton1Click:connect( - function() - transitionWindowsFunction("None") - end) - playerListButton.Parent = smallHeaderFrame - - playerListButton = Instance.new("ImageButton") - playerListButton.Name = "CloseButton" - playerListButton.Image = "rbxasset://textures/ui/playerlist_big_hide.png" - playerListButton.BackgroundTransparency = 1 - playerListButton.Size = UDim2.new(0.0, 29, 0, 29) - playerListButton.Position = UDim2.new(1, -30, 0.5, -15) - playerListButton.MouseButton1Click:connect( - function() - toggleBigWindow() - end) - playerListButton.Parent = bigHeaderFrame - - local placeName = Instance.new("TextLabel") - placeName.Name = "PlaceName" - placeName.Text = " Player List" - placeName.FontSize = Enum.FontSize.Size24 - placeName.TextXAlignment = Enum.TextXAlignment.Left - placeName.Font = Enum.Font.ArialBold - placeName.BackgroundTransparency = 1 - placeName.TextColor3 = Color3.new(1,1,1) - placeName.Size = UDim2.new(0.5, 0, 1, 0) - placeName.Position = UDim2.new(0, 0, 0.0, 0) - placeName = RbxGui.AutoTruncateTextObject(placeName) - placeName.Parent = bigHeaderFrame - - - currentBoardType = boardType - currentStatCount = numStatColumns - local isTeam, isScore = getBoardTypeInfo() - local players = getPlayers() - - if isScore then - local statColumns = getStatColumns(players) - numStatColumns = #statColumns - if numStatColumns > 3 then - numStatColumns = 3 - end - createStatHeaders(statColumns, numStatColumns, false).Parent = smallHeaderFrame - createStatHeaders(statColumns, currentStatCount, true).Parent = bigHeaderFrame - end - - --Clean up all old stuff - resetPlayerTable() - - for i, player in ipairs(players) do - local playerObject = buildPlayerObject(player, numStatColumns, "Small") - table.insert(scrollOrderSmall, playerObject) - playerObject.Parent = scrollFrameSmall - - playerObject = buildPlayerObject(player, currentStatCount, "Big") - table.insert(scrollOrderBig, playerObject) - playerObject.Parent = scrollFrameBig - end - - --Clean up old stuff - resetTeamTable() - - local teamStatObjects = {} - if isTeam then - local teams = getTeams() - local i = #teams - while i >= 1 do - --We go backwards so the "first" team color gets the team - local team = teams[i] - teamColorTable[team.TeamColor.Name] = team - i = i - 1 - end - - --Adding/Removing a Team causes a full invalidation of the board - for i, team in ipairs(teams) do - local teamObject = buildTeamObject(team, numStatColumns, "Small") - table.insert(scrollOrderSmall, teamObject) - teamObject.Parent = scrollFrameSmall - - teamObject = buildTeamObject(team, currentStatCount, "Big") - table.insert(scrollOrderBig, teamObject) - teamObject.Parent = scrollFrameBig - end - - teamTable["Neutral"] = {} - teamTable["Neutral"].Players = {} - - local neutralTeamObject = createTeamName("Neutral", BrickColor.palette(8)) - teamTable["Neutral"].NameObjectSmall = neutralTeamObject - teamTable["Neutral"].StatObjectSmall = nil - teamTable["Neutral"].MainObjectSmall = neutralTeamObject - table.insert(scrollOrderSmall, neutralTeamObject) - - neutralTeamObject = createTeamName("Neutral", BrickColor.palette(8)) - teamTable["Neutral"].NameObjectBig = neutralTeamObject - teamTable["Neutral"].StatObjectBig = nil - teamTable["Neutral"].MainObjectBig = neutralTeamObject - table.insert(scrollOrderBig, neutralTeamObject) - - local neutralPlayers = {} - for i, player in ipairs(players) do - assignToTeam(player) - end - end - - removePlayerFunction = function(player) - if playerTable[player] then - clearTableEntry(player, playerTable[player]) - - ArrayRemove(scrollOrderSmall, playerTable[player].MainObjectSmall) - ArrayRemove(scrollOrderBig, playerTable[player].MainObjectBig) - - playerTable[player] = nil - recalculateSmallPlayerListSize(smallFrame) - end - end - recreatePlayerFunction = function(player) - removePlayerFunction(player) - - local playerObject = buildPlayerObject(player, numStatColumns, "Small") - table.insert(scrollOrderSmall, playerObject) - robloxLock(playerObject) - playerObject.Parent = scrollFrameSmall - - playerObject = buildPlayerObject(player, currentStatCount, "Big") - table.insert(scrollOrderBig, playerObject) - robloxLock(playerObject) - playerObject.Parent = scrollFrameBig - - local isTeam, isScore = getBoardTypeInfo() - if isTeam then - assignToTeam(player) - end - - sortPlayerListsFunction() - recalculateSmallPlayerListSize(smallFrame) - end - - if screenResizeCon then screenResizeCon:disconnect() end - screenResizeCon = screen.Changed:connect( - function(prop) - if prop == "AbsoluteSize" then - wait() - recalculateSmallPlayerListSize(smallFrame) - end - end) - - sortPlayerListsFunction = function() - orderScrollList(scrollOrderSmall, "MainObjectSmall", scrollFrameSmall) - recalculateScrollSmall() - createAlternatingRows(scrollOrderSmall) - - orderScrollList(scrollOrderBig, "MainObjectBig", scrollFrameBig) - recalculateScrollBig() - createAlternatingRows(scrollOrderBig) - end - - sortPlayerListsFunction() - - robloxLock(smallFrame) - robloxLock(bigFrame) - return smallFrame, bigFrame - end - - --Teams changing invalidates the whole board - local function teamsChanged() - if debounceTeamsChanged then - return - end - - debounceTeamsChanged = true - wait() - rebuildBoard(script.Parent, determineBoardType()) - debounceTeamsChanged = false - end - - - local checkIfBoardChanged = function() - local newBoardType, numStats = determineBoardType() - if newBoardType ~= currentBoardType or numStats ~= currentStatCount then - rebuildBoard(script.Parent, newBoardType, numStats) +function DetachScrollWheel() + if ScrollWheelConnections then + for _,i in pairs(ScrollWheelConnections) do + i:disconnect() end end + ScrollWheelConnections=nil +end - local function buildPlayerList() - waitForChild(game, "Players") - waitForProperty(game.Players, "LocalPlayer") +FocusFrame.MouseEnter:connect(function() + if not (IsMinimized.Value or IsTabified.Value) then + AttachScrollWheel() + end +end) +FocusFrame.MouseLeave:connect(function() + --if not (IsMaximized.Value or IsMinimized.Value) then + DetachScrollWheel() + --end +end) - local playerListEnabled = testPlayerListPlaces[game.PlaceId] or enablePlayerListGlobally - if localTesting and (game.PlaceId == 0) or (game.PlaceId == -1) then - playerListEnabled = true - end - if not playerListEnabled then - --No playerlist - return - end - - supportFriends = testFriendingPlaces[game.PlaceId] or enableFriendingGlobally - if localTesting and (game.PlaceId == 0) or (game.PlaceId == -1) then - supportFriends = true - end - - local teams = game:GetService("Teams") - if teams then - local teamConnections = {} - - teams.ChildAdded:connect( - function(child) - if child:IsA("Team") then - teamsChanged() - teamConnections[child] = child.Changed:connect( - function(prop) - if prop == "TeamColor" or prop == "Name" then - --Rebuild when things change - teamsChanged() - end - end) - end - end) - teams.ChildRemoved:connect( - function(child) - if child:IsA("Team") then - if teamConnections[child] then - teamConnections[child]:disconnect() - teamConnections[child] = nil - end - teamsChanged() - end - end) - end - - game.Players.ChildAdded:connect( - function(player) - if player:IsA("Player") then - addPlayerFunction(player) - end - end) - - game.Players.ChildRemoved:connect( - function(player) - if player:IsA("Player") then - if removePlayerFunction then - removePlayerFunction(player) - end - end - end) - - rebuildBoard(script.Parent, determineBoardType()) - game.GuiService.ShowLegacyPlayerList = false - - game.GuiService:AddKey("\t") - local lastTime = nil - game.GuiService.KeyPressed:connect( - function(key) - if key == "\t" then - local modalCheck, isModal = pcall(function() return game.GuiService.IsModalDialog end) - if modalCheck == false or (modalCheck and isModal == false) then - local currentTime = time() - if lastTime == nil or currentTime - lastTime > 0.4 then - lastTime = currentTime - toggleBigWindow() - end - end - end - end) - - delay(0, - function() - while true do - wait(5) - checkIfBoardChanged() - end - end) - end - - if game.CoreGui.Version >= 2 then - buildPlayerList() + ------------------------ + -- Scroll Bar functions + ------------------------ +--[[ + updates whether the scroll bar should be showing, if it is showing, updates + the size of it +--]] +function UpdateScrollBarVisibility() + if AreAllEntriesOnScreen() then + ScrollBar.BackgroundTransparency = 1 + else + ScrollBar.BackgroundTransparency = 0 + UpdateScrollBarSize() end end +--[[ + updates size of scrollbar depending on how many entries exist +--]] +function UpdateScrollBarSize() + local entryListSize = #MiddleFrameBackgrounds * MiddleTemplate.Size.Y.Scale + local shownAreaSize = ((BottomClipFrame.Position.Y.Scale) + 1) + ScrollBar.Size = UDim2.new(1,0,shownAreaSize/entryListSize,0) + +end +--[[ + updates position of listframe so that no gaps at the bottom or top of the list are visible + updates position of scrollbar to match what parts of the list are visible +--]] +function UpdateScrollPosition() + local minPos = GetMinScroll() + local maxPos = GetMaxScroll() + local scrollLength = maxPos - minPos + + local yscrollpos=math.max(math.min(ListFrame.Position.Y.Scale,maxPos),minPos) + ListFrame.Position=UDim2.new(ListFrame.Position.X.Scale,ListFrame.Position.X.Offset,yscrollpos,ListFrame.Position.Y.Offset) + + local adjustedLength = 1 - ScrollBar.Size.Y.Scale + ScrollBar.Position = UDim2.new(0,0,adjustedLength - (adjustedLength * ((ListFrame.Position.Y.Scale - minPos)/scrollLength)),0) +end + +--[[ + WARNING:this is in a working state, but uses massive hacks + revize when global input is available + Manages scrolling of the playerlist on mouse drag +--]] +function StartDrag() + Delay(0,function() + debugprint('Got Click') + local stopDrag = false + local function dragExit() + debugprint('undone click') + stopDrag = true + end + local startY = nil --AbsoluteToPercent(Mouse.X,Mouse.Y).Y + local StartFrame = ListFrame.Position + local function dragpoll(nx,ny) + if not startY then + startY = AbsoluteToPercent(nx,ny).Y + end + local nowY = AbsoluteToPercent(nx,ny).Y + local newFrameY + if OnIos then + newFrameY = math.max(math.min(StartFrame.Y.Scale + (nowY - startY),GetMaxScroll()),GetMinScroll()) + else + newFrameY = math.max(math.min(StartFrame.Y.Scale - (nowY - startY),GetMaxScroll()),GetMinScroll()) + end + ListFrame.Position = UDim2.new(StartFrame.X.Scale,StartFrame.X.Offset,newFrameY,StartFrame.Y.Offset) + UpdateScrollPosition() + end + Spawn(function() WaitForClick(ScreenGui,dragpoll,dragExit) end) + end) +end + + +function StartMinimizeDrag() + Delay(0,function() + local startTime=tick() + debugprint('Got Click2') + local stopDrag = false + local function dragExit() + debugprint('undone click2') + if tick()-startTime<.25 then --was click + ToggleMinimize() + else --was drag + DidMinimizeDrag = true + if IsMinimized.Value then + ToggleMinimize() + end + end + stopDrag = true + end + local startY = nil + local StartFrame = DefaultBottomClipPos + local function dragpoll(nx,ny) + if not IsMinimized.Value then + + if not startY then + startY = AbsoluteToPercent(nx,ny).Y + end + local nowY = AbsoluteToPercent(nx,ny).Y + local newFrameY + newFrameY = math.min(math.max(StartFrame + (nowY - startY),-1),-1+(#MiddleFrameBackgrounds*MiddleBGTemplate.Size.Y.Scale)) + DefaultBottomClipPos = newFrameY + UpdateMinimize() + ScrollBarFrame.Size= UDim2.new(ScrollBarFrame.Size.X.Scale,0,(DefaultBottomClipPos+BottomClipFrame.Size.Y.Scale),0) + ScrollBarFrame.Position= UDim2.new(ScrollBarFrame.Position.X.Scale,0,1-ScrollBarFrame.Size.Y.Scale,0) + UpdateScrollBarSize() + UpdateScrollPosition() + UpdateScrollBarVisibility() + + end + end + Spawn(function() WaitForClick(ScreenGui,dragpoll,dragExit) end) + end) + +end + + ------------------------------- + -- Input Callback functions + ------------------------------- +IsMaximized.Value=false +IsMinimized.Value=false +IsMaximized.Changed:connect(UpdateMaximize) +IsMinimized.Changed:connect(UpdateMinimize) + +ExtendButton.MouseButton1Down:connect(function() + if(time() - LastClick < ButtonCooldown) or InPopupWaitForClick then return end + LastClick = time() + if IsTabified.Value then + UnTabify() + else + StartMinimizeDrag() + end +end) + +MaximizeButton.MouseButton1Click:connect(function() + if(time() - LastClick < ButtonCooldown) or InPopupWaitForClick then return end + LastClick = time() + if IsTabified.Value then + UnTabify() + elseif not AreNamesExpanded.Value then + AreNamesExpanded.Value = true + BaseUpdate() + else + ToggleMaximize() + end +end) + +MaximizeButton.MouseButton2Click:connect(function() + if(time() - LastClick < ButtonCooldown) or InPopupWaitForClick then return end + LastClick = time() + if IsTabified.Value then + UnTabify() + elseif IsMaximized.Value then + ToggleMaximize() + elseif AreNamesExpanded.Value then + AreNamesExpanded.Value = false + BaseUpdate() + else + Tabify() + end +end) + + +------------------------------- +-- MiddleFrames management +------------------------------- +--[[ + adds a background frame to the listframe +--]] +function AddMiddleBGFrame() + local nBGFrame = MiddleBGTemplate:Clone() + nBGFrame.Position = UDim2.new(.5,0,((#MiddleFrameBackgrounds) * nBGFrame.Size.Y.Scale),0) + if (#MiddleFrameBackgrounds+1)%2 ~= 1 then + if IsMaximized.Value then + nBGFrame.Background.Image = 'http://www.morblox.us/asset/?id='..Images['LargeDark'] + else + nBGFrame.Background.Image = 'http://www.morblox.us/asset/?id='..Images['midDark'] + end + else + if IsMaximized.Value then + nBGFrame.Background.Image = 'http://www.morblox.us/asset/?id='..Images['LargeLight'] + else + nBGFrame.Background.Image = 'http://www.morblox.us/asset/?id='..Images['midLight'] + end + end + nBGFrame.Parent = ListFrame + table.insert(MiddleFrameBackgrounds,nBGFrame) + + if #MiddleFrameBackgrounds 1 do + fSize=fSize-1 + tHeader.FontSize=FONT_SIZES[fSize] + wait(.2) + end + HeaderName.FontSize=tHeader.FontSize + tHeader:Destroy() + end) +end +ScreenGui.Changed:connect(UpdateHeaderNameSize) + +--[[ + called only when the leaderstats object is added to a given player entry + removes old stats, adds any existing stats, and sets up listeners for new stats + @Args: + playerEntry A reference to the ENTRY(table) of the player who had leaderstats added +--]] +function LeaderstatsAdded(playerEntry) + --RemoveAllStats(playerEntry) + local nplayer = playerEntry['Player'] + for _,i in pairs(nplayer.leaderstats:GetChildren()) do + StatAdded(i,playerEntry) + end + nplayer.leaderstats.ChildAdded:connect(function(nchild) StatAdded(nchild,playerEntry) end) + nplayer.leaderstats.ChildRemoved:connect(function(nchild) StatRemoved(nchild,playerEntry) end) +end +--[[ + called when leaderstats object is removed from play in player entry + Note: may not be needed, might be able to just rely on leaderstats added + @Args: + oldLeaderstats leaderstats object to be removed + playerEntry A reference to the ENTRY(table) of the player +--]] +function LeaderstatsRemoved(oldLeaderstats,playerEntry) + while AddingFrameLock do debugprint('waiting to insert '..playerEntry['Player'].Name) wait(1/30) end + AddingFrameLock = true + RemoveAllStats(playerEntry) + AddingFrameLock = false +end + +function ClosePopUpPanel() + if SelectedPlayerEntry then --on random times this will be called by both button and playermouse + local tframe = SelectedPlayerEntry['Frame'] + Spawn(function() TweenBackgroundTransparency(tframe,.5,1,.25) end) + PopUpPanel:TweenPosition(UDim2.new(1,0,0,0), "Out", "Quad", .5,true) + wait(.1) + InPopupWaitForClick= false + SelectedPlayerEntry = nil + end + +end + +--[[ + prepares the needed popup to be tweened on screen, and updates the position of the popup clip + frame to match the selected player frame's position +--]] +function InitMovingPanel( entry, player) + PopUpClipFrame.Parent= ScreenGui + + if PopUpPanel then + PopUpPanel:Destroy() + end + PopUpPanel= PopUpPanelTemplate:Clone() + PopUpPanel.Parent= PopUpClipFrame + + local nextIndex = 2 + local friendStatus = GetFriendStatus(player) + local showRankMenu = IsPersonalServer and LocalPlayer.PersonalServerRank >= PrivilegeLevel['Admin'] and LocalPlayer.PersonalServerRank > SelectedPlayer.PersonalServerRank + + + local ReportPlayerButton = MakePopupButton(PopUpPanel,'Report Player',0) + ReportPlayerButton.MouseButton1Click:connect(function() ClosePopUpPanel() OpenAbuseDialog() end) + local FriendPlayerButton = MakePopupButton(PopUpPanel,'Friend',1, not showRankMenu and friendStatus~=Enum.FriendStatus.FriendRequestReceived) + FriendPlayerButton.MouseButton1Click:connect(OnFriendButtonSelect) + + + if friendStatus==Enum.FriendStatus.Friend then + FriendPlayerButton:FindFirstChild('ButtonText').Text='UnFriend Player' + elseif friendStatus==Enum.FriendStatus.Unknown or friendStatus==Enum.FriendStatus.NotFriend then + FriendPlayerButton:FindFirstChild('ButtonText').Text='Send Request' + elseif friendStatus==Enum.FriendStatus.FriendRequestSent then + FriendPlayerButton:FindFirstChild('ButtonText').Text='Revoke Request' + elseif friendStatus==Enum.FriendStatus.FriendRequestReceived then + FriendPlayerButton:FindFirstChild('ButtonText').Text='Accept Friend' + local FriendRefuseButton = MakePopupButton(PopUpPanel,'Decline Friend',2,not showRankMenu) + FriendRefuseButton.MouseButton1Click:connect(OnFriendRefuseButtonSelect) + nextIndex=nextIndex+1 + end + + if showRankMenu then + local BanPlayerButton = MakePopupButton(PopUpPanel,'Ban',nextIndex) + local VisitorButton = MakePopupButton(PopUpPanel,'Visitor',nextIndex+1) + local MemberButton = MakePopupButton(PopUpPanel,'Member',nextIndex+2) + local AdminButton = MakePopupButton(PopUpPanel,'Admin',nextIndex+3,true) + + BanPlayerButton.MouseButton1Click:connect(function() ClosePopUpPanel() + OnPrivilegeLevelSelect(player,PrivilegeLevel['Banned'],BanPlayerButton,VisitorButton,MemberButton,AdminButton) + end) + VisitorButton.MouseButton1Click:connect(function() ClosePopUpPanel() + OnPrivilegeLevelSelect(player,PrivilegeLevel['Visitor'],BanPlayerButton,VisitorButton,MemberButton,AdminButton) + end) + MemberButton.MouseButton1Click:connect(function() ClosePopUpPanel() + OnPrivilegeLevelSelect(player,PrivilegeLevel['Member'],BanPlayerButton,VisitorButton,MemberButton,AdminButton) + end) + AdminButton.MouseButton1Click:connect(function() ClosePopUpPanel() + OnPrivilegeLevelSelect(player,PrivilegeLevel['Admin'],BanPlayerButton,VisitorButton,MemberButton,AdminButton) + end) + + HighlightMyRank(SelectedPlayer,BanPlayerButton,VisitorButton,MemberButton,AdminButton) + end + + PopUpPanel:TweenPosition(UDim2.new(0,0,0,0), "Out", "Quad", .5,true) + Delay(1, function() + local tconnection + tconnection = LocalPlayer:GetMouse().Button1Down:connect(function() + tconnection:disconnect() + ClosePopUpPanel() + end) + end) + + local myFrame = entry['Frame'] + -- THIS IS GARBAGE. + -- if I parent to frame to auto update position, it gets clipped + -- sometimes garbage is the only option. + Spawn(function() + --print('got in spawn') + while InPopupWaitForClick do + --print('in position update loop') + PopUpClipFrame.Position=UDim2.new( 0,myFrame.AbsolutePosition.X-PopUpClipFrame.Size.X.Offset,0,myFrame.AbsolutePosition.Y) + wait() + end + end) + +end + +--[[ + Called when a player entry in the leaderboard is clicked + either will highlight entry and start the drag event, or open a popup menu + @Args: + entry the player entry clicked +--]] +function OnPlayerEntrySelect(entry) + if SelectedPlayer then + debugprint('trying to open popup menu!!'.. tostring(entry == SelectedPlayerEntry).. ' ' .. tostring(SelectedPlayer~=LocalPlayer)..' ' .. tostring(SelectedPlayer.userId) ..' '..tostring(LocalPlayer.userId) ) + end + if not InPopupWaitForClick and entry == SelectedPlayerEntry and SelectedPlayer~=LocalPlayer and SelectedPlayer and SelectedPlayer.userId>1 and LocalPlayer.userId>1 then + + entry['Frame'].BackgroundColor3 = Color3.new(0,1,1) + Spawn(function() TweenBackgroundTransparency(entry['Frame'],1,.5,.5) end) + InPopupWaitForClick=true + InitMovingPanel(entry,SelectedPlayer) + + + elseif not InPopupWaitForClick then + --print('starting drag ', entry['Player'].Name) + --movingPanel:TweenPosition(UDim2.new(1,0,0,0), "Out", "Quad", .5,true) + SelectedPlayerEntry = entry + SelectedPlayer = entry['Player'] + + Delay(1, function() + if not InPopupWaitForClick then + SelectedPlayerEntry = nil + end + end) + StartDrag() + end + + +end + +--[[ + the basic update for the playerlist mode's state, + assures the order and length of the player frames +--]] +function PlayerListModeUpdate() + RecreateScoreColumns(PlayerFrames) + table.sort(PlayerFrames,PlayerSortFunction) + for i,val in ipairs(PlayerFrames) do + MiddleFrames[i] = val['Frame'] + end + for i = #PlayerFrames + 1,#MiddleFrames,1 do + MiddleFrames[i] = nil + end + UpdateMinimize() +end +--[[ + this one's a doozie, happens when a player is added to the game + inits their player frame and player entry, assigns them to a team if possible, + and hooks up their leaderstats + @Args: + nplayer new player object to insert +--]] +function InsertPlayerFrame(nplayer) + while AddingFrameLock do debugprint('waiting to insert '..nplayer.Name) wait(1/30) end + AddingFrameLock = true + + local nFrame = MiddleTemplate:Clone() + WaitForChild(WaitForChild(nFrame,'TitleFrame'),'Title').Text = nplayer.Name + + nFrame.Position = UDim2.new(1,0,((#MiddleFrames) * nFrame.Size.Y.Scale),0) + + local nfriendstatus = GetFriendStatus(nplayer) + + nFrame:FindFirstChild('BCLabel').Image = getMembershipTypeIcon(nplayer.MembershipType,nplayer.Name) + nFrame:FindFirstChild('FriendLabel').Image = getFriendStatusIcon(nfriendstatus) + nFrame.Name = nplayer.Name + WaitForChild(WaitForChild(nFrame,'TitleFrame'),'Title').Text = nplayer.Name + + --move for bc label + nFrame.FriendLabel.Position=nFrame.FriendLabel.Position+UDim2.new(0,17,0,0) + nFrame.TitleFrame.Title.Position=nFrame.TitleFrame.Title.Position+UDim2.new(0,17,0,0) + + if(nFrame:FindFirstChild('FriendLabel').Image ~= '') then + nFrame.TitleFrame.Title.Position=nFrame.TitleFrame.Title.Position+UDim2.new(0,17,0,0) + --nFrame.FriendLabel.Position=nFrame.TitleFrame.Position+UDim2.new(nFrame.TitleFrame.Size.X.Scale,-20+nFrame.TitleFrame.Size.X.Offset,0,0) + end + + if nplayer.Name == LocalPlayer.Name then + nFrame.TitleFrame.Title.Font = 'ArialBold' + nFrame.PlayerScore.Font = 'ArialBold' + ChangeHeaderName(nplayer.Name) + local dropShadow = nFrame.TitleFrame.Title:Clone() + dropShadow.TextColor3 = Color3.new(0,0,0) + dropShadow.TextTransparency=0 + dropShadow.ZIndex=2 + dropShadow.Position=nFrame.TitleFrame.Title.Position+UDim2.new(0,1,0,1) + dropShadow.Name='DropShadow' + dropShadow.Parent= nFrame.TitleFrame + elseif LocalPlayer:IsFriendsWith(nplayer.userId) then + + end + nFrame.TitleFrame.Title.Font = 'ArialBold' + + + nFrame.Parent = ListFrame + nFrame:TweenPosition(UDim2.new(.5,0,((#MiddleFrames) * nFrame.Size.Y.Scale),0), "Out", "Quad", .5,true) + UpdateMinimize() + local nentry = {} + nentry['Frame'] = nFrame + nentry['Player'] = nplayer + nentry['ID'] = AddId + AddId = AddId + 1 + table.insert(PlayerFrames,nentry) + if #TeamFrames~=0 then + + if nplayer.Neutral then + nentry['MyTeam'] = nil + if not NeutralTeam then + AddNeutralTeam() + else + AddPlayerToTeam(NeutralTeam,nentry) + end + + else + local addedToTeam=false + for i,tval in ipairs(TeamFrames) do + if tval['MyTeam'].TeamColor == nplayer.TeamColor then + AddPlayerToTeam(tval,nentry) + nentry['MyTeam'] = tval + addedToTeam=true + end + end + if not addedToTeam then + nentry['MyTeam']=nil + if not NeutralTeam then + AddNeutralTeam() + else + AddPlayerToTeam(NeutralTeam,nentry) + end + nentry['MyTeam'] = NeutralTeam + end + end + + end + + if nplayer:FindFirstChild('leaderstats') then + LeaderstatsAdded(nentry) + end + + nplayer.ChildAdded:connect(function(nchild) + if nchild.Name == 'leaderstats' then + while AddingFrameLock do debugprint('in adding leaderstats lock') wait(1/30) end + AddingFrameLock = true + LeaderstatsAdded(nentry) + AddingFrameLock = false + end + end) + + nplayer.ChildRemoved:connect(function (nchild) + if nplayer==LocalPlayer and nchild.Name == 'leaderstats' then + LeaderstatsRemoved(nchild,nentry) + end + end) + nplayer.Changed:connect(function(prop)PlayerChanged(nentry,prop) end) + + local listener = WaitForChild(nFrame,'ClickListener') + listener.Active = true + listener.MouseButton1Down:connect(function() OnPlayerEntrySelect(nentry) end) + + AddMiddleBGFrame() + BaseUpdate() + AddingFrameLock = false +end + +--[[ + Note:major optimization can be done here + removes this player's frame if it exists, calls base update +--]] +function RemovePlayerFrame(tplayer) + while AddingFrameLock do debugprint('in removing player frame lock') wait(1/30) end + AddingFrameLock = true + + local tteam + for i,key in ipairs(PlayerFrames) do + if tplayer == key['Player'] then + if PopUpClipFrame.Parent == key['Frame'] then + PopUpClipFrame.Parent = nil + end + key['Frame']:Destroy() + tteam=key['MyTeam'] + table.remove(PlayerFrames,i) + end + end + if tteam then + for j,tentry in ipairs(tteam['MyPlayers']) do + if tentry['Player'] == tplayer then + RemovePlayerFromTeam(tteam,j) + end + end + end + + RemoveMiddleBGFrame() + UpdateMinimize() + BaseUpdate() + AddingFrameLock = false +end + +Players.ChildRemoved:connect(RemovePlayerFrame) + +---------------------------- +-- Team Callback Functions +---------------------------- +--[[ + turns a list of team entries with sub lists of players into a single ordered + list, in the correct order,and of the correct length + @Args: + tframes the team entries to unroll + outframes the list to unroll these entries into +--]] +function UnrollTeams(tframes,outframes) + local numEntries = 0 + if NeutralTeam and not NeutralTeam['IsHidden'] then + for i,val in ipairs(NeutralTeam['MyPlayers']) do + numEntries = numEntries + 1 + outframes[numEntries] = val['Frame'] + end + numEntries = numEntries + 1 + outframes[numEntries] = NeutralTeam['Frame'] + end + for i,val in ipairs(tframes) do + if not val['IsHidden'] then + for j,pval in ipairs(val.MyPlayers) do + numEntries = numEntries + 1 + outframes[numEntries] = pval['Frame'] + end + numEntries = numEntries + 1 + outframes[numEntries] = val['Frame'] + end + end + -- clear any additional entries from outframes + for i = numEntries + 1,#outframes,1 do + outframes[i] = nil + end +end +--[[ + uses lua's table.sort to sort the teams +--]] +function TeamSortFunc(a,b) + if a['TeamScore'] == b['TeamScore'] then + return a['ID'] < b['ID'] + end + if not a['TeamScore'] then return false end + if not b['TeamScore'] then return true end + return a['TeamScore'] < b['TeamScore'] + +end +--[[ + consider adding lock with wait for performance + sorts each of the team's player lists induvidually, adds up the team scores. + @Args: + tentries table of team entries +--]] +function SortTeams(tentries) + + for i,val in ipairs(tentries) do + + table.sort(val['MyPlayers'],PlayerSortFunction) + AddTeamScores(val) + end + table.sort(tentries,TeamSortFunc) +end +--[[ + base update for team mode, adds up the scores of all teams, sorts them, + then unrolls them into middleframes +--]] +function TeamListModeUpdate() + RecreateScoreColumns(PlayerFrames) + SortTeams(TeamFrames) + if NeutralTeam then + AddTeamScores(NeutralTeam) + --RecreateScoreColumns(NeutralTeam['MyPlayers']) + end + UnrollTeams(TeamFrames,MiddleFrames) +end +--[[ + adds up all the score of this team's players to form the team score + @Args: + team team entry to sum the scores of +--]] +function AddTeamScores(team) + + for j = 1, #ScoreNames,1 do + local i = ScoreNames[j] + local tscore = 0 + for _,j in ipairs(team['MyPlayers']) do + local tval = j['Player']:FindFirstChild('leaderstats') and j['Player'].leaderstats:FindFirstChild(i['Name']) + if tval and not tval:IsA('StringValue') then + tscore = tscore + GetScoreValue((j['Player'].leaderstats)[i['Name'] ]) + end + end + if team['Frame']:FindFirstChild(i['Name']) then + team['Frame'][i['Name'] ].Size = UDim2.new(1 - (ScrollBarFrame.Size.X.Scale * 2),- ((j-1) * SpacingPerStat),1,0) + team['Frame'][i['Name'] ].Text = tostring(tscore) + end + end + UpdateMinimize() +end + +--[[ + finds previous team this player was on, and if it exists calls removeplayerfromteam + @Args + entry Player entry +--]] +function FindRemovePlayerFromTeam(entry) + if entry['MyTeam'] then + for j,oldEntry in ipairs(entry['MyTeam']['MyPlayers']) do + if oldEntry['Player'] == entry['Player'] then + RemovePlayerFromTeam(entry['MyTeam'],j) + return + end + end + elseif NeutralTeam then + for j,oldEntry in ipairs(NeutralTeam['MyPlayers']) do + if oldEntry['Player'] == entry['Player'] then + RemovePlayerFromTeam(NeutralTeam,j) + return + end + end + end +end +--[[ + removes a single player from a given team (not usually called directly) + @Args: + teamEntry team entry to remove player from + index index of player in 'MyPlayers' list to remove +--]] +function RemovePlayerFromTeam(teamEntry,index) + table.remove(teamEntry['MyPlayers'],index) + --if teamEntry['AutoHide'] and #teamEntry['MyPlayers'] == 0 then + if teamEntry==NeutralTeam and #teamEntry['MyPlayers']==0 then + RemoveNeutralTeam() + end +end +--[[ + adds player entry entry to teamentry + removes them from any previous team + @Args: + teamEntry entry of team to add player to + entry player entry to add to this team +--]] +function AddPlayerToTeam(teamEntry,entry) + FindRemovePlayerFromTeam(entry) + table.insert(teamEntry['MyPlayers'],entry) + entry['MyTeam'] = teamEntry + if teamEntry['IsHidden'] then + teamEntry['Frame'].Parent = ListFrame + AddMiddleBGFrame() + end + teamEntry['IsHidden'] = false +end + + +function SetPlayerToTeam(entry) + FindRemovePlayerFromTeam(entry) + -- check to see if team exists, if it does add to that team + local setToTeam = false + for i,tframe in ipairs(TeamFrames) do + -- add my entry on the new team + if tframe['MyTeam'].TeamColor == entry['Player'].TeamColor then + AddPlayerToTeam(tframe,entry) + setToTeam = true + end + end + -- if player was set to an invalid team, then set it back to neutral + if not setToTeam then + entry['MyTeam']=nil + if not NeutralTeam then + AddNeutralTeam() + else AddPlayerToTeam(NeutralTeam,entry) end + end +end + +--[[ + Note:another big one, consiter breaking up + called when any children of player changes + handles 'Neutral', teamColor, Name and MembershipType changes + @Args + entry Player entry changed + property name of property changed +--]] +function PlayerChanged(entry, property) + while PlayerChangedLock do + debugprint('in playerchanged lock') + wait(1/30) + end + PlayerChangedLock=true + if property == 'Neutral' then + -- if player changing to neutral + if entry['Player'].Neutral then + debugprint(entry['Player'].Name..'setting to neutral') + FindRemovePlayerFromTeam(entry) + entry['MyTeam']=nil + if not NeutralTeam then + debugprint(entry['Player'].Name..'creating neutral team') + AddNeutralTeam() + else + debugprint(entry['Player'].Name..'adding to neutral team') + AddPlayerToTeam(NeutralTeam,entry) + end + else -- else player switching to a team, or a weird edgecase + SetPlayerToTeam(entry) + end + BaseUpdate() + elseif property == 'TeamColor' and not entry['Player'].Neutral and entry['Player'] ~= entry['MyTeam'] then + debugprint(entry['Player'].Name..'setting to new team') + SetPlayerToTeam(entry) + BaseUpdate() + elseif property == 'Name' or property == 'MembershipType' then + entry['Frame']:FindFirstChild('BCLabel').Image = getMembershipTypeIcon(entry['Player'].MembershipType,entry['Player'].Name) + entry['Frame'].Name = entry['Player'].Name + entry['Frame'].TitleFrame.Title.Text = entry['Player'].Name + if(entry['Frame'].BCLabel.Image ~= '') then + entry['Frame'].TitleFrame.Title.Position=UDim2.new(.01, 30, .1, 0) + end + if entry['Player'] == LocalPlayer then + entry['Frame'].TitleFrame.DropShadow.Text= entry['Player'].Name + ChangeHeaderName(entry['Player'].Name) + end + BaseUpdate() + end + PlayerChangedLock=false +end + +function OnFriendshipChanged(player,friendStatus) + for _, entry in ipairs(PlayerFrames) do + if entry['Player']==player then + local nicon = getFriendStatusIcon(friendStatus) + if nicon == '' and entry['Frame'].FriendLabel.Image ~= '' then + entry['Frame'].TitleFrame.Title.Position=entry['Frame'].TitleFrame.Title.Position-UDim2.new(0,17,0,0) + elseif nicon ~= '' and entry['Frame'].FriendLabel.Image == '' then + entry['Frame'].TitleFrame.Title.Position=entry['Frame'].TitleFrame.Title.Position+UDim2.new(0,17,0,0) + end + entry['Frame'].FriendLabel.Image = nicon + return + end + end +end + +LocalPlayer.FriendStatusChanged:connect(OnFriendshipChanged) + +--[[ + adds a neutral team if nessisary + Note: a lot of redundant code here, might want to refactor to share a function with insertteamframe +--]] +function AddNeutralTeam() + while NeutralTeamLock do debugprint('in neutral team 2 lock') wait() end + NeutralTeamLock = true + + local defaultTeam = Instance.new('Team') + defaultTeam.TeamColor = BrickColor.new('White') + defaultTeam.Name = 'Neutral' + local nentry = {} + nentry['MyTeam'] = defaultTeam + nentry['MyPlayers'] = {} + nentry['Frame'] = MiddleTemplate:Clone() + WaitForChild(WaitForChild(nentry['Frame'],'TitleFrame'),'Title').Text = defaultTeam.Name + nentry['Frame'].TitleFrame.Position=UDim2.new(nentry['Frame'].TitleFrame.Position.X.Scale,nentry['Frame'].TitleFrame.Position.X.Offset,.1,0) + nentry['Frame'].TitleFrame.Size=UDim2.new(nentry['Frame'].TitleFrame.Size.X.Scale,nentry['Frame'].TitleFrame.Size.X.Offset,.8,0) + --nentry['Frame'].TitleFrame.Title.TextScaled=true + nentry['Frame'].TitleFrame.Title.Font = 'ArialBold' + nentry['Frame'].Position = UDim2.new(1,0,((#MiddleFrames) * nentry['Frame'].Size.Y.Scale),0) + WaitForChild(nentry['Frame'],'ClickListener').MouseButton1Down:connect(StartDrag) + nentry['Frame'].ClickListener.BackgroundColor3 = Color3.new(1,1,1) + nentry['Frame'].ClickListener.BackgroundTransparency = .7 + nentry['Frame'].ClickListener.AutoButtonColor=false + nentry['AutoHide'] = true + nentry['IsHidden'] = true + for _,i in pairs(PlayerFrames) do + if i['Player'].Neutral or not i['MyTeam'] then + AddPlayerToTeam(nentry,i) + end + end + if #nentry['MyPlayers'] > 0 then + NeutralTeam = nentry + UpdateMinimize() + BaseUpdate() + end + NeutralTeamLock = false +end + +function RemoveNeutralTeam() + while NeutralTeamLock do debugprint('in neutral team lock') wait() end + NeutralTeamLock = true + NeutralTeam['Frame']:Destroy() + NeutralTeam=nil + RemoveMiddleBGFrame() + NeutralTeamLock = false +end + +--[[ + +--]] +function TeamScoreChanged(entry,nscore) + WaitForChild(entry['Frame'],'PlayerScore').Text = tostring(nscore) + entry['TeamScore'] = nscore +end +--[[ + called when child added to a team, used for autohide functionality + Note: still has teamscore, consiter removing +--]] +function TeamChildAdded(entry,nchild) + if nchild.Name == 'AutoHide' then + entry['AutoHide'] = true + elseif nchild.Name == 'TeamScore' then + WaitForChild(entry['Frame'],'PlayerScore').Text = tostring(nchild.Value) + entry['TeamScore'] = nchild.Value + nchild.Changed:connect(function() TeamScoreChanged(entry,nchild.Value) end) + end +end +--[[ + called when child added to a team, used for autohide functionality + Note: still has teamscore, consiter removing +--]] +function TeamChildRemoved(entry,nchild) + if nchild.Name == 'AutoHide' then + entry['AutoHide'] = false + elseif nchild.Name == 'TeamScore' then + WaitForChild(entry['Frame'],'PlayerScore').Text = "" + entry['TeamScore'] = nil + end +end + +function TeamChanged(entry, property) + if property=='Name' then + WaitForChild(WaitForChild(entry['Frame'],'TitleFrame'),'Title').Text = entry['MyTeam'].Name + + elseif property=='TeamColor' then + entry['Frame'].ClickListener.BackgroundColor3 = entry['MyTeam'].TeamColor.Color + + for _,i in pairs(TeamFrames) do + if i['MyTeam'].TeamColor == entry['MyTeam'] then + RemoveTeamFrame(entry['MyTeam']) --NO DUPLICATE TEAMS! + end + end + + entry['MyPlayers']={} + + for _,i in pairs(PlayerFrames) do + SetPlayerToTeam(i) + end + BaseUpdate() + end +end + +--[[ + creates team entry and frame for this team, sets up listeners for this team + adds any players intended for this team,Creates neutral team if this is the first team added + Note:might be best to break this into multiple functions to simplify + @Args: + nteam new team object added +--]] +function InsertTeamFrame(nteam) + while AddingFrameLock do debugprint('in adding team frame lock') wait(1/30) end + AddingFrameLock = true + --for _,i in pairs(TeamFrames) do + local nentry = {} + nentry['MyTeam'] = nteam + nentry['MyPlayers'] = {} + nentry['Frame'] = MiddleTemplate:Clone() + WaitForChild(WaitForChild(nentry['Frame'],'TitleFrame'),'Title').Text = nteam.Name + nentry['Frame'].TitleFrame.Title.Font = 'ArialBold' + nentry['Frame'].TitleFrame.Title.FontSize = 'Size18' + nentry['Frame'].TitleFrame.Position=UDim2.new(nentry['Frame'].TitleFrame.Position.X.Scale,nentry['Frame'].TitleFrame.Position.X.Offset,.1,0) + nentry['Frame'].TitleFrame.Size=UDim2.new(nentry['Frame'].TitleFrame.Size.X.Scale,nentry['Frame'].TitleFrame.Size.X.Offset,.8,0) + --nentry['Frame'].TitleFrame.Title.TextScaled=true + nentry['Frame'].Position = UDim2.new(1,0,((#MiddleFrames) * nentry['Frame'].Size.Y.Scale),0) + WaitForChild(nentry['Frame'],'ClickListener').MouseButton1Down:connect(StartDrag) + nentry['Frame'].ClickListener.BackgroundColor3 = nteam.TeamColor.Color + nentry['Frame'].ClickListener.BackgroundTransparency = .7 + nentry['Frame'].ClickListener.AutoButtonColor=false + AddId = AddId + 1 + nentry['ID'] = AddId + nentry['AutoHide'] = false + if nteam:FindFirstChild('AutoHide') then + nentry['AutoHide'] = true + end + if nteam:FindFirstChild('TeamScore') then + TeamChildAdded(nentry,nteam.TeamScore) + + end + + nteam.ChildAdded:connect(function(nchild) TeamChildAdded(nentry,nchild) end) + nteam.ChildRemoved:connect(function(nchild) TeamChildRemoved(nentry,nchild) end) + nteam.Changed:connect(function(prop) TeamChanged(nentry,prop) end) + + for _,i in pairs(PlayerFrames) do + if not i['Player'].Neutral and i['Player'].TeamColor == nteam.TeamColor then + AddPlayerToTeam(nentry,i) + end + end + nentry['IsHidden'] = false + if not nentry['AutoHide'] or #nentry['MyPlayers'] > 0 then + + nentry['Frame'].Parent = ListFrame + nentry['Frame']:TweenPosition(UDim2.new(.5,0,((#MiddleFrames) * nentry['Frame'].Size.Y.Scale),0), "Out", "Quad", .5,true) + AddMiddleBGFrame() + else + nentry['IsHidden'] = true + nentry['Frame'].Parent = nil + end + + table.insert(TeamFrames,nentry) + UpdateMinimize() + BaseUpdate() + if #TeamFrames == 1 and not NeutralTeam then + AddNeutralTeam() + end + AddingFrameLock = false +end +--[[ + removes team from team list + @Args: + nteam Teamobject to remove +--]] +function RemoveTeamFrame(nteam) + while AddingFrameLock do debugprint('in removing team frame lock') wait(1/30) end + AddingFrameLock = true + if IsMinimized.Value then + -- ListFrame.Position = ListFrame.Position + UDim2.new(0,0,MiddleTemplate.Size.Y.Scale,0) + end + local myEntry + for i,key in ipairs(TeamFrames) do + if nteam == key['MyTeam'] then + myEntry = key + key['Frame']:Destroy() + table.remove(TeamFrames,i) + end + end + if #TeamFrames==0 then + if NeutralTeam then + RemoveNeutralTeam() + end + end + for i,key in ipairs(myEntry['MyPlayers']) do + RemovePlayerFromTeam(myEntry,i) + PlayerChanged(key, 'TeamColor') + end + RemoveMiddleBGFrame() + BaseUpdate() + AddingFrameLock = false +end + +function TeamAdded(nteam) + InsertTeamFrame(nteam) +end + +function TeamRemoved(nteam) + RemoveTeamFrame(nteam) +end + --------------------------------- +--[[ + called when ANYTHING changes the state of the playerlist + re-sorts everything,assures correct positions of all elements +--]] +function BaseUpdate() + while BaseUpdateLock do debugprint('in baseupdate lock') wait(1/30) end + BaseUpdateLock = true + --print ('baseupdate') + UpdateStatNames() + + if #TeamFrames == 0 then + PlayerListModeUpdate() + else + TeamListModeUpdate() + end + for i,key in ipairs(MiddleFrames) do + if key.Parent ~= nil then + key:TweenPosition(UDim2.new(.5,0,((#MiddleFrames - (i)) * key.Size.Y.Scale),0), "Out", "Quad", .9,true) + end + end + if not IsMinimized.Value and #MiddleFrames>DefaultEntriesOnScreen then + UpdateScrollPosition() + end + + UpdateMinimize() + + UpdateScrollBarSize() + UpdateScrollPosition() + + UpdateScrollBarVisibility() + --debugprint('EndBaseUpdate') + BaseUpdateLock = false +end + +--[[ + code for attaching tab key to maximizing player list +--]] +game.GuiService:AddKey("\t") +local LastTabTime = time() +game.GuiService.KeyPressed:connect( +function(key) + if key == "\t" then + debugprint('caught tab key') + local modalCheck, isModal = pcall(function() return game.GuiService.IsModalDialog end) + if modalCheck == false or (modalCheck and isModal == false) then + if time() - LastTabTime > 0.4 then + LastTabTime = time() + if IsTabified.Value then + if not IsMaximized.Value then + ScreenGui:TweenPosition(UDim2.new(0, 0, 0,0),'Out','Quad',1,true) + IsMaximized.Value = true + else + ScreenGui:TweenPosition(UDim2.new(NormalBounds.X.Scale, NormalBounds.X.Offset-10, 0,0),'Out','Quad',1,true) + IsMaximized.Value = false + IsMinimized.Value=true + end + else + ToggleMaximize() + end + + end + end + end +end) + + ---------------------------- + -- Hookups and initialization + ---------------------------- +function debugPlayerAdd(p) + InsertPlayerFrame(p) +end + +while not game:GetService('Teams') do wait(1/30) debugprint('Waiting For Teams') end +for _,i in pairs(game.Teams:GetTeams()) do TeamAdded(i) end +for _,i in pairs(Players:GetPlayers()) do Spawn(function() debugPlayerAdd(i) end) end--InsertPlayerFrame(i) end + +game.Teams.ChildAdded:connect(TeamAdded) +game.Teams.ChildRemoved:connect(TeamRemoved) +Players.ChildAdded:connect(function(tplayer) Spawn(function() debugPlayerAdd(tplayer) end) end)--InsertPlayerFrame) + +InitReportAbuse() +AreNamesExpanded.Value = true +BaseUpdate() + + + +--UGGGLY,find a better way later +wait(2) +IsPersonalServer= not not game.Workspace:FindFirstChild("PSVariable") + + ---------------------------- + -- Running Logic + ---------------------------- + + --debug stuffs, will only run for 'newplayerlistisbad' + +--REMOVEME + + + if LocalPlayer.Name == 'newplayerlistisbad' or LocalPlayer.Name == 'Imtotallyadmin' then + debugFrame.Parent = ScreenGui + Spawn(function() + while true do + local str_players='' + for _,i in pairs(game.Players:GetPlayers()) do + str_players= str_players .." " .. i.Name + end + debugplayers.Text=str_players + wait(.5) + end + end) + end + +--[[ +function EnsureValidity() + while true do + --make sure all players are in the player list + --and make sure there are no entries that corespond to non-existant players + local unfoundEntries={} + for k,v in pairs(PlayerFrames) do + unfoundEntries[k] = v + end + --for all players + for _,i in pairs(Players:GetPlayers()) do + local foundPlayer=false + --for all known players + for entryIndex,j in pairs(PlayerFrames) do + -- if I know about this player, tag it + if i==j['Player'] then + foundPlayer=true + unfoundEntries[entryIndex]=nil + end + end + --if this player is not known + if not foundPlayer then + wait(.5) + --do a double check + for _,j in pairs(PlayerFrames) do + if i==j['Player'] then + foundPlayer=true + end + end + if not foundPlayer then + InsertPlayerFrame(i) + debugOutput.Text= "Manual Insertion! " .. i.Name + end + end + + end + --for any additional entries, never found, remove them + for _,j in pairs(unfoundEntries) do + RemovePlayerFrame(j['Player']) + debugOutput.Text= "Player Manual Removal! " ..j['Player'].Name + end + wait(1/30) + --make sure there are no gaps or overlaps in the playerlist + while GetEntryListLength()>#MiddleFrameBackgrounds do + AddMiddleBGFrame() + end + while GetEntryListLength()<#MiddleFrameBackgrounds do + RemoveMiddleBGFrame() + end + wait(1/30) + --remove neutral team if it shouldn't exist + if NeutralTeam and (#NeutralTeam['MyPlayers']==0 or #TeamFrames==0) then + wait(.5) + if NeutralTeam and (#NeutralTeam['MyPlayers']==0 or #TeamFrames==0) then + RemoveNeutralTeam() + debugOutput.Text= "Manual removal of neutral team! " + end + end + wait(1/30) + --do a base update, just ot be sure + BaseUpdate() + wait(1/30) + + end +end +--]] + --quick fix running logic, PLEASE LET ME REPLACE LATER + --Spawn(EnsureValidity) + + diff --git a/public/asset/12 b/public/asset/12 index 29c12f3..0314981 100644 --- a/public/asset/12 +++ b/public/asset/12 @@ -18,6 +18,19 @@ local function waitForProperty(instance, property) end end +local function IsTouchDevice() + local touchEnabled = false + pcall(function() touchEnabled = Game:GetService('UserInputService').TouchEnabled end) + return touchEnabled +end + +local function IsPhone() + if gui.AbsoluteSize.Y <= 320 then + return true + end + return false +end + waitForChild(game,"Players") waitForProperty(game.Players,"LocalPlayer") local player = game.Players.LocalPlayer @@ -25,12 +38,29 @@ local player = game.Players.LocalPlayer -- First up is the current loadout local CurrentLoadout = Instance.new("Frame") CurrentLoadout.Name = "CurrentLoadout" -CurrentLoadout.Position = UDim2.new(0.5, -240, 1, -85) -CurrentLoadout.Size = UDim2.new(0, 480, 0, 48) +CurrentLoadout.Position = UDim2.new(0.5, -300, 1, -85) +CurrentLoadout.Size = UDim2.new(0, 600, 0, 54) CurrentLoadout.BackgroundTransparency = 1 CurrentLoadout.RobloxLocked = true CurrentLoadout.Parent = gui +local CLBackground = Instance.new('ImageLabel') +CLBackground.Name = 'Background'; +CLBackground.Size = UDim2.new(1.2, 0, 1.2, 0); +CLBackground.Image = "rbxasset://Textures/IPadInGameGUIToolbar.png" +CLBackground.BackgroundTransparency = 1.0; +CLBackground.Position = UDim2.new(-0.1, 0, -0.1, 0); +CLBackground.ZIndex = 0.0; +CLBackground.Parent = CurrentLoadout +CLBackground.Visible = false + +local BackgroundUp = Instance.new('ImageLabel') +BackgroundUp.Size = UDim2.new(1, 0, 0.025, 1) +BackgroundUp.Position = UDim2.new(0, 0, 0, 0) +BackgroundUp.Image = 'rbxasset://Textures/IPadInGameGUIToolbarTop03.png' +BackgroundUp.BackgroundTransparency = 1.0 +BackgroundUp.Parent = CLBackground + local Debounce = Instance.new("BoolValue") Debounce.Name = "Debounce" Debounce.RobloxLocked = true @@ -41,36 +71,73 @@ BackpackButton.RobloxLocked = true BackpackButton.Visible = false BackpackButton.Name = "BackpackButton" BackpackButton.BackgroundTransparency = 1 -BackpackButton.Image = "rbxasset://textures/ui/backpackButton.png" -BackpackButton.Position = UDim2.new(0.5, -195, 1, -30) -BackpackButton.Size = UDim2.new(0,107,0,26) +BackpackButton.Image = "rbxasset://Textures/IPadInGameGUIToolbarBkpkTabTopV3.png" +BackpackButton.Position = UDim2.new(0.5, -60, 1, -108) +BackpackButton.Size = UDim2.new(0, 120, 0, 18) waitForChild(gui,"ControlFrame") BackpackButton.Parent = gui.ControlFrame -for i = 0, 9 do +local NumSlots = 9 + +if IsPhone() then + NumSlots = 3 + CurrentLoadout.Size = UDim2.new(0, 180, 0, 54) + CurrentLoadout.Position = UDim2.new(0.5, -90, 1, -85) +end + + +for i = 0, NumSlots do local slotFrame = Instance.new("Frame") slotFrame.RobloxLocked = true slotFrame.BackgroundColor3 = Color3.new(0,0,0) slotFrame.BackgroundTransparency = 1 - slotFrame.BorderColor3 = Color3.new(1,1,1) + slotFrame.BorderColor3 = Color3.new(1, 1, 1) slotFrame.Name = "Slot" .. tostring(i) + slotFrame.ZIndex = 4.0 if i == 0 then - slotFrame.Position = UDim2.new(0.9,0,0,0) + slotFrame.Position = UDim2.new(0.9, 0, 0, 0) else - slotFrame.Position = UDim2.new((i - 1) * 0.1,0,0,0) - end - slotFrame.Size = UDim2.new(0.1,0,1,0) - slotFrame.Parent = CurrentLoadout + slotFrame.Position = UDim2.new((i - 1) * 0.1, (i-1)* 6,0,0) + end + + + slotFrame.Size = UDim2.new(0, 54, 1, 0) + slotFrame.Parent = CurrentLoadout + + if gui.AbsoluteSize.Y <= 320 then + slotFrame.Position = UDim2.new(0, (i-1)* 60, 0, -50) + print('Well got here', slotFrame, slotFrame.Position.X.Scale, slotFrame.Position.X.Offset) + end + if gui.AbsoluteSize.Y <= 320 and i == 0 then + slotFrame:Destroy() + end end local TempSlot = Instance.new("ImageButton") TempSlot.Name = "TempSlot" TempSlot.Active = true TempSlot.Size = UDim2.new(1,0,1,0) -TempSlot.Style = Enum.ButtonStyle.RobloxButton +TempSlot.BackgroundTransparency = 1.0 +TempSlot.Style = 'Custom' TempSlot.Visible = false TempSlot.RobloxLocked = true TempSlot.Parent = CurrentLoadout +TempSlot.ZIndex = 4.0 + + local slotBackground = Instance.new('ImageLabel') + slotBackground.Name = 'Background' + slotBackground.BackgroundTransparency = 1.0 + slotBackground.Image = 'rbxasset://Textures/IPadInGameGUITool.png' + slotBackground.Size = UDim2.new(1, 0, 1, 0) + slotBackground.Parent = TempSlot + + local HighLight = Instance.new('ImageLabel') + HighLight.Name = 'Highlight' + HighLight.BackgroundTransparency = 1.0 + HighLight.Image = 'http://www.morblox.us/asset/?id=97643886' + HighLight.Size = UDim2.new(1, 0, 1, 0) + --HighLight.Parent = TempSlot + HighLight.Visible = false -- TempSlot Children local GearReference = Instance.new("ObjectValue") @@ -78,6 +145,7 @@ TempSlot.Parent = CurrentLoadout GearReference.RobloxLocked = true GearReference.Parent = TempSlot + local ToolTipLabel = Instance.new("TextLabel") ToolTipLabel.Name = "ToolTipLabel" ToolTipLabel.RobloxLocked = true @@ -94,6 +162,7 @@ TempSlot.Parent = CurrentLoadout ToolTipLabel.Size = UDim2.new(1,60,0,20) ToolTipLabel.Position = UDim2.new(0,-30,0,-30) ToolTipLabel.Parent = TempSlot + local Kill = Instance.new("BoolValue") Kill.Name = "Kill" @@ -103,9 +172,9 @@ TempSlot.Parent = CurrentLoadout local GearImage = Instance.new("ImageLabel") GearImage.Name = "GearImage" GearImage.BackgroundTransparency = 1 - GearImage.Position = UDim2.new(0,-7,0,-7) - GearImage.Size = UDim2.new(1,14,1,14) - GearImage.ZIndex = 2 + GearImage.Position = UDim2.new(0, 0, 0, 0) + GearImage.Size = UDim2.new(1, 0, 1, 0) + GearImage.ZIndex = 5.0 GearImage.RobloxLocked = true GearImage.Parent = TempSlot @@ -115,26 +184,30 @@ TempSlot.Parent = CurrentLoadout SlotNumber.BorderSizePixel = 0 SlotNumber.Font = Enum.Font.ArialBold SlotNumber.FontSize = Enum.FontSize.Size18 - SlotNumber.Position = UDim2.new(0,-7,0,-7) + SlotNumber.Position = UDim2.new(0, 0, 0, 0) SlotNumber.Size = UDim2.new(0,10,0,15) SlotNumber.TextColor3 = Color3.new(1,1,1) SlotNumber.TextTransparency = 0 SlotNumber.TextXAlignment = Enum.TextXAlignment.Left - SlotNumber.TextYAlignment = Enum.TextYAlignment.Bottom - SlotNumber.ZIndex = 4 + SlotNumber.TextYAlignment = Enum.TextYAlignment.Bottom SlotNumber.RobloxLocked = true SlotNumber.Parent = TempSlot + SlotNumber.ZIndex = 5 + + if IsTouchDevice() then + SlotNumber.Visible = false + end - local SlotNumberDownShadow = SlotNumber:clone() + local SlotNumberDownShadow = SlotNumber:Clone() SlotNumberDownShadow.Name = "SlotNumberDownShadow" - SlotNumberDownShadow.TextColor3 = Color3.new(0,0,0) - SlotNumberDownShadow.ZIndex = 3 - SlotNumberDownShadow.Position = UDim2.new(0,-6,0,-6) + SlotNumberDownShadow.TextColor3 = Color3.new(0,0,0) + SlotNumberDownShadow.Position = UDim2.new(0, 1, 0, -1) SlotNumberDownShadow.Parent = TempSlot + SlotNumberDownShadow.ZIndex = 2 - local SlotNumberUpShadow = SlotNumberDownShadow:clone() + local SlotNumberUpShadow = SlotNumberDownShadow:Clone() SlotNumberUpShadow.Name = "SlotNumberUpShadow" - SlotNumberUpShadow.Position = UDim2.new(0,-8,0,-8) + SlotNumberUpShadow.Position = UDim2.new(0, -1, 0, -1) SlotNumberUpShadow.Parent = TempSlot local GearText = Instance.new("TextLabel") @@ -143,13 +216,13 @@ TempSlot.Parent = CurrentLoadout GearText.BackgroundTransparency = 1 GearText.Font = Enum.Font.Arial GearText.FontSize = Enum.FontSize.Size14 - GearText.Position = UDim2.new(0,-8,0,-8) - GearText.ZIndex = 2 + GearText.Position = UDim2.new(0,-8,0,-8) GearText.Size = UDim2.new(1,16,1,16) GearText.Text = "" GearText.TextColor3 = Color3.new(1,1,1) GearText.TextWrap = true GearText.Parent = TempSlot + GearText.ZIndex = 5.0 --- Great, now lets make the inventory! @@ -157,9 +230,9 @@ local Backpack = Instance.new("Frame") Backpack.RobloxLocked = true Backpack.Visible = false Backpack.Name = "Backpack" -Backpack.Position = UDim2.new(0.5,0,0.5,0) -Backpack.BackgroundColor3 = Color3.new(0,0,0) -Backpack.BackgroundTransparency = 0.08 +Backpack.Position = UDim2.new(0.5, 0, 0.5, 0) +Backpack.BackgroundColor3 = Color3.new(32/255, 32/255, 32/255) +Backpack.BackgroundTransparency = 0.0 Backpack.BorderSizePixel = 0 Backpack.Parent = gui Backpack.Active = true @@ -183,7 +256,8 @@ Backpack.Active = true local Tabs = Instance.new("Frame") Tabs.Name = "Tabs" - Tabs.Visible = true + Tabs.Visible = false + Tabs.Active = false Tabs.RobloxLocked = true Tabs.BackgroundColor3 = Color3.new(0,0,0) Tabs.BackgroundTransparency = 0.08 @@ -256,8 +330,8 @@ Backpack.Active = true local XImage = Instance.new("ImageLabel") XImage.RobloxLocked = true XImage.Name = "XImage" - game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=75547445") - XImage.Image = "http://www.roblox.com/asset/?id=75547445" --TODO: move to rbxasset + game:GetService("ContentProvider"):Preload("http://www.morblox.us/asset/?id=75547445") + XImage.Image = "http://www.morblox.us/asset/?id=75547445" --TODO: move to rbxasset XImage.BackgroundTransparency = 1 XImage.Position = UDim2.new(-.25,-1,-.25,-1) XImage.Size = UDim2.new(1.5,2,1.5,2) @@ -343,18 +417,27 @@ Backpack.Active = true local GearGrid = Instance.new("Frame") GearGrid.RobloxLocked = true GearGrid.Name = "GearGrid" - GearGrid.Size = UDim2.new(0.69,0,1,0) + GearGrid.Size = UDim2.new(0.95, 0, 1, 0) GearGrid.BackgroundTransparency = 1 - GearGrid.Parent = Gear + GearGrid.Parent = Gear local GearButton = Instance.new("ImageButton") GearButton.RobloxLocked = true GearButton.Visible = false GearButton.Name = "GearButton" - GearButton.Size = UDim2.new(0,64,0,64) - GearButton.Style = Enum.ButtonStyle.RobloxButton + GearButton.Size = UDim2.new(0, 54, 0, 54) + GearButton.Style = 'Custom' GearButton.Parent = GearGrid + GearButton.BackgroundTransparency = 1.0 + + local slotBackground = Instance.new('ImageLabel') + slotBackground.Name = 'Background' + slotBackground.BackgroundTransparency = 1.0 + slotBackground.Image = 'http://www.morblox.us/asset/?id=97613075' + slotBackground.Size = UDim2.new(1, 0, 1, 0) + slotBackground.Parent = GearButton + -- GearButton Children local GearReference = Instance.new("ObjectValue") @@ -389,8 +472,8 @@ Backpack.Active = true local GearGridScrollingArea = Instance.new("Frame") GearGridScrollingArea.RobloxLocked = true GearGridScrollingArea.Name = "GearGridScrollingArea" - GearGridScrollingArea.Position = UDim2.new(0.7,0,0,35) - GearGridScrollingArea.Size = UDim2.new(0,17,1,-45) + GearGridScrollingArea.Position = UDim2.new(1, -19, 0, 35) + GearGridScrollingArea.Size = UDim2.new(0, 17, 1, -45) GearGridScrollingArea.BackgroundTransparency = 1 GearGridScrollingArea.Parent = Gear @@ -684,24 +767,24 @@ Backpack.Active = true --CharacterPane Children local FaceFrame = makeCharFrame("FacesFrame", CharacterPane) - game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=75460621") - makeZone("FaceZone","http://www.roblox.com/asset/?id=75460621",UDim2.new(0,157,0,137),UDim2.new(0.5,-78,0.5,-68),FaceFrame) + game:GetService("ContentProvider"):Preload("http://www.morblox.us/asset/?id=75460621") + makeZone("FaceZone","http://www.morblox.us/asset/?id=75460621",UDim2.new(0,157,0,137),UDim2.new(0.5,-78,0.5,-68),FaceFrame) makeStyledButton("Face",UDim2.new(0,64,0,64),UDim2.new(0.5,-32,0.5,-135),FaceFrame) local HeadFrame = makeCharFrame("HeadsFrame", CharacterPane) - makeZone("FaceZone","http://www.roblox.com/asset/?id=75460621",UDim2.new(0,157,0,137),UDim2.new(0.5,-78,0.5,-68),HeadFrame) + makeZone("FaceZone","http://www.morblox.us/asset/?id=75460621",UDim2.new(0,157,0,137),UDim2.new(0.5,-78,0.5,-68),HeadFrame) makeStyledButton("Head",UDim2.new(0,64,0,64),UDim2.new(0.5,-32,0.5,-135),HeadFrame) local HatsFrame = makeCharFrame("HatsFrame", CharacterPane) - game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=75457888") - local HatsZone = makeZone("HatsZone","http://www.roblox.com/asset/?id=75457888",UDim2.new(0,186,0,184),UDim2.new(0.5,-93,0.5,-100), HatsFrame) + game:GetService("ContentProvider"):Preload("http://www.morblox.us/asset/?id=75457888") + local HatsZone = makeZone("HatsZone","http://www.morblox.us/asset/?id=75457888",UDim2.new(0,186,0,184),UDim2.new(0.5,-93,0.5,-100), HatsFrame) makeStyledButton("Hat1Button",UDim2.new(0,64,0,64),UDim2.new(0,-1,0,-1),HatsZone,Enum.ButtonStyle.RobloxButton) makeStyledButton("Hat2Button",UDim2.new(0,64,0,64),UDim2.new(0,63,0,-1),HatsZone,Enum.ButtonStyle.RobloxButton) makeStyledButton("Hat3Button",UDim2.new(0,64,0,64),UDim2.new(0,127,0,-1),HatsZone,Enum.ButtonStyle.RobloxButton) local PantsFrame = makeCharFrame("PantsFrame", CharacterPane) - game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=75457920") - makeZone("PantsZone","http://www.roblox.com/asset/?id=75457920",UDim2.new(0,121,0,99),UDim2.new(0.5,-60,0.5,-100),PantsFrame) + game:GetService("ContentProvider"):Preload("http://www.morblox.us/asset/?id=75457920") + makeZone("PantsZone","http://www.morblox.us/asset/?id=75457920",UDim2.new(0,121,0,99),UDim2.new(0.5,-60,0.5,-100),PantsFrame) local pantFrame = Instance.new("Frame") pantFrame.RobloxLocked = true @@ -739,19 +822,19 @@ Backpack.Active = true makeTextLabel("LeftArmLabel","Left Arm",UDim2.new(0.5,-16,0,-25),leftArmButton) local TShirtFrame = makeCharFrame("T-ShirtsFrame",CharacterPane) - game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=75460642") - makeZone("TShirtZone","http://www.roblox.com/asset/?id=75460642",UDim2.new(0,121,0,154),UDim2.new(0.5,-60,0.5,-100),TShirtFrame) + game:GetService("ContentProvider"):Preload("http://www.morblox.us/asset/?id=75460642") + makeZone("TShirtZone","http://www.morblox.us/asset/?id=75460642",UDim2.new(0,121,0,154),UDim2.new(0.5,-60,0.5,-100),TShirtFrame) makeStyledButton("TShirtButton", UDim2.new(0,64,0,64),UDim2.new(0.5,-32,0.5,-64),TShirtFrame) local ShirtFrame = makeCharFrame("ShirtsFrame", CharacterPane) - makeZone("ShirtZone","http://www.roblox.com/asset/?id=75460642",UDim2.new(0,121,0,154),UDim2.new(0.5,-60,0.5,-100),ShirtFrame) + makeZone("ShirtZone","http://www.morblox.us/asset/?id=75460642",UDim2.new(0,121,0,154),UDim2.new(0.5,-60,0.5,-100),ShirtFrame) makeStyledButton("ShirtButton", UDim2.new(0,64,0,64),UDim2.new(0.5,-32,0.5,-64),ShirtFrame) local ColorFrame = makeCharFrame("ColorFrame", CharacterPane) - game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=76049888") - local ColorZone = makeZone("ColorZone","http://www.roblox.com/asset/?id=76049888", UDim2.new(0,120,0,150),UDim2.new(0.5,-60,0.5,-100),ColorFrame) + game:GetService("ContentProvider"):Preload("http://www.morblox.us/asset/?id=76049888") + local ColorZone = makeZone("ColorZone","http://www.morblox.us/asset/?id=76049888", UDim2.new(0,120,0,150),UDim2.new(0.5,-60,0.5,-100),ColorFrame) makeStyledButton("Head",UDim2.new(0.26,0,0.19,0),UDim2.new(0.37,0,0.02,0),ColorZone).AutoButtonColor = false makeStyledButton("LeftArm",UDim2.new(0.19,0,0.36,0),UDim2.new(0.78,0,0.26,0),ColorZone).AutoButtonColor = false makeStyledButton("RightArm",UDim2.new(0.19,0,0.36,0),UDim2.new(0.025,0,0.26,0),ColorZone).AutoButtonColor = false @@ -788,4 +871,5 @@ Backpack.Active = true SaveButton.Parent = CharacterPane -- no need for this to stick around -script:remove() \ No newline at end of file + +script:Destroy() \ No newline at end of file diff --git a/public/asset/13 b/public/asset/13 index eb862b9..f54db0e 100644 --- a/public/asset/13 +++ b/public/asset/13 @@ -1,8 +1,6 @@ %13% -- This script manages context switches in the backpack (Gear to Wardrobe, etc.) and player state changes. Also manages global functions across different tabs (currently only search) -print("mamanger") if game.CoreGui.Version < 7 then return end -- peace out if we aren't using the right client -print("made it past gui version check") -- basic functions local function waitForChild(instance, name) @@ -56,6 +54,10 @@ local searchBox = waitForChild(backpack.SearchFrame.SearchBoxFrame,"SearchBox") local searchButton = waitForChild(backpack.SearchFrame,"SearchButton") local resetButton = waitForChild(backpack.SearchFrame,"ResetButton") +local robloxGui = waitForChild(Game.CoreGui, 'RobloxGui') +local currentLoadout = waitForChild(robloxGui, 'CurrentLoadout') +local loadoutBackground = waitForChild(currentLoadout, 'Background') + local canToggle = true local readyForNextEvent = true local backpackIsOpen = false @@ -63,12 +65,20 @@ local active = true local humanoidDiedCon = nil +local backpackButtonPos + local guiTweenSpeed = 0.25 -- how quickly we open/close the backpack local searchDefaultText = "Search..." local tilde = "~" local backquote = "`" +local backpackSize = UDim2.new(0, 600, 0, 400) + +if robloxGui.AbsoluteSize.Y <= 320 then + backpackSize = UDim2.new(0, 200, 0, 140) +end + ------------------------ End Locals --------------------------- @@ -120,6 +130,9 @@ function activateBackpack() initHumanoidDiedConnections() active = true backpack.Visible = backpackIsOpen + if backpackIsOpen then + toggleBackpack() + end end function initHumanoidDiedConnections() @@ -139,7 +152,7 @@ local hideBackpack = function() backpackCloseEvent:Fire(currentTab) backpack.Tabs.Visible = false searchFrame.Visible = false - backpack:TweenSizeAndPosition(UDim2.new(0,0,0,0),UDim2.new(0.5,0,0.5,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, guiTweenSpeed, true, + backpack:TweenSizeAndPosition(UDim2.new(0, backpackSize.X.Offset,0, 0), UDim2.new(0.5, -backpackSize.X.Offset/2, 1, -85), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, guiTweenSpeed, true, function() game.GuiService:RemoveCenterDialog(backpack) backpack.Visible = false @@ -149,6 +162,7 @@ local hideBackpack = function() game.GuiService:RemoveCenterDialog(backpack) backpack.Visible = false backpackButton.Selected = false + readyForNextEvent = true canToggle = true end) end @@ -164,20 +178,22 @@ function showBackpack() backpackButton.Selected = false end) backpack.Visible = true - backpackButton.Selected = true - backpack:TweenSizeAndPosition(UDim2.new(0.55, 0, 0.76, 0),UDim2.new(0.225, 0, 0.09, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, guiTweenSpeed, true) + backpackButton.Selected = true + backpack:TweenSizeAndPosition(backpackSize, UDim2.new(0.5, -backpackSize.X.Offset/2, 1, -backpackSize.Y.Offset - 88), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, guiTweenSpeed, true) delay(guiTweenSpeed,function() - backpack.Tabs.Visible = true + backpack.Tabs.Visible = false searchFrame.Visible = true backpackOpenEvent:Fire(currentTab) canToggle = true + readyForNextEvent = true + backpackButton.Image = 'rbxasset://Textures/IPadInGameGUIToolbarBkpkTabTopV4.png' + backpackButton.Position = UDim2.new(0.5, -60, 1, -backpackSize.Y.Offset - 103) end) end -function toggleBackpack() +function toggleBackpack() if not game.Players.LocalPlayer then return end if not game.Players.LocalPlayer["Character"] then return end - if not canToggle then return end if not readyForNextEvent then return end readyForNextEvent = false @@ -185,11 +201,42 @@ function toggleBackpack() backpackIsOpen = not backpackIsOpen - if backpackIsOpen then + if backpackIsOpen then + loadoutBackground.Image = 'rbxasset://Textures/IPadInGameGUIToolBarBkgd.png' + loadoutBackground.Position = UDim2.new(-0.03, 0, -0.17, 0) + loadoutBackground.Size = UDim2.new(1.05, 0, 1.25, 0) + loadoutBackground.ZIndex = 2.0 + loadoutBackground.Visible = true + --backpackButton.Position = UDim2.new(0.5, -60, 1, -503) showBackpack() - else - backpackButton.Selected = false + else + backpackButton.Position = UDim2.new(0.5, -60, 1, -44) + loadoutBackground.Visible = false + backpackButton.Selected = false + backpackButton.Image = "rbxasset://Textures/IPadInGameGUIToolbarBkpkTabTopV3.png" + loadoutBackground.Image = 'rbxasset://Textures/IPadInGameGUIToolbar.png' + loadoutBackground.Position = UDim2.new(-0.1, 0, -0.1, 0) + loadoutBackground.Size = UDim2.new(1.2, 0, 1.2, 0) hideBackpack() + + + local clChildren = currentLoadout:GetChildren() + for i = 1, #clChildren do + if clChildren[i] and clChildren[i]:IsA('Frame') then + local frame = clChildren[i] + if #frame:GetChildren() > 0 then + backpackButton.Position = UDim2.new(0.5, -60, 1, -108) + backpackButton.Visible = true + loadoutBackground.Visible = true + if frame:GetChildren()[1]:IsA('ImageButton') then + local imgButton = frame:GetChildren()[1] + imgButton.Active = true + imgButton.Draggable = false + end + end + end + end + end end @@ -347,6 +394,7 @@ end) if game.Players.LocalPlayer["Character"] then activateBackpack() end + game.Players.LocalPlayer.CharacterAdded:connect(activateBackpack) -- search functions @@ -360,4 +408,9 @@ end) searchButton.MouseButton1Click:connect(doSearch) resetButton.MouseButton1Click:connect(resetSearch) -backpackButton.Visible = true +if searchFrame and robloxGui.AbsoluteSize.Y <= 320 then + searchFrame.RobloxLocked = false + searchFrame:Destroy() +end + +--backpackButton.Visible = true \ No newline at end of file diff --git a/public/asset/14 b/public/asset/14 index 9570109..117cf43 100644 --- a/public/asset/14 +++ b/public/asset/14 @@ -4,6 +4,7 @@ local function waitForChild(instance, name) assert(instance) assert(name) while not instance:FindFirstChild(name) do + print('Waiting for ...', instance, name) instance.ChildAdded:wait() end return instance:FindFirstChild(name) @@ -16,6 +17,13 @@ local function waitForProperty(instance, property) end end +local function IsTouchDevice() + local touchEnabled = false + pcall(function() touchEnabled = Game:GetService('UserInputService').TouchEnabled end) + return touchEnabled +end + + waitForChild(game,"Players") waitForProperty(game.Players,"LocalPlayer") local player = game.Players.LocalPlayer @@ -67,7 +75,7 @@ local searchRequestedEvent = waitForChild(backpackManager,"SearchRequestedEvent" local tellBackpackReadyFunc = waitForChild(backpackManager,"BackpackReady") -- creating scroll bar early as to make sure items get placed correctly -local scrollFrame, scrollUp, scrollDown, recalculateScroll = RbxGui.CreateScrollingFrame(nil,"grid") +local scrollFrame, scrollUp, scrollDown, recalculateScroll = RbxGui.CreateScrollingFrame(nil, "grid", Vector2.new(6, 6)) scrollFrame.Position = UDim2.new(0,0,0,30) scrollFrame.Size = UDim2.new(1,0,1,-30) @@ -236,6 +244,7 @@ end function previewGear(button) if not browsingMenu then + gearPreview.Visible = false gearPreview.GearImage.Image = button.Image gearPreview.GearStats.GearName.Text = button.GearReference.Value.Name end @@ -276,7 +285,7 @@ end function resizeGrid() for k,v in pairs(backpackItems) do if not v:FindFirstChild("RobloxBuildTool") then - if not buttons[v] then + if not buttons[v] then local buttonClone = gearButton:clone() buttonClone.Parent = grid.ScrollingFrame buttonClone.Visible = true @@ -289,18 +298,26 @@ function resizeGrid() buttonClone.Draggable = true buttons[v] = buttonClone - local unequipMenu = getGearContextMenu() + + if not IsTouchDevice() then + local unequipMenu = getGearContextMenu() + - unequipMenu.Visible = false - unequipMenu.Parent = buttonClone + unequipMenu.Visible = false + unequipMenu.Parent = buttonClone + end local beginPos = nil buttonClone.DragBegin:connect(function(value) - buttonClone.ZIndex = 9 + waitForChild(buttonClone, 'Background') + buttonClone['Background'].ZIndex = 10 + buttonClone.ZIndex = 10 beginPos = value end) buttonClone.DragStopped:connect(function(x,y) - buttonClone.ZIndex = 1 + waitForChild(buttonClone, 'Background') + buttonClone['Background'].ZIndex = 1.0 + buttonClone.ZIndex = 2 if beginPos ~= buttonClone.Position then if not checkForSwap(buttonClone,x,y) then buttonClone:TweenPosition(beginPos,Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true) @@ -622,7 +639,7 @@ function nukeBackpack() end end -function getGearContextMenu() +function getGearContextMenu() local gearContextMenu = Instance.new("Frame") gearContextMenu.Active = true gearContextMenu.Name = "UnequipContextMenu" @@ -671,27 +688,30 @@ function getGearContextMenu() button.ZIndex = 9 button.Parent = gearContextMenuButton - button.MouseButton1Click:connect(function() - if button.Active and not gearContextMenu.Parent.Active then - local success, result = pcall(function() element.DoIt(element, gearContextMenu) end) - browsingMenu = false - gearContextMenu.Visible = false - clearHighlight(button) - clearPreview() - end - end) - - button.MouseEnter:connect(function() - if button.Active and gearContextMenu.Parent.Active then - highlight(button) - end - end) - button.MouseLeave:connect(function() - if button.Active and gearContextMenu.Parent.Active then - clearHighlight(button) - end - end) - + if not IsTouchDevice() then + + button.MouseButton1Click:connect(function() + if button.Active and not gearContextMenu.Parent.Active then + local success, result = pcall(function() element.DoIt(element, gearContextMenu) end) + browsingMenu = false + gearContextMenu.Visible = false + clearHighlight(button) + clearPreview() + end + end) + + button.MouseEnter:connect(function() + if button.Active and gearContextMenu.Parent.Active then + highlight(button) + end + end) + button.MouseLeave:connect(function() + if button.Active and gearContextMenu.Parent.Active then + clearHighlight(button) + end + end) + end + contextElement.Button = button contextElement.Element = button elseif element.Type == "Label" then diff --git a/public/asset/15 b/public/asset/15 index 889dde3..7e2c614 100644 --- a/public/asset/15 +++ b/public/asset/15 @@ -19,16 +19,47 @@ local StaticTabName = "gear" local robloxGui = game:GetService("CoreGui"):FindFirstChild("RobloxGui") assert(robloxGui) +local controlFrame = waitForChild(robloxGui, 'ControlFrame') +local backpackButton = waitForChild(controlFrame, 'BackpackButton') +local backpack = waitForChild(robloxGui, 'Backpack') waitForChild(robloxGui,"CurrentLoadout") waitForChild(robloxGui.CurrentLoadout,"TempSlot") waitForChild(robloxGui.CurrentLoadout.TempSlot,"SlotNumber") +waitForChild(currentLoadout, 'Background') +local clBackground = currentLoadout.Background + +local function IsTouchDevice() + local touchEnabled = false + pcall(function() touchEnabled = Game:GetService('UserInputService').TouchEnabled end) + return touchEnabled +end + +local function moveHealthBar(pGui) + waitForChild(pGui, 'HealthGUI') + waitForChild(pGui['HealthGUI'], 'tray') + local tray = pGui['HealthGUI']['tray'] + tray.Position = UDim2.new(0.5, -85, 1, -26) +end + + --- Begin Locals waitForChild(game,"Players") waitForProperty(game.Players,"LocalPlayer") local player = game.Players.LocalPlayer +waitForChild(player, 'PlayerGui') +Spawn(function() + moveHealthBar(player.PlayerGui) +end) + +while player.Character == nil do wait(0.03) end +local humanoid = waitForChild(player.Character, 'Humanoid') +humanoid.Died:connect(function() + backpackButton.Visible = false +end) + waitForChild(game, "LocalBackpack") game.LocalBackpack:SetOldSchoolBackpack(false) @@ -44,6 +75,10 @@ local resizeEvent = waitForChild(backpackManager,"ResizeEvent") local inGearTab = true local maxNumLoadoutItems = 10 +if robloxGui.AbsoluteSize.Y <= 320 then + maxNumLoadoutItems = 4 +end + local characterChildAddedCon = nil local backpackChildCon = nil @@ -56,6 +91,8 @@ local buttonSizeNormal = UDim2.new(1,0,1,0) local enlargeOverride = true local guiTweenSpeed = 0.5 +local firstInstanceOfLoadout = false + local inventory = {} for i = 0, 9 do @@ -66,6 +103,8 @@ local gearSlots = {} for i = 1, maxNumLoadoutItems do gearSlots[i] = "empty" end + +local backpackWasOpened = false --- End Locals @@ -74,6 +113,14 @@ end -- Begin Functions +local function backpackIsOpen() + if guiBackpack then + return guiBackpack.Visible + end + return false +end + + local function kill(prop,con,gear) if con then con:disconnect() end if prop == true and gear then @@ -118,15 +165,35 @@ function removeGear(gear) gearSlots[emptySlot] = "empty" local centerizeX = gear.Size.X.Scale/2 - local centerizeY = gear.Size.Y.Scale/2 - gear:TweenSizeAndPosition(UDim2.new(0,0,0,0), + local centerizeY = gear.Size.Y.Scale/2 + --[[gear:TweenSizeAndPosition(UDim2.new(0,0,0,0), UDim2.new(gear.Position.X.Scale + centerizeX,gear.Position.X.Offset,gear.Position.Y.Scale + centerizeY,gear.Position.Y.Offset), - Enum.EasingDirection.Out, Enum.EasingStyle.Quad,guiTweenSpeed/4,true) - delay(guiTweenSpeed/2, + Enum.EasingDirection.Out, Enum.EasingStyle.Quad,guiTweenSpeed/4,true)]] + delay(0, function() gear:remove() - end) - end + end) + + Spawn(function() + while backpackIsOpen() do wait(0.03) end + waitForChild(player, 'Backpack') + local allEmpty = true + for i = 1, #gearSlots do + if gearSlots[i] ~= 'empty' then + allEmpty = false + end + end + + if allEmpty then + if #player.Backpack:GetChildren() < 1 then + backpackButton.Visible = false + else + backpackButton.Position = UDim2.new(0.5, -60, 1, -44) + end + clBackground.Visible = false + end + end) + end end function insertGear(gear, addToSlot) @@ -320,8 +387,12 @@ enlargeButton = function(button) return end + if button:FindFirstChild('Highlight') then + button.Highlight.Visible = true + end + if button:IsA("ImageButton") or button:IsA("TextButton") then - button.ZIndex = 2 + button.ZIndex = 5 local centerizeX = -(buttonSizeEnlarge.X.Scale - button.Size.X.Scale)/2 local centerizeY = -(buttonSizeEnlarge.Y.Scale - button.Size.Y.Scale)/2 button:TweenSizeAndPosition(buttonSizeEnlarge, @@ -349,6 +420,10 @@ normalizeButton = function(button, speed) local moveSpeed = speed if moveSpeed == nil or type(moveSpeed) ~= "number" then moveSpeed = guiTweenSpeed/5 end + if button:FindFirstChild('Highlight') then + button.Highlight.Visible = false + end + if button:IsA("ImageButton") or button:IsA("TextButton") then button.ZIndex = 1 local inverseEnlarge = 1/enlargeFactor @@ -463,7 +538,7 @@ function unequipAllItems(dontEquipThis) end function showToolTip(button, tip) - if button and button:FindFirstChild("ToolTipLabel") and button.ToolTipLabel:IsA("TextLabel") then + if button and button:FindFirstChild("ToolTipLabel") and button.ToolTipLabel:IsA("TextLabel") and not IsTouchDevice() then button.ToolTipLabel.Text = tostring(tip) local xSize = button.ToolTipLabel.TextBounds.X + 6 button.ToolTipLabel.Size = UDim2.new(0,xSize,0,20) @@ -478,7 +553,7 @@ function hideToolTip(button, tip) end end -local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButton) +local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButton) waitForDebounce() debounce = true @@ -495,11 +570,10 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt if gearSlots[i] ~= "empty" and gearSlots[i].GearReference.Value == child then -- we already have gear, do nothing debounce = false return - end + end end end - local gearClone = currentLoadout.TempSlot:clone() gearClone.Name = child.Name gearClone.GearImage.Image = child.TextureId @@ -586,8 +660,8 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt end end) dragBegin = gearClone.DragBegin:connect(function(pos) - dragBeginPos = pos - gearClone.ZIndex = 7 + dragBeginPos = pos + gearClone.ZIndex = 7 local children = gearClone:GetChildren() for i = 1, #children do if children[i]:IsA("TextLabel") then @@ -603,9 +677,9 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt end) dragStop = gearClone.DragStopped:connect(function(x,y) if gearClone.Selected then - gearClone.ZIndex = 2 + gearClone.ZIndex = 4 else - gearClone.ZIndex = 1 + gearClone.ZIndex = 3 end local children = gearClone:GetChildren() for i = 1, #children do @@ -665,6 +739,16 @@ local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButt debounce = false + Spawn(function() + while backpackIsOpen() do wait(0.03) end + for i = 1, #gearSlots do + if gearSlots[i] ~= 'empty' then + backpackButton.Position = UDim2.new(0.5, -60, 1, -108) + backpackButton.Visible = true + clBackground.Visible = true + end + end + end) end function addToInventory(child) @@ -700,16 +784,21 @@ local spreadOutGear = function() if loadoutChildren[i]:IsA("Frame") then loadoutChildren[i].BackgroundTransparency = 0.5 local slot = tonumber(string.sub(loadoutChildren[i].Name,5)) - if slot == 0 then slot = 10 end - loadoutChildren[i]:TweenPosition(UDim2.new((slot - 1)/10,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, true) + if slot == 0 then slot = 10 end + if robloxGui.AbsoluteSize.Y <= 320 then + loadoutChildren[i]:TweenPosition(UDim2.new(0,(slot-1) * 60,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, true) + else + loadoutChildren[i]:TweenPosition(UDim2.new((slot - 1)/10,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, true) + end end end end local centerGear = function() + backpackWasOpened = true loadoutChildren = currentLoadout:GetChildren() local gearButtons = {} - local lastSlotAdd = nlii + local lastSlotAdd = nil for i = 1, #loadoutChildren do if loadoutChildren[i]:IsA("Frame") then @@ -726,12 +815,17 @@ local centerGear = function() if lastSlotAdd then table.insert(gearButtons,lastSlotAdd) end local startPos = ( 1 - (#gearButtons * 0.1) ) / 2 - for i = 1, #gearButtons do - gearButtons[i]:TweenPosition(UDim2.new(startPos + ((i - 1) * 0.1),0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, true) + for i = 1, #gearButtons do + if robloxGui.AbsoluteSize.Y <= 320 then + startPos = ( 0.5 - (#gearButtons * 0.333)/2 ) + gearButtons[i]:TweenPosition(UDim2.new(startPos + (i-1) * 0.33, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, true) + else + gearButtons[i]:TweenPosition(UDim2.new(startPos + ((i - 1) * 0.1),0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, true) + end end end -function editLoadout() +function editLoadout() if inGearTab then spreadOutGear() end @@ -743,12 +837,17 @@ function readonlyLoadout() end end -function setupBackpackListener() +function setupBackpackListener() if backpackChildCon then backpackChildCon:disconnect() backpackChildCon = nil end - backpackChildCon = player.Backpack.ChildAdded:connect(function(child) + backpackChildCon = player.Backpack.ChildAdded:connect(function(child) + if not firstInstanceOfLoadout then + firstInstanceOfLoadout = true + backpackButton.Visible = true + clBackground.Visible = true + end addingPlayerChild(child) addToInventory(child) - end) + end) end function playerCharacterChildAdded(child) @@ -772,24 +871,54 @@ function tabHandler(inFocus) readonlyLoadout() end end + +-- NOTE: Nuke once event based system works 100% cases +local function handlePhoneLag() + for i = 1, 45 do + if i < 25 or not backpackWasOpened then + if robloxGui.AbsoluteSize.Y <= 320 then + local cChildren = currentLoadout:GetChildren() + for i = 1, #cChildren do + local slotNum = tonumber(string.sub(cChildren[i].Name, 5, string.len(cChildren[i].Name))) + if type(slotNum) == 'number' then + cChildren[i].Position = UDim2.new(0, (slotNum-1) * 60, 0, 0) + cChildren[i].BackgroundTransparency = 1.0 + end + end + end + end + wait(0.25) + end +end -- End Functions - - - - - -- Begin Script wait() -- let stuff initialize incase this is first heartbeat... waitForChild(player,"Backpack") waitForProperty(player,"Character") -local backpackChildren = player.Backpack:GetChildren() -local size = math.min(10,#backpackChildren) -for i = 1, size do - addingPlayerChild(backpackChildren[i],false) -end -setupBackpackListener() + +-- not sure why this had no delay but the player.CharacterAdded one had one... this type of error would be easier to avoid with function reusage +delay(1,function() + local backpackChildren = player.Backpack:GetChildren() + local size = math.min(10,#backpackChildren) + for i = 1, size do + backpackButton.Visible = true + clBackground.Visible = true + addingPlayerChild(backpackChildren[i],false) + end + setupBackpackListener() +end) + +-- NOTE: This is terrible. Event based system seems to fail almost 30% cases +-- So using polling here. Consider this as an intermediate alternative. +delay(0, handlePhoneLag) + +player.ChildAdded:connect(function(child) + if child:IsA('PlayerGui') then + moveHealthBar(child) + end +end) waitForProperty(player,"Character") for i,v in ipairs(player.Character:GetChildren()) do @@ -801,7 +930,7 @@ waitForChild(player.Character,"Humanoid") humanoidDiedCon = player.Character.Humanoid.Died:connect(function() if humanoidDiedCon then humanoidDiedCon:disconnect() humanoidDiedCon = nil end deactivateLoadout() - if backpackChildCon then backpackChildCon:disconnect() backpackChildCon = nil end + if backpackChildCon then backpackChildCon:disconnect() backpackChildCon = nil end end) player.CharacterRemoving:connect(function() @@ -813,22 +942,25 @@ player.CharacterRemoving:connect(function() end end) -player.CharacterAdded:connect(function() - waitForProperty(game.Players,"LocalPlayer") +player.CharacterAdded:connect(function() + backpackWasOpened = false + waitForProperty(game.Players,"LocalPlayer") player = game.Players.LocalPlayer -- make sure we are still looking at the correct character - waitForChild(player,"Backpack") + waitForChild(player,"Backpack") delay(1,function() local backpackChildren = player.Backpack:GetChildren() local size = math.min(10,#backpackChildren) for i = 1, size do + backpackButton.Visible = true + clBackground.Visible = true addingPlayerChild(backpackChildren[i],false) end setupBackpackListener() end) - activateLoadout() + activateLoadout() if characterChildAddedCon then characterChildAddedCon:disconnect() @@ -841,14 +973,23 @@ player.CharacterAdded:connect(function() end) waitForChild(player.Character,"Humanoid") + if backpack.Visible then + backpackOpenEvent:Fire() + end humanoidDiedCon = player.Character.Humanoid.Died:connect(function() - deactivateLoadout() + backpackButton.Visible = false + clBackground.Visible = false + firstInstanceOfLoadout = false + deactivateLoadout() if humanoidDiedCon then humanoidDiedCon:disconnect() humanoidDiedCon = nil end if backpackChildCon then backpackChildCon:disconnect() backpackChildCon = nil end end) - + waitForChild(player, 'PlayerGui') + moveHealthBar(player.PlayerGui) + delay(0, handlePhoneLag) + end) waitForChild(guiBackpack,"SwapSlot") diff --git a/public/asset/17 b/public/asset/17 index cedbed9..54e9be6 100644 --- a/public/asset/17 +++ b/public/asset/17 @@ -122,13 +122,13 @@ t.CreateStyledMessageDialog = function(title, message, style, buttons) styleImage.Position = UDim2.new(0,5,0,15) if style == "error" or style == "Error" then styleImage.Size = UDim2.new(0, 71, 0, 71) - styleImage.Image = "http://www.roblox.com/asset?id=42565285" + styleImage.Image = "http://www.morblox.us/asset?id=42565285" elseif style == "notify" or style == "Notify" then styleImage.Size = UDim2.new(0, 71, 0, 71) - styleImage.Image = "http://www.roblox.com/asset?id=42604978" + styleImage.Image = "http://www.morblox.us/asset?id=42604978" elseif style == "confirm" or style == "Confirm" then styleImage.Size = UDim2.new(0, 74, 0, 76) - styleImage.Image = "http://www.roblox.com/asset?id=42557901" + styleImage.Image = "http://www.morblox.us/asset?id=42557901" else return t.CreateMessageDialog(title,message,buttons) end @@ -237,7 +237,7 @@ t.CreateDropDownMenu = function(items, onSelect, forRoblox) local dropDownIcon = Instance.new("ImageLabel") dropDownIcon.Name = "Icon" dropDownIcon.Active = false - dropDownIcon.Image = "http://www.roblox.com/asset/?id=45732894" + dropDownIcon.Image = "http://www.morblox.us/asset/?id=45732894" dropDownIcon.BackgroundTransparency = 1 dropDownIcon.Size = UDim2.new(0,11,0,6) dropDownIcon.Position = UDim2.new(1,-11,0.5, -2) @@ -1330,7 +1330,7 @@ t.CreateScrollingFrame = function(orderList,scrollStyle) local scrollStamp = 0 local scrollDrag = Instance.new("ImageButton") - scrollDrag.Image = "http://www.roblox.com/asset/?id=61367186" + scrollDrag.Image = "http://www.morblox.us/asset/?id=61367186" scrollDrag.Size = UDim2.new(1, 0, 0, 16) scrollDrag.BackgroundTransparency = 1 scrollDrag.Name = "ScrollDrag" @@ -2603,7 +2603,7 @@ t.CreateSetPanel = function(userIdsForSets, objectSelected, dialogClosed, size, local cancelImage = Instance.new("ImageLabel") cancelImage.Name = "CancelImage" cancelImage.BackgroundTransparency = 1 - cancelImage.Image = "http://www.roblox.com/asset?id=54135717" + cancelImage.Image = "http://www.morblox.us/asset?id=54135717" cancelImage.Position = UDim2.new(0,-2,0,-2) cancelImage.Size = UDim2.new(0,16,0,16) cancelImage.ZIndex = 6 @@ -2805,7 +2805,7 @@ t.CreateSetPanel = function(userIdsForSets, objectSelected, dialogClosed, size, local function createDropDownMenuButton(parent) local dropDownButton = Instance.new("ImageButton") dropDownButton.Name = "DropDownButton" - dropDownButton.Image = "http://www.roblox.com/asset/?id=67581509" + dropDownButton.Image = "http://www.morblox.us/asset/?id=67581509" dropDownButton.BackgroundTransparency = 1 dropDownButton.Size = UDim2.new(0,16,0,16) dropDownButton.Position = UDim2.new(1,-24,0,6) @@ -3235,24 +3235,24 @@ t.CreateTerrainMaterialSelector = function(size,position) -- we so need a better way to do this for i,v in pairs(materialNames) do materialToImageMap[v] = {} - if v == "Grass" then materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=56563112" - elseif v == "Sand" then materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=62356652" - elseif v == "Brick" then materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=65961537" - elseif v == "Granite" then materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67532153" - elseif v == "Asphalt" then materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67532038" - elseif v == "Iron" then materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67532093" - elseif v == "Aluminum" then materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67531995" - elseif v == "Gold" then materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67532118" - elseif v == "Plastic (red)" then materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67531848" - elseif v == "Plastic (blue)" then materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67531924" - elseif v == "Plank" then materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67532015" - elseif v == "Log" then materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67532051" - elseif v == "Gravel" then materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67532206" - elseif v == "Cinder Block" then materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67532103" - elseif v == "Stone Wall" then materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67531804" - elseif v == "Concrete" then materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=67532059" - elseif v == "Water" then materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=81407474" - else materialToImageMap[v].Regular = "http://www.roblox.com/asset/?id=66887593" -- fill in the rest here!! + if v == "Grass" then materialToImageMap[v].Regular = "http://www.morblox.us/asset/?id=56563112" + elseif v == "Sand" then materialToImageMap[v].Regular = "http://www.morblox.us/asset/?id=62356652" + elseif v == "Brick" then materialToImageMap[v].Regular = "http://www.morblox.us/asset/?id=65961537" + elseif v == "Granite" then materialToImageMap[v].Regular = "http://www.morblox.us/asset/?id=67532153" + elseif v == "Asphalt" then materialToImageMap[v].Regular = "http://www.morblox.us/asset/?id=67532038" + elseif v == "Iron" then materialToImageMap[v].Regular = "http://www.morblox.us/asset/?id=67532093" + elseif v == "Aluminum" then materialToImageMap[v].Regular = "http://www.morblox.us/asset/?id=67531995" + elseif v == "Gold" then materialToImageMap[v].Regular = "http://www.morblox.us/asset/?id=67532118" + elseif v == "Plastic (red)" then materialToImageMap[v].Regular = "http://www.morblox.us/asset/?id=67531848" + elseif v == "Plastic (blue)" then materialToImageMap[v].Regular = "http://www.morblox.us/asset/?id=67531924" + elseif v == "Plank" then materialToImageMap[v].Regular = "http://www.morblox.us/asset/?id=67532015" + elseif v == "Log" then materialToImageMap[v].Regular = "http://www.morblox.us/asset/?id=67532051" + elseif v == "Gravel" then materialToImageMap[v].Regular = "http://www.morblox.us/asset/?id=67532206" + elseif v == "Cinder Block" then materialToImageMap[v].Regular = "http://www.morblox.us/asset/?id=67532103" + elseif v == "Stone Wall" then materialToImageMap[v].Regular = "http://www.morblox.us/asset/?id=67531804" + elseif v == "Concrete" then materialToImageMap[v].Regular = "http://www.morblox.us/asset/?id=67532059" + elseif v == "Water" then materialToImageMap[v].Regular = "http://www.morblox.us/asset/?id=81407474" + else materialToImageMap[v].Regular = "http://www.morblox.us/asset/?id=66887593" -- fill in the rest here!! end end @@ -3355,7 +3355,7 @@ t.CreateTerrainMaterialSelector = function(size,position) end t.CreateLoadingFrame = function(name,size,position) - game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=35238053") + game:GetService("ContentProvider"):Preload("http://www.morblox.us/asset/?id=35238053") local loadingFrame = Instance.new("Frame") loadingFrame.Name = "LoadingFrame" @@ -3376,7 +3376,7 @@ t.CreateLoadingFrame = function(name,size,position) local loadingGreenBar = Instance.new("ImageLabel") loadingGreenBar.Name = "LoadingGreenBar" - loadingGreenBar.Image = "http://www.roblox.com/asset/?id=35238053" + loadingGreenBar.Image = "http://www.morblox.us/asset/?id=35238053" loadingGreenBar.Position = UDim2.new(0,0,0,0) loadingGreenBar.Size = UDim2.new(0,0,1,0) loadingGreenBar.Visible = false diff --git a/public/asset/20 b/public/asset/20 index 3af0257..3b1132c 100644 --- a/public/asset/20 +++ b/public/asset/20 @@ -661,7 +661,7 @@ t.GetStampModel = function(assetId, terrainShape, useAssetVersionId) if cellType == 3 then local inverseCornerWedgeMesh = Instance.new("SpecialMesh") inverseCornerWedgeMesh.MeshType = "FileMesh" - inverseCornerWedgeMesh.MeshId = "http://www.roblox.com/asset?id=66832495" + inverseCornerWedgeMesh.MeshId = "http://www.morblox.us/asset?id=66832495" inverseCornerWedgeMesh.Scale = Vector3.new(2, 2, 2) inverseCornerWedgeMesh.Parent = newTerrainPiece end diff --git a/public/asset/5 b/public/asset/5 index f8e803a..f6248ca 100644 --- a/public/asset/5 +++ b/public/asset/5 @@ -1,1963 +1,1963 @@ -%5% -local function waitForChild(instance, name) - while not instance:FindFirstChild(name) do - instance.ChildAdded:wait() - end -end - -local function waitForProperty(instance, property) - while not instance[property] do - instance.Changed:wait() - end -end - --- A Few Script Globals -local gui -if script.Parent:FindFirstChild("ControlFrame") then - gui = script.Parent:FindFirstChild("ControlFrame") -else - gui = script.Parent -end - -local useOldDialog = true - -local helpButton = nil -local updateCameraDropDownSelection = nil -local updateVideoCaptureDropDownSelection = nil -local tweenTime = 0.2 - -local mouseLockLookScreenUrl = "http://morblox.us/asset/?id=54071825" -local classicLookScreenUrl = "http://morblox.us/asset/?id=45915798" - -local hasGraphicsSlider = false -local recordingVideo = false -local useNewGui = true - -local newGuiPlaces = {0,41324860} - --- We should probably have a better method to determine this... -local macClient = false -local isMacChat, version = pcall(function() return game.GuiService.Version end) -macClient = isMacChat and version >= 2 - -local function Color3I(r,g,b) - return Color3.new(r/255,g/255,b/255) -end - -local function robloxLock(instance) - instance.RobloxLocked = true - children = instance:GetChildren() - if children then - for i, child in ipairs(children) do - robloxLock(child) - end - end -end - -function resumeGameFunction(shield) - shield.Settings:TweenPosition(UDim2.new(0.5, -262,-0.5, -200),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) - delay(tweenTime,function() - shield.Visible = false - pcall(function() game.GuiService:RemoveCenterDialog(shield) end) - settingsButton.Active = true - end) -end - -function goToMenu(container,menuName, moveDirection) - if type(menuName) ~= "string" then return end - local containerChildren = container:GetChildren() - for i = 1, #containerChildren do - if containerChildren[i].Name == menuName then - containerChildren[i].Visible = true - containerChildren[i]:TweenPosition(UDim2.new(0,0,0,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) - else - if moveDirection == "left" then - containerChildren[i]:TweenPosition(UDim2.new(-1,-525,0,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) - elseif moveDirection == "right" then - containerChildren[i]:TweenPosition(UDim2.new(1,525,0,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) - elseif moveDirection == "up" then - containerChildren[i]:TweenPosition(UDim2.new(0,0,-1,-400),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) - elseif moveDirection == "down" then - containerChildren[i]:TweenPosition(UDim2.new(0,0,1,400),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) - end - delay(tweenTime,function() - containerChildren[i].Visible = false - end) - end - end -end - -function resetLocalCharacter() - local player = game.Players.LocalPlayer - if player then - if player.Character and player.Character:FindFirstChild("Humanoid") then - player.Character.Humanoid.Health = 0 - end - end -end - -local function createTextButton(text,style,fontSize,buttonSize,buttonPosition) - local newTextButton = Instance.new("TextButton") - newTextButton.Font = Enum.Font.Arial - newTextButton.FontSize = fontSize - newTextButton.Size = buttonSize - newTextButton.Position = buttonPosition - newTextButton.Style = style - newTextButton.TextColor3 = Color3.new(1,1,1) - newTextButton.Text = text - return newTextButton -end - -local function CreateTextButtons(frame, buttons, yPos, ySize) - if #buttons < 1 then - error("Must have more than one button") - end - - local buttonNum = 1 - local buttonObjs = {} - - local function toggleSelection(button) - for i, obj in ipairs(buttonObjs) do - if obj == button then - obj.Style = Enum.ButtonStyle.RobloxButtonDefault - else - obj.Style = Enum.ButtonStyle.RobloxButton - end - end - end - - for i, obj in ipairs(buttons) do - local button = Instance.new("TextButton") - button.Name = "Button" .. buttonNum - button.Font = Enum.Font.Arial - button.FontSize = Enum.FontSize.Size18 - button.AutoButtonColor = true - button.Style = Enum.ButtonStyle.RobloxButton - button.Text = obj.Text - button.TextColor3 = Color3.new(1,1,1) - button.MouseButton1Click:connect(function() toggleSelection(button) obj.Function() end) - button.Parent = frame - buttonObjs[buttonNum] = button - - buttonNum = buttonNum + 1 - end - - toggleSelection(buttonObjs[1]) - - local numButtons = buttonNum-1 - - if numButtons == 1 then - frame.Button1.Position = UDim2.new(0.35, 0, yPos.Scale, yPos.Offset) - frame.Button1.Size = UDim2.new(.4,0,ySize.Scale, ySize.Offset) - elseif numButtons == 2 then - frame.Button1.Position = UDim2.new(0.1, 0, yPos.Scale, yPos.Offset) - frame.Button1.Size = UDim2.new(.35,0, ySize.Scale, ySize.Offset) - - frame.Button2.Position = UDim2.new(0.55, 0, yPos.Scale, yPos.Offset) - frame.Button2.Size = UDim2.new(.35,0, ySize.Scale, ySize.Offset) - elseif numButtons >= 3 then - local spacing = .1 / numButtons - local buttonSize = .9 / numButtons - - buttonNum = 1 - while buttonNum <= numButtons do - buttonObjs[buttonNum].Position = UDim2.new(spacing*buttonNum + (buttonNum-1) * buttonSize, 0, yPos.Scale, yPos.Offset) - buttonObjs[buttonNum].Size = UDim2.new(buttonSize, 0, ySize.Scale, ySize.Offset) - buttonNum = buttonNum + 1 - end - end -end - -function recordVideoClick(recordVideoButton, stopRecordButton) - recordingVideo = not recordingVideo - if recordingVideo then - stopRecordButton.Visible = true - recordVideoButton.Text = "Stop Recording" - else - stopRecordButton.Visible = false - recordVideoButton.Text = "Record Video" - end -end - -function backToGame(buttonClicked, shield, settingsButton) - buttonClicked.Parent.Parent.Parent.Parent.Visible = false - shield.Visible = false - pcall(function() game.GuiService:RemoveCenterDialog(shield) end) - settingsButton.Active = true -end - -function setDisabledState(guiObject) - if guiObject:IsA("TextLabel") then - guiObject.TextTransparency = 0.9 - elseif guiObject:IsA("TextButton") then - guiObject.TextTransparency = 0.9 - guiObject.Active = false - else - if guiObject["ClassName"] then - print("setDisabledState() got object of unsupported type. object type is ",guiObject.ClassName) - end - end -end - -function showEnabledState(guiObject) - if guiObject:IsA("TextLabel") then - guiObject.TextTransparency = 0 - elseif guiObject:IsA("TextButton") then - guiObject.TextTransparency = 0 - guiObject.Active = true - else - if guiObject["ClassName"] then - print("showEnabledState() got object of unsupported type. object type is ",guiObject.ClassName) - end - end -end - - -local function createHelpDialog(baseZIndex) - - if helpButton == nil then - if gui:FindFirstChild("TopLeftControl") and gui.TopLeftControl:FindFirstChild("Help") then - helpButton = gui.TopLeftControl.Help - elseif gui:FindFirstChild("BottomRightControl") and gui.BottomRightControl:FindFirstChild("Help") then - helpButton = gui.BottomRightControl.Help - end - end - - local shield = Instance.new("Frame") - shield.Name = "HelpDialogShield" - shield.Active = true - shield.Visible = false - shield.Size = UDim2.new(1,0,1,0) - shield.BackgroundColor3 = Color3I(51,51,51) - shield.BorderColor3 = Color3I(27,42,53) - shield.BackgroundTransparency = 0.4 - shield.ZIndex = baseZIndex + 1 - - local helpDialog = Instance.new("Frame") - helpDialog.Name = "HelpDialog" - helpDialog.Style = Enum.FrameStyle.RobloxRound - helpDialog.Position = UDim2.new(.2, 0, .2, 0) - helpDialog.Size = UDim2.new(0.6, 0, 0.6, 0) - helpDialog.Active = true - helpDialog.Parent = shield - - local titleLabel = Instance.new("TextLabel") - titleLabel.Name = "Title" - titleLabel.Text = "Keyboard & Mouse Controls" - titleLabel.Font = Enum.Font.ArialBold - titleLabel.FontSize = Enum.FontSize.Size36 - titleLabel.Position = UDim2.new(0, 0, 0.025, 0) - titleLabel.Size = UDim2.new(1, 0, 0, 40) - titleLabel.TextColor3 = Color3.new(1,1,1) - titleLabel.BackgroundTransparency = 1 - titleLabel.Parent = helpDialog - - local buttonRow = Instance.new("Frame") - buttonRow.Name = "Buttons" - buttonRow.Position = UDim2.new(0.1, 0, .07, 40) - buttonRow.Size = UDim2.new(0.8, 0, 0, 45) - buttonRow.BackgroundTransparency = 1 - buttonRow.Parent = helpDialog - - local imageFrame = Instance.new("Frame") - imageFrame.Name = "ImageFrame" - imageFrame.Position = UDim2.new(0.05, 0, 0.075, 80) - imageFrame.Size = UDim2.new(0.9, 0, .9, -120) - imageFrame.BackgroundTransparency = 1 - imageFrame.Parent = helpDialog - - local layoutFrame = Instance.new("Frame") - layoutFrame.Name = "LayoutFrame" - layoutFrame.Position = UDim2.new(0.5, 0, 0, 0) - layoutFrame.Size = UDim2.new(1.5, 0, 1, 0) - layoutFrame.BackgroundTransparency = 1 - layoutFrame.SizeConstraint = Enum.SizeConstraint.RelativeYY - layoutFrame.Parent = imageFrame - - local image = Instance.new("ImageLabel") - image.Name = "Image" - if UserSettings().GameSettings.ControlMode == Enum.ControlMode["Mouse Lock Switch"] then - image.Image = mouseLockLookScreenUrl - else - image.Image = classicLookScreenUrl - end - image.Position = UDim2.new(-0.5, 0, 0, 0) - image.Size = UDim2.new(1, 0, 1, 0) - image.BackgroundTransparency = 1 - image.Parent = layoutFrame - - local buttons = {} - buttons[1] = {} - buttons[1].Text = "Look" - buttons[1].Function = function() - if UserSettings().GameSettings.ControlMode == Enum.ControlMode["Mouse Lock Switch"] then - image.Image = mouseLockLookScreenUrl - else - image.Image = classicLookScreenUrl - end - end - buttons[2] = {} - buttons[2].Text = "Move" - buttons[2].Function = function() - image.Image = "http://morblox.us/asset/?id=45915811" - end - buttons[3] = {} - buttons[3].Text = "Gear" - buttons[3].Function = function() - image.Image = "http://morblox.us/asset/?id=45917596" - end - buttons[4] = {} - buttons[4].Text = "Zoom" - buttons[4].Function = function() - image.Image = "http://morblox.us/asset/?id=45915825" - end - - CreateTextButtons(buttonRow, buttons, UDim.new(0, 0), UDim.new(1,0)) - - - -- set up listeners for type of mouse mode, but keep constructing gui at same time - delay(0, function() - waitForChild(gui,"UserSettingsShield") - waitForChild(gui.UserSettingsShield,"Settings") - waitForChild(gui.UserSettingsShield.Settings,"SettingsStyle") - waitForChild(gui.UserSettingsShield.Settings.SettingsStyle, "GameSettingsMenu") - waitForChild(gui.UserSettingsShield.Settings.SettingsStyle.GameSettingsMenu, "CameraField") - waitForChild(gui.UserSettingsShield.Settings. SettingsStyle.GameSettingsMenu.CameraField, "DropDownMenuButton") - gui.UserSettingsShield.Settings.SettingsStyle.GameSettingsMenu.CameraField.DropDownMenuButton.Changed:connect(function(prop) - if prop ~= "Text" then return end - if buttonRow.Button1.Style == Enum.ButtonStyle.RobloxButtonDefault then -- only change if this is the currently selected panel - if gui.UserSettingsShield.Settings.SettingsStyle.GameSettingsMenu.CameraField.DropDownMenuButton.Text == "Classic" then - image.Image = classicLookScreenUrl - else - image.Image = mouseLockLookScreenUrl - end - end - end) - end) - - - local okBtn = Instance.new("TextButton") - okBtn.Name = "OkBtn" - okBtn.Text = "OK" - okBtn.Size = UDim2.new(0.3, 0, 0, 45) - okBtn.Position = UDim2.new(0.35, 0, .975, -50) - okBtn.Font = Enum.Font.Arial - okBtn.FontSize = Enum.FontSize.Size18 - okBtn.BackgroundTransparency = 1 - okBtn.TextColor3 = Color3.new(1,1,1) - okBtn.Style = Enum.ButtonStyle.RobloxButtonDefault - okBtn.MouseButton1Click:connect( - function() - shield.Visible = false - pcall(function() game.GuiService:RemoveCenterDialog(shield) end) - end) - okBtn.Parent = helpDialog - - robloxLock(shield) - return shield -end - -local function createLeaveConfirmationMenu(baseZIndex,shield) - local frame = Instance.new("Frame") - frame.Name = "LeaveConfirmationMenu" - frame.BackgroundTransparency = 1 - frame.Size = UDim2.new(1,0,1,0) - frame.Position = UDim2.new(0,0,2,400) - frame.ZIndex = baseZIndex + 4 - - local yesButton = createTextButton("Yes",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size24,UDim2.new(0,128,0,50),UDim2.new(0,313,0.8,0)) - yesButton.Name = "YesButton" - yesButton.ZIndex = baseZIndex + 4 - yesButton.Parent = frame - pcall(function() yesButton:SetVerb("Exit") end) - - local noButton = createTextButton("No",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size24,UDim2.new(0,128,0,50),UDim2.new(0,90,0.8,0)) - noButton.Name = "NoButton" - noButton.Parent = frame - noButton.ZIndex = baseZIndex + 4 - noButton.MouseButton1Click:connect(function() - goToMenu(shield.Settings.SettingsStyle,"GameMainMenu","down") - shield.Settings:TweenSize(UDim2.new(0,525,0,430),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) - end) - - local leaveText = Instance.new("TextLabel") - leaveText.Name = "LeaveText" - leaveText.Text = "Are you sure you want to leave this game?" - leaveText.Size = UDim2.new(1,0,0.8,0) - leaveText.TextWrap = true - leaveText.TextColor3 = Color3.new(1,1,1) - leaveText.Font = Enum.Font.ArialBold - leaveText.FontSize = Enum.FontSize.Size36 - leaveText.BackgroundTransparency = 1 - leaveText.ZIndex = baseZIndex + 4 - leaveText.Parent = frame - - return frame -end - -local function createResetConfirmationMenu(baseZIndex,shield) - local frame = Instance.new("Frame") - frame.Name = "ResetConfirmationMenu" - frame.BackgroundTransparency = 1 - frame.Size = UDim2.new(1,0,1,0) - frame.Position = UDim2.new(0,0,2,400) - frame.ZIndex = baseZIndex + 4 - - local yesButton = createTextButton("Yes",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size24,UDim2.new(0,128,0,50),UDim2.new(0,313,0,299)) - yesButton.Name = "YesButton" - yesButton.ZIndex = baseZIndex + 4 - yesButton.Parent = frame - yesButton.MouseButton1Click:connect(function() - resumeGameFunction(shield) - resetLocalCharacter() - end) - - local noButton = createTextButton("No",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size24,UDim2.new(0,128,0,50),UDim2.new(0,90,0,299)) - noButton.Name = "NoButton" - noButton.Parent = frame - noButton.ZIndex = baseZIndex + 4 - noButton.MouseButton1Click:connect(function() - goToMenu(shield.Settings.SettingsStyle,"GameMainMenu","down") - shield.Settings:TweenSize(UDim2.new(0,525,0,430),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) - end) - - local resetCharacterText = Instance.new("TextLabel") - resetCharacterText.Name = "ResetCharacterText" - resetCharacterText.Text = "Are you sure you want to reset your character?" - resetCharacterText.Size = UDim2.new(1,0,0.8,0) - resetCharacterText.TextWrap = true - resetCharacterText.TextColor3 = Color3.new(1,1,1) - resetCharacterText.Font = Enum.Font.ArialBold - resetCharacterText.FontSize = Enum.FontSize.Size36 - resetCharacterText.BackgroundTransparency = 1 - resetCharacterText.ZIndex = baseZIndex + 4 - resetCharacterText.Parent = frame - - local fineResetCharacterText = resetCharacterText:Clone() - fineResetCharacterText.Name = "FineResetCharacterText" - fineResetCharacterText.Text = "You will be put back on a spawn point" - fineResetCharacterText.Size = UDim2.new(0,303,0,18) - fineResetCharacterText.Position = UDim2.new(0, 109, 0, 215) - fineResetCharacterText.FontSize = Enum.FontSize.Size18 - fineResetCharacterText.Parent = frame - - return frame -end - -local function createGameMainMenu(baseZIndex, shield) - local gameMainMenuFrame = Instance.new("Frame") - gameMainMenuFrame.Name = "GameMainMenu" - gameMainMenuFrame.BackgroundTransparency = 1 - gameMainMenuFrame.Size = UDim2.new(1,0,1,0) - gameMainMenuFrame.ZIndex = baseZIndex + 4 - gameMainMenuFrame.Parent = settingsFrame - - -- GameMainMenu Children - - local gameMainMenuTitle = Instance.new("TextLabel") - gameMainMenuTitle.Name = "Title" - gameMainMenuTitle.Text = "Game Menu" - gameMainMenuTitle.BackgroundTransparency = 1 - gameMainMenuTitle.Font = Enum.Font.ArialBold - gameMainMenuTitle.FontSize = Enum.FontSize.Size36 - gameMainMenuTitle.Size = UDim2.new(1,0,0,36) - gameMainMenuTitle.Position = UDim2.new(0,0,0,4) - gameMainMenuTitle.TextColor3 = Color3.new(1,1,1) - gameMainMenuTitle.ZIndex = baseZIndex + 4 - gameMainMenuTitle.Parent = gameMainMenuFrame - - local robloxHelpButton = createTextButton("Help",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size18,UDim2.new(0,164,0,50),UDim2.new(0,82,0,239)) - robloxHelpButton.Name = "HelpButton" - robloxHelpButton.ZIndex = baseZIndex + 4 - robloxHelpButton.Parent = gameMainMenuFrame - if useNewGui then - helpButton = robloxHelpButton - else - robloxHelpButton.Visible = false - end - - local helpDialog = createHelpDialog(baseZIndex) - helpDialog.Parent = gui - - helpButton.MouseButton1Click:connect( - function() - local centerDialogSuccess = pcall(function() game.GuiService:AddCenterDialog(helpDialog, Enum.CenterDialogType.ModalDialog, - --ShowFunction - function() - helpDialog.Visible = true - end, - --HideFunction - function() - helpDialog.Visible = false - end) - end) - if centerDialogSuccess == false then - helpDialog.Visible = true - end - end) - helpButton.Active = true - - local helpShortcut = Instance.new("TextLabel") - helpShortcut.Name = "HelpShortcutText" - helpShortcut.Text = "F1" - helpShortcut.Visible = false - helpShortcut.BackgroundTransparency = 1 - helpShortcut.Font = Enum.Font.Arial - helpShortcut.FontSize = Enum.FontSize.Size12 - helpShortcut.Position = UDim2.new(0,85,0,0) - helpShortcut.Size = UDim2.new(0,30,0,30) - helpShortcut.TextColor3 = Color3.new(0,1,0) - helpShortcut.ZIndex = baseZIndex + 4 - helpShortcut.Parent = robloxHelpButton - - local screenshotButton = createTextButton("Screenshot",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size18,UDim2.new(0,168,0,50),UDim2.new(0,254,0,239)) - screenshotButton.Name = "ScreenshotButton" - screenshotButton.ZIndex = baseZIndex + 4 - screenshotButton.Parent = gameMainMenuFrame - screenshotButton.Visible = not macClient - pcall(function() screenshotButton:SetVerb("Screenshot") end) - - local screenshotShortcut = helpShortcut:clone() - screenshotShortcut.Name = "ScreenshotShortcutText" - screenshotShortcut.Text = "PrintSc" - screenshotShortcut.Position = UDim2.new(0,118,0,0) - screenshotShortcut.Visible = true - screenshotShortcut.Parent = screenshotButton - - - local recordVideoButton = createTextButton("Record Video",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size18,UDim2.new(0,168,0,50),UDim2.new(0,254,0,290)) - recordVideoButton.Name = "RecordVideoButton" - recordVideoButton.ZIndex = baseZIndex + 4 - recordVideoButton.Parent = gameMainMenuFrame - recordVideoButton.Visible = not macClient - local supportVideoCapture = pcall(function() return UserSettings().GameSettings.VideoUploadPromptBehavior end) - if supportVideoCapture then - pcall(function() recordVideoButton:SetVerb("RecordToggle") end) - end - - local recordVideoShortcut = helpShortcut:clone() - recordVideoShortcut.Name = "RecordVideoShortcutText" - recordVideoShortcut.Text = "F12" - recordVideoShortcut.Position = UDim2.new(0,120,0,0) - recordVideoShortcut.Parent = recordVideoButton - - local stopRecordButton = Instance.new("ImageButton") - stopRecordButton.Name = "StopRecordButton" - stopRecordButton.BackgroundTransparency = 1 - stopRecordButton.Image = "rbxasset://textures/ui/RecordStop.png" - stopRecordButton.Size = UDim2.new(0,59,0,27) - if supportVideoCapture then - pcall(function() stopRecordButton:SetVerb("RecordToggle") end) - end - stopRecordButton.MouseButton1Click:connect(function() recordVideoClick(recordVideoButton, stopRecordButton) end) - stopRecordButton.Visible = false - stopRecordButton.Parent = gui - - local reportAbuseButton = createTextButton("Report Abuse",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size18,UDim2.new(0,164,0,50),UDim2.new(0,82,0,290)) - reportAbuseButton.Name = "ReportAbuseButton" - reportAbuseButton.ZIndex = baseZIndex + 4 - reportAbuseButton.Parent = gameMainMenuFrame - - local leaveGameButton = createTextButton("Leave Game",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size24,UDim2.new(0,340,0,50),UDim2.new(0,82,0,358)) - leaveGameButton.Name = "LeaveGameButton" - leaveGameButton.ZIndex = baseZIndex + 4 - leaveGameButton.Parent = gameMainMenuFrame - - local resumeGameButton = createTextButton("Resume Game",Enum.ButtonStyle.RobloxButtonDefault,Enum.FontSize.Size24,UDim2.new(0,340,0,50),UDim2.new(0,82,0,54)) - resumeGameButton.Name = "resumeGameButton" - resumeGameButton.ZIndex = baseZIndex + 4 - resumeGameButton.Parent = gameMainMenuFrame - resumeGameButton.MouseButton1Click:connect(function() resumeGameFunction(shield) end) - - local gameSettingsButton = createTextButton("Game Settings",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size24,UDim2.new(0,340,0,50),UDim2.new(0,82,0,172)) - gameSettingsButton.Name = "SettingsButton" - gameSettingsButton.ZIndex = baseZIndex + 4 - gameSettingsButton.Parent = gameMainMenuFrame - - local resetButton = createTextButton("Reset Character",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size24,UDim2.new(0,340,0,50),UDim2.new(0,82,0,105)) - resetButton.Name = "ResetButton" - resetButton.ZIndex = baseZIndex + 4 - resetButton.Parent = gameMainMenuFrame - - return gameMainMenuFrame -end - -local function createGameSettingsMenu(baseZIndex, shield) - local gameSettingsMenuFrame = Instance.new("Frame") - gameSettingsMenuFrame.Name = "GameSettingsMenu" - gameSettingsMenuFrame.BackgroundTransparency = 1 - gameSettingsMenuFrame.Size = UDim2.new(1,0,1,0) - gameSettingsMenuFrame.ZIndex = baseZIndex + 4 - - local title = Instance.new("TextLabel") - title.Name = "Title" - title.Text = "Settings" - title.Size = UDim2.new(1,0,0,48) - title.Position = UDim2.new(0,9,0,-9) - title.Font = Enum.Font.ArialBold - title.FontSize = Enum.FontSize.Size36 - title.TextColor3 = Color3.new(1,1,1) - title.ZIndex = baseZIndex + 4 - title.BackgroundTransparency = 1 - title.Parent = gameSettingsMenuFrame - - local fullscreenText = Instance.new("TextLabel") - fullscreenText.Name = "FullscreenText" - fullscreenText.Text = "Fullscreen Mode" - fullscreenText.Size = UDim2.new(0,124,0,18) - fullscreenText.Position = UDim2.new(0,62,0,145) - fullscreenText.Font = Enum.Font.Arial - fullscreenText.FontSize = Enum.FontSize.Size18 - fullscreenText.TextColor3 = Color3.new(1,1,1) - fullscreenText.ZIndex = baseZIndex + 4 - fullscreenText.BackgroundTransparency = 1 - fullscreenText.Parent = gameSettingsMenuFrame - - local fullscreenShortcut = Instance.new("TextLabel") - fullscreenShortcut.Visible = false - fullscreenShortcut.Name = "FullscreenShortcutText" - fullscreenShortcut.Text = "F11" - fullscreenShortcut.BackgroundTransparency = 1 - fullscreenShortcut.Font = Enum.Font.Arial - fullscreenShortcut.FontSize = Enum.FontSize.Size12 - fullscreenShortcut.Position = UDim2.new(0,186,0,141) - fullscreenShortcut.Size = UDim2.new(0,30,0,30) - fullscreenShortcut.TextColor3 = Color3.new(0,1,0) - fullscreenShortcut.ZIndex = baseZIndex + 4 - fullscreenShortcut.Parent = gameSettingsMenuFrame - - local studioText = Instance.new("TextLabel") - studioText.Name = "StudioText" - studioText.Text = "Studio Mode" - studioText.Size = UDim2.new(0,95,0,18) - studioText.Position = UDim2.new(0,62,0,179) - studioText.Font = Enum.Font.Arial - studioText.FontSize = Enum.FontSize.Size18 - studioText.TextColor3 = Color3.new(1,1,1) - studioText.ZIndex = baseZIndex + 4 - studioText.BackgroundTransparency = 1 - studioText.Parent = gameSettingsMenuFrame - - local studioShortcut = fullscreenShortcut:clone() - studioShortcut.Name = "StudioShortcutText" - studioShortcut.Text = "F2" - studioShortcut.Position = UDim2.new(0,154,0,175) - studioShortcut.Parent = gameSettingsMenuFrame - - if hasGraphicsSlider then - local qualityText = Instance.new("TextLabel") - qualityText.Name = "QualityText" - qualityText.Text = "Graphics Quality" - qualityText.Size = UDim2.new(0,128,0,18) - qualityText.Position = UDim2.new(0,31,0,226) - qualityText.Font = Enum.Font.Arial - qualityText.FontSize = Enum.FontSize.Size18 - qualityText.TextColor3 = Color3.new(1,1,1) - qualityText.ZIndex = baseZIndex + 4 - qualityText.BackgroundTransparency = 1 - qualityText.Parent = gameSettingsMenuFrame - - local graphicsSlider, graphicsLevel = RbxGui.CreateSlider(10,200,UDim2.new(0, 270, 0, 232)) - graphicsSlider.Parent = gameSettingsMenuFrame - graphicsSlider.Bar.ZIndex = baseZIndex + 4 - graphicsSlider.Bar.Slider.ZIndex = baseZIndex + 5 - end - - local fullscreenCheckbox = createTextButton("",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size18,UDim2.new(0,25,0,25),UDim2.new(0,30,0,144)) - fullscreenCheckbox.Name = "FullscreenCheckbox" - fullscreenCheckbox.ZIndex = baseZIndex + 4 - fullscreenCheckbox.Parent = gameSettingsMenuFrame - pcall(function() - if UserSettings().GameSettings:InFullScreen() then - fullscreenCheckbox.Text = "X" - end - end) - fullscreenCheckbox.MouseButton1Click:connect(function() - if fullscreenCheckbox.Text == "" then - fullscreenCheckbox.Text = "X" - else - fullscreenCheckbox.Text = "" - end - end) - pcall(function() fullscreenCheckbox:SetVerb("ToggleFullScreen") end) - - local studioCheckbox = createTextButton("",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size18,UDim2.new(0,25,0,25),UDim2.new(0,30,0,176)) - studioCheckbox.Name = "StudioCheckbox" - studioCheckbox.ZIndex = baseZIndex + 4 - studioCheckbox.Parent = gameSettingsMenuFrame - pcall(function() - if UserSettings().GameSettings:InStudioMode() then - studioCheckbox.Text = "X" - end - end) - studioCheckbox.MouseButton1Click:connect(function() - if not studioCheckbox.Active then return end - - if studioCheckbox.Text == "" then - studioCheckbox.Text = "X" - else - studioCheckbox.Text = "" - end - end) - pcall(function() studioCheckbox:SetVerb("TogglePlayMode") end) - - if game:FindFirstChild("NetworkClient") then -- we are playing online - setDisabledState(studioText) - setDisabledState(studioShortcut) - setDisabledState(studioCheckbox) - end - - local backButton = createTextButton("OK",Enum.ButtonStyle.RobloxButtonDefault,Enum.FontSize.Size24,UDim2.new(0,180,0,50),UDim2.new(0,170,0,270)) - backButton.Name = "BackButton" - backButton.ZIndex = baseZIndex + 4 - backButton.Parent = gameSettingsMenuFrame - - local syncVideoCaptureSetting = nil - - local supportVideoCapture = pcall(function() return UserSettings().GameSettings.VideoUploadPromptBehavior end) - if supportVideoCapture and not macClient then - local videoCaptureLabel = Instance.new("TextLabel") - videoCaptureLabel.Name = "VideoCaptureLabel" - videoCaptureLabel.Text = "After Capturing Video" - videoCaptureLabel.Font = Enum.Font.Arial - videoCaptureLabel.FontSize = Enum.FontSize.Size18 - videoCaptureLabel.Position = UDim2.new(0,32,0,100) - videoCaptureLabel.Size = UDim2.new(0,164,0,18) - videoCaptureLabel.BackgroundTransparency = 1 - videoCaptureLabel.TextColor3 = Color3I(255,255,255) - videoCaptureLabel.TextXAlignment = Enum.TextXAlignment.Left - videoCaptureLabel.ZIndex = baseZIndex + 4 - videoCaptureLabel.Parent = gameSettingsMenuFrame - - local videoNames = {} - local videoNameToItem = {} - videoNames[1] = "Just Save to Disk" - videoNameToItem[videoNames[1]] = Enum.UploadSetting["Never"] - videoNames[2] = "Upload to YouTube" - videoNameToItem[videoNames[2]] = Enum.UploadSetting["Ask me first"] - - local videoCaptureDropDown = nil - videoCaptureDropDown, updateVideoCaptureDropDownSelection = RbxGui.CreateDropDownMenu(videoNames, - function(text) - UserSettings().GameSettings.VideoUploadPromptBehavior = videoNameToItem[text] - end) - videoCaptureDropDown.Name = "VideoCaptureField" - videoCaptureDropDown.ZIndex = baseZIndex + 4 - videoCaptureDropDown.DropDownMenuButton.ZIndex = baseZIndex + 4 - videoCaptureDropDown.DropDownMenuButton.Icon.ZIndex = baseZIndex + 4 - videoCaptureDropDown.Position = UDim2.new(0, 270, 0, 94) - videoCaptureDropDown.Size = UDim2.new(0,200,0,32) - videoCaptureDropDown.Parent = gameSettingsMenuFrame - - syncVideoCaptureSetting = function() - if UserSettings().GameSettings.VideoUploadPromptBehavior == Enum.UploadSetting["Never"] then - updateVideoCaptureDropDownSelection(videoNames[1]) - elseif UserSettings().GameSettings.VideoUploadPromptBehavior == Enum.UploadSetting["Ask me first"] then - updateVideoCaptureDropDownSelection(videoNames[2]) - else - UserSettings().GameSettings.VideoUploadPromptBehavior = Enum.UploadSetting["Ask me first"] - updateVideoCaptureDropDownSelection(videoNames[2]) - end - end - end - - local cameraLabel = Instance.new("TextLabel") - cameraLabel.Name = "CameraLabel" - cameraLabel.Text = "Character & Camera Controls" - cameraLabel.Font = Enum.Font.Arial - cameraLabel.FontSize = Enum.FontSize.Size18 - cameraLabel.Position = UDim2.new(0,31,0,58) - cameraLabel.Size = UDim2.new(0,224,0,18) - cameraLabel.TextColor3 = Color3I(255,255,255) - cameraLabel.TextXAlignment = Enum.TextXAlignment.Left - cameraLabel.BackgroundTransparency = 1 - cameraLabel.ZIndex = baseZIndex + 4 - cameraLabel.Parent = gameSettingsMenuFrame - - local mouseLockLabel = game.CoreGui.RobloxGui:FindFirstChild("MouseLockLabel",true) - - local enumItems = Enum.ControlMode:GetEnumItems() - local enumNames = {} - local enumNameToItem = {} - for i,obj in ipairs(enumItems) do - enumNames[i] = obj.Name - enumNameToItem[obj.Name] = obj - end - - local cameraDropDown - cameraDropDown, updateCameraDropDownSelection = RbxGui.CreateDropDownMenu(enumNames, - function(text) - UserSettings().GameSettings.ControlMode = enumNameToItem[text] - - pcall(function() - if mouseLockLabel and UserSettings().GameSettings.ControlMode == Enum.ControlMode["Mouse Lock Switch"] then - mouseLockLabel.Visible = true - elseif mouseLockLabel then - mouseLockLabel.Visible = false - end - end) - end) - cameraDropDown.Name = "CameraField" - cameraDropDown.ZIndex = baseZIndex + 4 - cameraDropDown.DropDownMenuButton.ZIndex = baseZIndex + 4 - cameraDropDown.DropDownMenuButton.Icon.ZIndex = baseZIndex + 4 - cameraDropDown.Position = UDim2.new(0, 270, 0, 52) - cameraDropDown.Size = UDim2.new(0,200,0,32) - cameraDropDown.Parent = gameSettingsMenuFrame - - return gameSettingsMenuFrame -end - -if LoadLibrary then - RbxGui = LoadLibrary("RbxGui") - local baseZIndex = 0 -if UserSettings then - - local createOldSettingsDialog = function() - - waitForChild(gui,"BottomLeftControl") - settingsButton = gui.BottomLeftControl:FindFirstChild("SettingsButton") - - if settingsButton == nil then - settingsButton = Instance.new("ImageButton") - settingsButton.Name = "SettingsButton" - settingsButton.BackgroundTransparency = 1 - settingsButton.Active = false - settingsButton.Size = UDim2.new(0,54,0,46) - settingsButton.Position = UDim2.new(0,2,0,50) - settingsButton.Parent = gui.BottomLeftControl - - settingsButton.Image = "http://www.roblox.com/asset/?id=54608960" - settingsButton.Size = UDim2.new(0,33,0,33) - settingsButton.Position = UDim2.new(0, 128, 0.5, -17) - settingsButton.MouseEnter:connect(function() - settingsButton.Image = "http://www.roblox.com/asset/?id=54609004" - end) - settingsButton.MouseLeave:connect(function() - settingsButton.Image = "http://www.roblox.com/asset/?id=54608960" - end) - end - - local shield = Instance.new("TextButton") - shield.Text = "" - shield.Name = "UserSettingsShield" - shield.Active = true - shield.AutoButtonColor = false - shield.Visible = false - shield.Size = UDim2.new(1,0,1,0) - shield.BackgroundColor3 = Color3I(51,51,51) - shield.BorderColor3 = Color3I(27,42,53) - shield.BackgroundTransparency = 0.4 - shield.ZIndex = baseZIndex + 1 - - local frame = Instance.new("Frame") - frame.Name = "Settings" - frame.Position = UDim2.new(0.5, -262, 0.5, -150) - frame.Size = UDim2.new(0, 525, 0, 290) - frame.BackgroundTransparency = 1 - frame.Active = true - frame.Parent = shield - - local settingsFrame = Instance.new("Frame") - settingsFrame.Name = "SettingsStyle" - settingsFrame.Size = UDim2.new(1, 0, 1, 0) - settingsFrame.Style = Enum.FrameStyle.RobloxRound - settingsFrame.Active = true - settingsFrame.ZIndex = baseZIndex + 1 - settingsFrame.Parent = frame - - local title = Instance.new("TextLabel") - title.Name = "Title" - title.Text = "Settings" - title.TextColor3 = Color3I(221,221,221) - title.Position = UDim2.new(0.5, 0, 0, 30) - title.Font = Enum.Font.ArialBold - title.FontSize = Enum.FontSize.Size36 - title.ZIndex = baseZIndex + 1 - title.Parent = settingsFrame - - local cameraLabel = Instance.new("TextLabel") - cameraLabel.Name = "CameraLabel" - cameraLabel.Text = "Character & Camera Controls:" - cameraLabel.Font = Enum.Font.Arial - cameraLabel.FontSize = Enum.FontSize.Size18 - cameraLabel.Position = UDim2.new(0,20,0,105) - cameraLabel.TextColor3 = Color3I(255,255,255) - cameraLabel.TextXAlignment = Enum.TextXAlignment.Left - cameraLabel.ZIndex = baseZIndex + 1 - cameraLabel.Parent = settingsFrame - - local mouseLockLabel = game.CoreGui.RobloxGui:FindFirstChild("MouseLockLabel",true) - - local enumItems = Enum.ControlMode:GetEnumItems() - local enumNames = {} - local enumNameToItem = {} - for i,obj in ipairs(enumItems) do - enumNames[i] = obj.Name - enumNameToItem[obj.Name] = obj - end - - local cameraDropDown - local updateCameraDropDownSelection - cameraDropDown, updateCameraDropDownSelection = RbxGui.CreateDropDownMenu(enumNames, - function(text) - UserSettings().GameSettings.ControlMode = enumNameToItem[text] - - pcall(function() - if mouseLockLabel and UserSettings().GameSettings.ControlMode == Enum.ControlMode["Mouse Lock Switch"] then - mouseLockLabel.Visible = true - elseif mouseLockLabel then - mouseLockLabel.Visible = false - end - end) - end) - cameraDropDown.Name = "CameraField" - cameraDropDown.ZIndex = baseZIndex + 1 - cameraDropDown.Position = UDim2.new(0, 300, 0, 88) - cameraDropDown.Size = UDim2.new(0,200,0,32) - cameraDropDown.Parent = settingsFrame - - local syncVideoCaptureSetting = nil - - local supportVideoCapture = pcall(function() return UserSettings().GameSettings.VideoUploadPromptBehavior end) - if supportVideoCapture then - local videoCaptureLabel = Instance.new("TextLabel") - videoCaptureLabel.Name = "VideoCaptureLabel" - videoCaptureLabel.Text = "After Capturing Video:" - videoCaptureLabel.Font = Enum.Font.Arial - videoCaptureLabel.FontSize = Enum.FontSize.Size18 - videoCaptureLabel.Position = UDim2.new(0,20,0,145) - videoCaptureLabel.TextColor3 = Color3I(255,255,255) - videoCaptureLabel.TextXAlignment = Enum.TextXAlignment.Left - videoCaptureLabel.ZIndex = baseZIndex + 1 - videoCaptureLabel.Parent = settingsFrame - - local videoNames = {} - local videoNameToItem = {} - videoNames[1] = "Just Save to Disk" - videoNameToItem[videoNames[1]] = Enum.UploadSetting["Never"] - videoNames[2] = "Upload to YouTube" - videoNameToItem[videoNames[2]] = Enum.UploadSetting["Ask me first"] - - local videoCaptureDropDown, updateVideoCaptureDropDownSelection = RbxGui.CreateDropDownMenu(videoNames, - function(text) - UserSettings().GameSettings.VideoUploadPromptBehavior = videoNameToItem[text] - end) - videoCaptureDropDown.Name = "VideoCaptureField" - videoCaptureDropDown.ZIndex = baseZIndex + 1 - videoCaptureDropDown.Position = UDim2.new(0, 300, 0, 128) - videoCaptureDropDown.Size = UDim2.new(0,200,0,32) - videoCaptureDropDown.Parent = settingsFrame - - syncVideoCaptureSetting = function() - if gui:FindFirstChild("BottomRightControl") and gui.BottomRightControl:FindFirstChild("RecordToggle") then - videoCaptureLabel.Visible = true - videoCaptureDropDown.Visible = true - if UserSettings().GameSettings.VideoUploadPromptBehavior == Enum.UploadSetting["Never"] then - updateVideoCaptureDropDownSelection(videoNames[1]) - elseif UserSettings().GameSettings.VideoUploadPromptBehavior == Enum.UploadSetting["Ask me first"] then - updateVideoCaptureDropDownSelection(videoNames[2]) - else - UserSettings().GameSettings.VideoUploadPromptBehavior = Enum.UploadSetting["Ask me first"] - updateVideoCaptureDropDownSelection(videoNames[2]) - end - else - videoCaptureLabel.Visible = false - videoCaptureDropDown.Visible = false - end - end - end - - local exitButton = Instance.new("TextButton") - exitButton.Name = "ExitBtn" - exitButton.Font = Enum.Font.Arial - exitButton.FontSize = Enum.FontSize.Size18 - exitButton.Position = UDim2.new(0.5, -100, 0, 200) - exitButton.Size = UDim2.new(0,200,0,50) - exitButton.AutoButtonColor = true - exitButton.Style = Enum.ButtonStyle.RobloxButtonDefault - exitButton.Text = "OK" - exitButton.TextColor3 = Color3I(255,255,255) - exitButton.ZIndex = baseZIndex + 1 - - exitButton.Parent = settingsFrame - - robloxLock(shield) - - exitButton.MouseButton1Click:connect( - function() - shield.Visible = false - pcall(function() game.GuiService:RemoveCenterDialog(shield) end) - settingsButton.Active = true - end - ) - - settingsButton.MouseButton1Click:connect( - function() - local centerDialogSuccess = pcall(function() game.GuiService:AddCenterDialog(shield, Enum.CenterDialogType.ModalDialog, - --showFunction - function() - settingsButton.Active = false - updateCameraDropDownSelection(UserSettings().GameSettings.ControlMode.Name) - - if syncVideoCaptureSetting then - syncVideoCaptureSetting() - end - - shield.Visible = true - end, - --hideFunction - function() - shield.Visible = false - settingsButton.Active = true - end - ) - end) - - if centerDialogSuccess == false then - settingsButton.Active = false - updateCameraDropDownSelection(UserSettings().GameSettings.ControlMode.Name) - - if syncVideoCaptureSetting then - syncVideoCaptureSetting() - end - - shield.Visible = true - end - end - ) - print("Create old settings dialog return") - return shield - end - - local createSettingsDialog = function() - waitForChild(gui,"BottomLeftControl") - settingsButton = gui.BottomLeftControl:FindFirstChild("SettingsButton") - - if settingsButton == nil then - settingsButton = Instance.new("ImageButton") - settingsButton.Name = "SettingsButton" - settingsButton.Image = "rbxasset://textures/ui/SettingsButton.png" - settingsButton.BackgroundTransparency = 1 - settingsButton.Active = false - settingsButton.Size = UDim2.new(0,54,0,46) - settingsButton.Position = UDim2.new(0,2,0,50) - settingsButton.Parent = gui.BottomLeftControl - end - - - if not useNewGui then - settingsButton.Image = "http://www.roblox.com/asset/?id=54608960" - settingsButton.Size = UDim2.new(0,33,0,33) - settingsButton.Position = UDim2.new(0, 128, 0.5, -17) - settingsButton.MouseEnter:connect(function() - settingsButton.Image = "http://www.roblox.com/asset/?id=54609004" - end) - settingsButton.MouseLeave:connect(function() - settingsButton.Image = "http://www.roblox.com/asset/?id=54608960" - end) - end - - local shield = Instance.new("TextButton") - shield.Text = "" - shield.Name = "UserSettingsShield" - shield.Active = true - shield.AutoButtonColor = false - shield.Visible = false - shield.Size = UDim2.new(1,0,1,0) - shield.BackgroundColor3 = Color3I(51,51,51) - shield.BorderColor3 = Color3I(27,42,53) - shield.BackgroundTransparency = 0.4 - shield.ZIndex = baseZIndex + 2 - - local frame = Instance.new("Frame") - frame.Name = "Settings" - frame.Position = UDim2.new(0.5, -262, -0.5, -200) - frame.Size = UDim2.new(0, 525, 0, 430) - frame.BackgroundTransparency = 1 - frame.Active = true - frame.Parent = shield - - local settingsFrame = Instance.new("Frame") - settingsFrame.Name = "SettingsStyle" - settingsFrame.Size = UDim2.new(1, 0, 1, 0) - settingsFrame.Style = Enum.FrameStyle.RobloxRound - settingsFrame.Active = true - settingsFrame.ZIndex = baseZIndex + 3 - settingsFrame.Parent = frame - - local gameMainMenu = createGameMainMenu(baseZIndex, shield) - gameMainMenu.Parent = settingsFrame - - gameMainMenu.ScreenshotButton.MouseButton1Click:connect(function() - backToGame(gameMainMenu.ScreenshotButton, shield, settingsButton) - end) - - gameMainMenu.RecordVideoButton.MouseButton1Click:connect(function() - recordVideoClick(gameMainMenu.RecordVideoButton, gui.StopRecordButton) - backToGame(gameMainMenu.RecordVideoButton, shield, settingsButton) - end) - - if not useNewGui then - pcall(function() - gui.BottomRightControl.RecordToggle.MouseButton1Click:connect(function() - recordVideoClick(gameMainMenu.RecordVideoButton, gui.StopRecordButton) - end) - end) - end - - game.CoreGui.RobloxGui.Changed:connect(function(prop) -- We have stopped recording when we resize - if prop == "AbsoluteSize" and recordingVideo then - recordVideoClick(gameMainMenu.RecordVideoButton, gui.StopRecordButton) - end - end) - - gameMainMenu.ResetButton.Visible = game.Players.LocalPlayer - if game.Players.LocalPlayer ~= nil then - game.Players.LocalPlayer.Changed:connect(function() - gameMainMenu.ResetButton.Visible = game.Players.LocalPlayer - end) - else - delay(0,function() - waitForProperty(game.Players,"LocalPlayer") - gameMainMenu.ResetButton.Visible = game.Players.LocalPlayer - game.Players.LocalPlayer.Changed:connect(function() - gameMainMenu.ResetButton.Visible = game.Players.LocalPlayer - end) - end) - end - - gameMainMenu.ReportAbuseButton.Visible = game:FindFirstChild("NetworkClient") - if not gameMainMenu.ReportAbuseButton.Visible then - game.ChildAdded:connect(function(child) - if child:IsA("NetworkClient") then - gameMainMenu.ReportAbuseButton.Visible = game:FindFirstChild("NetworkClient") - end - end) - end - - gameMainMenu.ResetButton.MouseButton1Click:connect(function() - goToMenu(settingsFrame,"ResetConfirmationMenu","up") - settingsFrame.Parent:TweenSize(UDim2.new(0,525,0,370),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) - end) - - gameMainMenu.LeaveGameButton.MouseButton1Click:connect(function() - goToMenu(settingsFrame,"LeaveConfirmationMenu","down") - settingsFrame.Parent:TweenSize(UDim2.new(0,525,0,300),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) - end) - - local gameSettingsMenu = createGameSettingsMenu(baseZIndex, shield) - gameSettingsMenu.Visible = false - gameSettingsMenu.Parent = settingsFrame - - gameMainMenu.SettingsButton.MouseButton1Click:connect(function() - goToMenu(settingsFrame,"GameSettingsMenu","left") - settingsFrame.Parent:TweenSize(UDim2.new(0,525,0,350),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) - end) - - gameSettingsMenu.BackButton.MouseButton1Click:connect(function() - goToMenu(settingsFrame,"GameMainMenu","right") - settingsFrame.Parent:TweenSize(UDim2.new(0,525,0,430),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) - end) - - local resetConfirmationWindow = createResetConfirmationMenu(baseZIndex, shield) - resetConfirmationWindow.Visible = false - resetConfirmationWindow.Parent = settingsFrame - - local leaveConfirmationWindow = createLeaveConfirmationMenu(baseZIndex,shield) - leaveConfirmationWindow.Visible = false - leaveConfirmationWindow.Parent = settingsFrame - - robloxLock(shield) - - settingsButton.MouseButton1Click:connect( - function() - local centerDialogSuccess = pcall(function() game.GuiService:AddCenterDialog(shield, Enum.CenterDialogType.ModalDialog, - --showFunction - function() - settingsButton.Active = false - updateCameraDropDownSelection(UserSettings().GameSettings.ControlMode.Name) - - if syncVideoCaptureSetting then - syncVideoCaptureSetting() - end - - goToMenu(settingsFrame,"GameMainMenu","right") - shield.Visible = true - settingsFrame.Parent:TweenPosition(UDim2.new(0.5, -262,0.5, -200),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) - settingsFrame.Parent:TweenSize(UDim2.new(0,525,0,430),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) - end, - --hideFunction - function() - settingsFrame.Parent:TweenPosition(UDim2.new(0.5, -262,-0.5, -200),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) - settingsFrame.Parent:TweenSize(UDim2.new(0,525,0,430),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) - shield.Visible = false - settingsButton.Active = true - end - ) - end) - - if centerDialogSuccess == false then - settingsButton.Active = false - updateCameraDropDownSelection(UserSettings().GameSettings.ControlMode.Name) - - if syncVideoCaptureSetting then - syncVideoCaptureSetting() - end - - goToMenu(settingsFrame,"GameMainMenu","right") - settingsFrame.Parent:TweenSize(UDim2.new(0,525,0,430),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) - shield.Visible = true - end - end - ) - - return shield - end - - delay(0, function() - for i = 1, #newGuiPlaces do - if game.PlaceId == newGuiPlaces[i] then - useNewGui = true - break - end - end - if useNewGui then - createSettingsDialog().Parent = gui - - gui.BottomLeftControl.SettingsButton.Active = true - gui.BottomLeftControl.SettingsButton.Position = UDim2.new(0,2,0,-2) - - if mouseLockLabel and UserSettings().GameSettings.ControlMode == Enum.ControlMode["Mouse Lock Switch"] then - mouseLockLabel.Visible = true - elseif mouseLockLabel then - mouseLockLabel.Visible = false - end - - -- our script has loaded, get rid of older buttons now - local leaveGameButton = gui.BottomLeftControl:FindFirstChild("Exit") - if leaveGameButton then leaveGameButton:Remove() end - - local topLeft = gui:FindFirstChild("TopLeftControl") - if topLeft then topLeft:Remove() end - - local toggle = gui.BottomLeftControl:FindFirstChild("TogglePlayMode") - if toggle then toggle:Remove() end - - local bottomRightChildren = gui.BottomRightControl:GetChildren() - for i = 1, #bottomRightChildren do - if not string.find(bottomRightChildren[i].Name,"Camera") then - bottomRightChildren[i]:Remove() - end - end - else - if useOldDialog then - createOldSettingsDialog().Parent = gui - else - createSettingsDialog().Parent = gui - end - gui.BottomLeftControl.SettingsButton.Active = true - end - end) - -end --UserSettings call - -local createSaveDialogs = function() - local shield = Instance.new("TextButton") - shield.Text = "" - shield.AutoButtonColor = false - shield.Name = "SaveDialogShield" - shield.Active = true - shield.Visible = false - shield.Size = UDim2.new(1,0,1,0) - shield.BackgroundColor3 = Color3I(51,51,51) - shield.BorderColor3 = Color3I(27,42,53) - shield.BackgroundTransparency = 0.4 - shield.ZIndex = baseZIndex+1 - - local clearAndResetDialog - local save - local saveLocal - local dontSave - local cancel - - local messageBoxButtons = {} - messageBoxButtons[1] = {} - messageBoxButtons[1].Text = "Save" - messageBoxButtons[1].Function = function() save() end - messageBoxButtons[2] = {} - messageBoxButtons[2].Text = "Cancel" - messageBoxButtons[2].Function = function() cancel() end - messageBoxButtons[3] = {} - messageBoxButtons[3].Text = "Don't Save" - messageBoxButtons[3].Function = function() dontSave() end - - local saveDialogMessageBox = RbxGui.CreateStyledMessageDialog("Unsaved Changes", "Save your changes to ROBLOX before leaving?", "Confirm", messageBoxButtons) - saveDialogMessageBox.Visible = true - saveDialogMessageBox.Parent = shield - - - local errorBoxButtons = {} - - local buttonOffset = 1 - if game.LocalSaveEnabled then - errorBoxButtons[buttonOffset] = {} - errorBoxButtons[buttonOffset].Text = "Save to Disk" - errorBoxButtons[buttonOffset].Function = function() saveLocal() end - buttonOffset = buttonOffset + 1 - end - errorBoxButtons[buttonOffset] = {} - errorBoxButtons[buttonOffset].Text = "Keep Playing" - errorBoxButtons[buttonOffset].Function = function() cancel() end - errorBoxButtons[buttonOffset+1] = {} - errorBoxButtons[buttonOffset+1].Text = "Don't Save" - errorBoxButtons[buttonOffset+1].Function = function() dontSave() end - - local errorDialogMessageBox = RbxGui.CreateStyledMessageDialog("Upload Failed", "Sorry, we could not save your changes to ROBLOX.", "Error", errorBoxButtons) - errorDialogMessageBox.Visible = false - errorDialogMessageBox.Parent = shield - - local spinnerDialog = Instance.new("Frame") - spinnerDialog.Name = "SpinnerDialog" - spinnerDialog.Style = Enum.FrameStyle.RobloxRound - spinnerDialog.Size = UDim2.new(0, 350, 0, 150) - spinnerDialog.Position = UDim2.new(.5, -175, .5, -75) - spinnerDialog.Visible = false - spinnerDialog.Active = true - spinnerDialog.Parent = shield - - local waitingLabel = Instance.new("TextLabel") - waitingLabel.Name = "WaitingLabel" - waitingLabel.Text = "Saving to ROBLOX..." - waitingLabel.Font = Enum.Font.ArialBold - waitingLabel.FontSize = Enum.FontSize.Size18 - waitingLabel.Position = UDim2.new(0.5, 25, 0.5, 0) - waitingLabel.TextColor3 = Color3.new(1,1,1) - waitingLabel.Parent = spinnerDialog - - local spinnerFrame = Instance.new("Frame") - spinnerFrame.Name = "Spinner" - spinnerFrame.Size = UDim2.new(0, 80, 0, 80) - spinnerFrame.Position = UDim2.new(0.5, -150, 0.5, -40) - spinnerFrame.BackgroundTransparency = 1 - spinnerFrame.Parent = spinnerDialog - - local spinnerIcons = {} - local spinnerNum = 1 - while spinnerNum <= 8 do - local spinnerImage = Instance.new("ImageLabel") - spinnerImage.Name = "Spinner"..spinnerNum - spinnerImage.Size = UDim2.new(0, 16, 0, 16) - spinnerImage.Position = UDim2.new(.5+.3*math.cos(math.rad(45*spinnerNum)), -8, .5+.3*math.sin(math.rad(45*spinnerNum)), -8) - spinnerImage.BackgroundTransparency = 1 - spinnerImage.Image = "http://morblox.us/asset/?id=45880710" - spinnerImage.Parent = spinnerFrame - - spinnerIcons[spinnerNum] = spinnerImage - spinnerNum = spinnerNum + 1 - end - - save = function() - saveDialogMessageBox.Visible = false - - --Show the spinner dialog - spinnerDialog.Visible = true - local spin = true - --Make it spin - delay(0, function() - local spinPos = 0 - while spin do - local pos = 0 - - while pos < 8 do - if pos == spinPos or pos == ((spinPos+1)%8) then - spinnerIcons[pos+1].Image = "http://morblox.us/asset/?id=45880668" - else - spinnerIcons[pos+1].Image = "http://morblox.us/asset/?id=45880710" - end - - pos = pos + 1 - end - spinPos = (spinPos + 1) % 8 - wait(0.2) - end - end) - - --Do the save while the spinner is going, function will wait - local result = game:SaveToRoblox() - if not result then - --Try once more - result = game:SaveToRoblox() - end - - --Hide the spinner dialog - spinnerDialog.Visible = false - --And cause the delay thread to stop - spin = false - - --Now process the result - if result then - --Success, close - game:FinishShutdown(false) - clearAndResetDialog() - else - --Failure, show the second dialog prompt - errorDialogMessageBox.Visible = true - end - end - - saveLocal = function() - errorDialogMessageBox.Visible = false - game:FinishShutdown(true) - clearAndResetDialog() - end - - dontSave = function() - saveDialogMessageBox.Visible = false - errorDialogMessageBox.Visible = false - game:FinishShutdown(false) - clearAndResetDialog() - end - cancel = function() - saveDialogMessageBox.Visible = false - errorDialogMessageBox.Visible = false - clearAndResetDialog() - end - - clearAndResetDialog = function() - saveDialogMessageBox.Visible = true - errorDialogMessageBox.Visible = false - spinnerDialog.Visible = false - shield.Visible = false - pcall(function() game.GuiService:RemoveCenterDialog(shield) end) - end - - robloxLock(shield) - shield.Visible = false - return shield -end - -local createReportAbuseDialog = function() - --Only show things if we are a NetworkClient - waitForChild(game,"NetworkClient") - - waitForChild(game,"Players") - waitForProperty(game.Players, "LocalPlayer") - local localPlayer = game.Players.LocalPlayer - - local reportAbuseButton - if gui:FindFirstChild("BottomRightControl") and gui.BottomRightControl:FindFirstChild("ReportAbuse") then - reportAbuseButton = gui.BottomRightControl.ReportAbuse - - if not useOldDialog then - waitForChild(gui,"UserSettingsShield") - waitForChild(gui.UserSettingsShield, "Settings") - waitForChild(gui.UserSettingsShield.Settings,"SettingsStyle") - waitForChild(gui.UserSettingsShield.Settings.SettingsStyle,"GameMainMenu") - waitForChild(gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu, "ReportAbuseButton") - gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu.ReportAbuseButton.Visible = false - end - else - waitForChild(gui,"UserSettingsShield") - waitForChild(gui.UserSettingsShield, "Settings") - waitForChild(gui.UserSettingsShield.Settings,"SettingsStyle") - waitForChild(gui.UserSettingsShield.Settings.SettingsStyle,"GameMainMenu") - waitForChild(gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu, "ReportAbuseButton") - reportAbuseButton = gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu.ReportAbuseButton - end - - - local shield = Instance.new("TextButton") - shield.Name = "ReportAbuseShield" - shield.Text = "" - shield.AutoButtonColor = false - shield.Active = true - shield.Visible = false - shield.Size = UDim2.new(1,0,1,0) - shield.BackgroundColor3 = Color3I(51,51,51) - shield.BorderColor3 = Color3I(27,42,53) - shield.BackgroundTransparency = 0.4 - shield.ZIndex = baseZIndex + 1 - - local closeAndResetDialog - - local messageBoxButtons = {} - messageBoxButtons[1] = {} - messageBoxButtons[1].Text = "Ok" - messageBoxButtons[1].Function = function() closeAndResetDialog() end - local calmingMessageBox = RbxGui.CreateMessageDialog("Thanks for your report!", "Our moderators will review the chat logs and determine what happened. The other user is probably just trying to make you mad.\n\nIf anyone used swear words, inappropriate language, or threatened you in real life, please report them for Bad Words or Threats", messageBoxButtons) - calmingMessageBox.Visible = false - calmingMessageBox.Parent = shield - - local normalMessageBox = RbxGui.CreateMessageDialog("Thanks for your report!", "Our moderators will review the chat logs and determine what happened.", messageBoxButtons) - normalMessageBox.Visible = false - normalMessageBox.Parent = shield - - local frame = Instance.new("Frame") - frame.Name = "Settings" - frame.Position = UDim2.new(0.5, -250, 0.5, -200) - frame.Size = UDim2.new(0.0, 500, 0.0, 400) - frame.BackgroundTransparency = 1 - frame.Active = true - frame.Parent = shield - - local settingsFrame = Instance.new("Frame") - settingsFrame.Name = "ReportAbuseStyle" - settingsFrame.Size = UDim2.new(1, 0, 1, 0) - settingsFrame.Style = Enum.FrameStyle.RobloxRound - settingsFrame.Active = true - settingsFrame.ZIndex = baseZIndex + 1 - settingsFrame.Parent = frame - - local title = Instance.new("TextLabel") - title.Name = "Title" - title.Text = "Report Abuse" - title.TextColor3 = Color3I(221,221,221) - title.Position = UDim2.new(0.5, 0, 0, 30) - title.Font = Enum.Font.ArialBold - title.FontSize = Enum.FontSize.Size36 - title.ZIndex = baseZIndex + 2 - title.Parent = settingsFrame - - local description = Instance.new("TextLabel") - description.Name = "Description" - description.Text = "This will send a complete report to a moderator. The moderator will review the chat log and take appropriate action." - description.TextColor3 = Color3I(221,221,221) - description.Position = UDim2.new(0,20, 0, 55) - description.Size = UDim2.new(1, -40, 0, 40) - description.BackgroundTransparency = 1 - description.Font = Enum.Font.Arial - description.FontSize = Enum.FontSize.Size18 - description.TextWrap = true - description.ZIndex = baseZIndex + 2 - description.TextXAlignment = Enum.TextXAlignment.Left - description.TextYAlignment = Enum.TextYAlignment.Top - description.Parent = settingsFrame - - local playerLabel = Instance.new("TextLabel") - playerLabel.Name = "PlayerLabel" - playerLabel.Text = "Which player?" - playerLabel.BackgroundTransparency = 1 - playerLabel.Font = Enum.Font.Arial - playerLabel.FontSize = Enum.FontSize.Size18 - playerLabel.Position = UDim2.new(0.025,0,0,100) - playerLabel.Size = UDim2.new(0.4,0,0,36) - playerLabel.TextColor3 = Color3I(255,255,255) - playerLabel.TextXAlignment = Enum.TextXAlignment.Left - playerLabel.ZIndex = baseZIndex + 2 - playerLabel.Parent = settingsFrame - - local abusingPlayer = nil - local abuse = nil - local submitReportButton = nil - - local updatePlayerSelection = nil - local createPlayersDropDown = function() - local players = game:GetService("Players") - local playerNames = {} - local nameToPlayer = {} - local children = players:GetChildren() - local pos = 1 - if children then - for i, player in ipairs(children) do - if player:IsA("Player") and player ~= localPlayer then - playerNames[pos] = player.Name - nameToPlayer[player.Name] = player - pos = pos + 1 - end - end - end - local playerDropDown = nil - playerDropDown, updatePlayerSelection = RbxGui.CreateDropDownMenu(playerNames, - function(playerName) - abusingPlayer = nameToPlayer[playerName] - if abuse and abusingPlayer then - submitReportButton.Active = true - end - end) - playerDropDown.Name = "PlayersComboBox" - playerDropDown.ZIndex = baseZIndex + 2 - playerDropDown.Position = UDim2.new(.425, 0, 0, 102) - playerDropDown.Size = UDim2.new(.55,0,0,32) - - return playerDropDown - end - - local abuseLabel = Instance.new("TextLabel") - abuseLabel.Name = "AbuseLabel" - abuseLabel.Text = "What did they do?" - abuseLabel.Font = Enum.Font.Arial - abuseLabel.BackgroundTransparency = 1 - abuseLabel.FontSize = Enum.FontSize.Size18 - abuseLabel.Position = UDim2.new(0.025,0,0,140) - abuseLabel.Size = UDim2.new(0.4,0,0,36) - abuseLabel.TextColor3 = Color3I(255,255,255) - abuseLabel.TextXAlignment = Enum.TextXAlignment.Left - abuseLabel.ZIndex = baseZIndex + 2 - abuseLabel.Parent = settingsFrame - - local abuses = {"Bad Words or Threats","Bad Username","Talking about Dating","Account Trading or Sharing","Asking Personal Questions","Rude or Mean Behavior","False Reporting Me"} - local abuseDropDown, updateAbuseSelection = RbxGui.CreateDropDownMenu(abuses, - function(abuseText) - abuse = abuseText - if abuse and abusingPlayer then - submitReportButton.Active = true - end - end, true) - abuseDropDown.Name = "AbuseComboBox" - abuseDropDown.ZIndex = baseZIndex + 2 - abuseDropDown.Position = UDim2.new(0.425, 0, 0, 142) - abuseDropDown.Size = UDim2.new(0.55,0,0,32) - abuseDropDown.Parent = settingsFrame - - local shortDescriptionLabel = Instance.new("TextLabel") - shortDescriptionLabel.Name = "ShortDescriptionLabel" - shortDescriptionLabel.Text = "Short Description: (optional)" - shortDescriptionLabel.Font = Enum.Font.Arial - shortDescriptionLabel.FontSize = Enum.FontSize.Size18 - shortDescriptionLabel.Position = UDim2.new(0.025,0,0,180) - shortDescriptionLabel.Size = UDim2.new(0.95,0,0,36) - shortDescriptionLabel.TextColor3 = Color3I(255,255,255) - shortDescriptionLabel.TextXAlignment = Enum.TextXAlignment.Left - shortDescriptionLabel.BackgroundTransparency = 1 - shortDescriptionLabel.ZIndex = baseZIndex + 2 - shortDescriptionLabel.Parent = settingsFrame - - local shortDescriptionWrapper = Instance.new("Frame") - shortDescriptionWrapper.Name = "ShortDescriptionWrapper" - shortDescriptionWrapper.Position = UDim2.new(0.025,0,0,220) - shortDescriptionWrapper.Size = UDim2.new(0.95,0,1,-310) - shortDescriptionWrapper.BackgroundColor3 = Color3I(0,0,0) - shortDescriptionWrapper.BorderSizePixel = 0 - shortDescriptionWrapper.ZIndex = baseZIndex + 2 - shortDescriptionWrapper.Parent = settingsFrame - - local shortDescriptionBox = Instance.new("TextBox") - shortDescriptionBox.Name = "TextBox" - shortDescriptionBox.Text = "" - shortDescriptionBox.Font = Enum.Font.Arial - shortDescriptionBox.FontSize = Enum.FontSize.Size18 - shortDescriptionBox.Position = UDim2.new(0,3,0,3) - shortDescriptionBox.Size = UDim2.new(1,-6,1,-6) - shortDescriptionBox.TextColor3 = Color3I(255,255,255) - shortDescriptionBox.TextXAlignment = Enum.TextXAlignment.Left - shortDescriptionBox.TextYAlignment = Enum.TextYAlignment.Top - shortDescriptionBox.TextWrap = true - shortDescriptionBox.BackgroundColor3 = Color3I(0,0,0) - shortDescriptionBox.BorderSizePixel = 0 - shortDescriptionBox.ZIndex = baseZIndex + 2 - shortDescriptionBox.Parent = shortDescriptionWrapper - - submitReportButton = Instance.new("TextButton") - submitReportButton.Name = "SubmitReportBtn" - submitReportButton.Active = false - submitReportButton.Font = Enum.Font.Arial - submitReportButton.FontSize = Enum.FontSize.Size18 - submitReportButton.Position = UDim2.new(0.1, 0, 1, -80) - submitReportButton.Size = UDim2.new(0.35,0,0,50) - submitReportButton.AutoButtonColor = true - submitReportButton.Style = Enum.ButtonStyle.RobloxButtonDefault - submitReportButton.Text = "Submit Report" - submitReportButton.TextColor3 = Color3I(255,255,255) - submitReportButton.ZIndex = baseZIndex + 2 - submitReportButton.Parent = settingsFrame - - submitReportButton.MouseButton1Click:connect(function() - if submitReportButton.Active then - if abuse and abusingPlayer then - frame.Visible = false - game.Players:ReportAbuse(abusingPlayer, abuse, shortDescriptionBox.Text) - if abuse == "Rude or Mean Behavior" or abuse == "False Reporting Me" then - calmingMessageBox.Visible = true - else - normalMessageBox.Visible = true - end - else - closeAndResetDialog() - end - end - end) - - local cancelButton = Instance.new("TextButton") - cancelButton.Name = "CancelBtn" - cancelButton.Font = Enum.Font.Arial - cancelButton.FontSize = Enum.FontSize.Size18 - cancelButton.Position = UDim2.new(0.55, 0, 1, -80) - cancelButton.Size = UDim2.new(0.35,0,0,50) - cancelButton.AutoButtonColor = true - cancelButton.Style = Enum.ButtonStyle.RobloxButtonDefault - cancelButton.Text = "Cancel" - cancelButton.TextColor3 = Color3I(255,255,255) - cancelButton.ZIndex = baseZIndex + 2 - cancelButton.Parent = settingsFrame - - closeAndResetDialog = function() - --Delete old player combo box - local oldComboBox = settingsFrame:FindFirstChild("PlayersComboBox") - if oldComboBox then - oldComboBox.Parent = nil - end - - abusingPlayer = nil updatePlayerSelection(nil) - abuse = nil updateAbuseSelection(nil) - submitReportButton.Active = false - shortDescriptionBox.Text = "" - frame.Visible = true - calmingMessageBox.Visible = false - normalMessageBox.Visible = false - shield.Visible = false - reportAbuseButton.Active = true - pcall(function() game.GuiService:RemoveCenterDialog(shield) end) - end - - cancelButton.MouseButton1Click:connect(closeAndResetDialog) - - reportAbuseButton.MouseButton1Click:connect( - function() - createPlayersDropDown().Parent = settingsFrame - - local centerDialogSuccess = pcall(function() game.GuiService:AddCenterDialog(shield, Enum.CenterDialogType.ModalDialog, - --ShowFunction - function() - reportAbuseButton.Active = false - shield.Visible = true - end, - --HideFunction - function() - reportAbuseButton.Active = true - shield.Visible = false - end) - end) - if centerDialogSuccess == false then - reportAbuseButton.Active = false - shield.Visible = true - end - end - ) - - robloxLock(shield) - return shield -end - -local createChatBar = function() - --Only show a chat bar if we are a NetworkClient - waitForChild(game, "NetworkClient") - - waitForChild(game, "Players") - waitForProperty(game.Players, "LocalPlayer") - - local chatBar = Instance.new("Frame") - chatBar.Name = "ChatBar" - chatBar.Size = UDim2.new(1, 0, 0, 22) - chatBar.Position = UDim2.new(0, 0, 1, 0) - chatBar.BackgroundColor3 = Color3.new(0,0,0) - chatBar.BorderSizePixel = 0 - - local chatBox = Instance.new("TextBox") - chatBox.Text = "" - chatBox.Visible = false - chatBox.Size = UDim2.new(1,-4,1,0) - chatBox.Position = UDim2.new(0,2,0,0) - chatBox.TextXAlignment = Enum.TextXAlignment.Left - chatBox.Font = Enum.Font.Arial - chatBox.ClearTextOnFocus = false - chatBox.FontSize = Enum.FontSize.Size14 - chatBox.TextColor3 = Color3.new(1,1,1) - chatBox.BackgroundTransparency = 1 - chatBox.Parent = chatBar - - local chatButton = Instance.new("TextButton") - chatButton.Size = UDim2.new(1,-4,1,0) - chatButton.Position = UDim2.new(0,2,0,0) - chatButton.AutoButtonColor = false - chatButton.Text = "To chat click here or press \"/\" key" - chatButton.TextXAlignment = Enum.TextXAlignment.Left - chatButton.Font = Enum.Font.Arial - chatButton.FontSize = Enum.FontSize.Size14 - chatButton.TextColor3 = Color3.new(1,1,1) - chatButton.BackgroundTransparency = 1 - chatButton.Parent = chatBar - - local activateChat = function() - if chatBox.Visible then - return - end - chatButton.Visible = false - chatBox.Text = "" - chatBox.Visible = true - chatBox:CaptureFocus() - end - - chatButton.MouseButton1Click:connect(activateChat) - - local hotKeyEnabled = true - local toggleHotKey = function(value) - hotKeyEnabled = value - end - - local guiService = game:GetService("GuiService") - local newChatMode = pcall(function() - guiService:AddSpecialKey(Enum.SpecialKey.ChatHotkey) - guiService.SpecialKeyPressed:connect(function(key) if key == Enum.SpecialKey.ChatHotkey and hotKeyEnabled then activateChat() end end) - end) - if not newChatMode then - guiService:AddKey("/") - guiService.KeyPressed:connect(function(key) if key == "/" and hotKeyEnabled then activateChat() end end) - end - - chatBox.FocusLost:connect( - function(enterPressed) - if enterPressed then - if chatBox.Text ~= "" then - local str = chatBox.Text - if string.sub(str, 1, 1) == '%' then - game.Players:TeamChat(string.sub(str, 2)) - else - game.Players:Chat(str) - end - end - end - chatBox.Text = "" - chatBox.Visible = false - chatButton.Visible = true - end) - robloxLock(chatBar) - return chatBar, toggleHotKey -end - ---Spawn a thread for the help dialog -delay(0, - function() - local helpDialog = createHelpDialog(0) - helpDialog.Parent = gui - - helpButton.MouseButton1Click:connect( - function() - local centerDialogSuccess = pcall(function() game.GuiService:AddCenterDialog(helpDialog, Enum.CenterDialogType.ModalDialog, - --ShowFunction - function() - helpDialog.Visible = true - end, - --HideFunction - function() - helpDialog.Visible = false - end) - end) - if centerDialogSuccess == false then - helpDialog.Visible = true - end - end) - helpButton.Active = true - end) - ---Spawn a thread for the Save dialogs -local isSaveDialogSupported = pcall(function() local var = game.LocalSaveEnabled end) -if isSaveDialogSupported then - delay(0, - function() - local saveDialogs = createSaveDialogs() - saveDialogs.Parent = gui - - game.RequestShutdown = function() - local centerDialogSuccess = pcall(function() game.GuiService:AddCenterDialog(saveDialogs, Enum.CenterDialogType.QuitDialog, - --ShowFunction - function() - saveDialogs.Visible = true - end, - --HideFunction - function() - saveDialogs.Visible = false - end) - end) - - if centerDialogSuccess == false then - saveDialogs.Visible = true - end - return true - end - end) -end - ---Spawn a thread for the Report Abuse dialogs -print("about to create") -delay(0, - function() - createReportAbuseDialog().Parent = gui - print("parenting report abuse") - if gui:FindFirstChild("BottomRightControl") and gui.BottomRightControl:FindFirstChild("ReportAbuse") then - gui.BottomRightControl.ReportAbuse.Active = true - elseif useOldDialog then - gui.BottomRightControl.ReportAbuse.Active = true - print("old stuff") - else - waitForChild(gui,"UserSettingsShield") - waitForChild(gui.UserSettingsShield, "Settings") - waitForChild(gui.UserSettingsShield.Settings,"SettingsStyle") - waitForChild(gui.UserSettingsShield.Settings.SettingsStyle,"GameMainMenu") - waitForChild(gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu, "ReportAbuseButton") - gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu.ReportAbuseButton.Active = true - end - end) - ---Spawn a thread for Chat Bar -local isChatBarSupported, coreGuiVersion = pcall(function() return game.CoreGui.Version end) -- isChatBarSupported is for PC Lua chat, coreGuiVersion should be >=2 as well -local isMacChat, version = pcall(function() return game.GuiService.Version end) -if isMacChat and version >= 2 then - delay(0, - function() - waitForChild(game, "Players") - waitForProperty(game.Players, "LocalPlayer") - - local advancedChatBarSupported = pcall(function() return game.Players.LocalPlayer.ChatMode end) - local chatBar, toggleHotKey = createChatBar() - - if advancedChatBarSupported then - local function toggleChatBar(chatMode) - if chatMode == Enum.ChatMode.Menu then - chatBar.Parent = nil - game.GuiService:SetGlobalSizeOffsetPixel(0,0) - toggleHotKey(false) - elseif chatMode == Enum.ChatMode.TextAndMenu then - chatBar.Parent = gui - game.GuiService:SetGlobalSizeOffsetPixel(0,-22) - toggleHotKey(true) - end - end - game.Players.LocalPlayer.Changed:connect( - function(prop) - if prop == "ChatMode" then - toggleChatBar(game.Players.LocalPlayer.ChatMode) - end - end) - toggleChatBar(game.Players.LocalPlayer.ChatMode) - else - chatBar.Parent = gui - game.GuiService:SetGlobalSizeOffsetPixel(0,-22) - end - end) -end - - -local BurningManPlaceID = 41324860 --- TODO: remove click to walk completely if testing shows we don't need it --- Removes click to walk option from Burning Man -delay(0, - function() - waitForChild(game,"NetworkClient") - waitForChild(game,"Players") - waitForProperty(game.Players, "LocalPlayer") - waitForProperty(game.Players.LocalPlayer, "Character") - waitForChild(game.Players.LocalPlayer.Character, "Humanoid") - waitForProperty(game, "PlaceId") - pcall(function() - if game.PlaceId == BurningManPlaceID then - game.Players.LocalPlayer.Character.Humanoid:SetClickToWalkEnabled(false) - game.Players.LocalPlayer.CharacterAdded:connect(function(character) - waitForChild(character, "Humanoid") - character.Humanoid:SetClickToWalkEnabled(false) - end) - end - end) - end) - +%5% +local function waitForChild(instance, name) + while not instance:FindFirstChild(name) do + instance.ChildAdded:wait() + end +end + +local function waitForProperty(instance, property) + while not instance[property] do + instance.Changed:wait() + end +end + +-- A Few Script Globals +local gui +if script.Parent:FindFirstChild("ControlFrame") then + gui = script.Parent:FindFirstChild("ControlFrame") +else + gui = script.Parent +end + +local useOldDialog = true + +local helpButton = nil +local updateCameraDropDownSelection = nil +local updateVideoCaptureDropDownSelection = nil +local tweenTime = 0.2 + +local mouseLockLookScreenUrl = "http://morblox.us/asset/?id=54071825" +local classicLookScreenUrl = "http://morblox.us/asset/?id=45915798" + +local hasGraphicsSlider = false +local recordingVideo = false +local useNewGui = true + +local newGuiPlaces = {0,41324860} + +-- We should probably have a better method to determine this... +local macClient = false +local isMacChat, version = pcall(function() return game.GuiService.Version end) +macClient = isMacChat and version >= 2 + +local function Color3I(r,g,b) + return Color3.new(r/255,g/255,b/255) +end + +local function robloxLock(instance) + instance.RobloxLocked = true + children = instance:GetChildren() + if children then + for i, child in ipairs(children) do + robloxLock(child) + end + end +end + +function resumeGameFunction(shield) + shield.Settings:TweenPosition(UDim2.new(0.5, -262,-0.5, -200),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) + delay(tweenTime,function() + shield.Visible = false + pcall(function() game.GuiService:RemoveCenterDialog(shield) end) + settingsButton.Active = true + end) +end + +function goToMenu(container,menuName, moveDirection) + if type(menuName) ~= "string" then return end + local containerChildren = container:GetChildren() + for i = 1, #containerChildren do + if containerChildren[i].Name == menuName then + containerChildren[i].Visible = true + containerChildren[i]:TweenPosition(UDim2.new(0,0,0,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) + else + if moveDirection == "left" then + containerChildren[i]:TweenPosition(UDim2.new(-1,-525,0,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) + elseif moveDirection == "right" then + containerChildren[i]:TweenPosition(UDim2.new(1,525,0,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) + elseif moveDirection == "up" then + containerChildren[i]:TweenPosition(UDim2.new(0,0,-1,-400),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) + elseif moveDirection == "down" then + containerChildren[i]:TweenPosition(UDim2.new(0,0,1,400),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) + end + delay(tweenTime,function() + containerChildren[i].Visible = false + end) + end + end +end + +function resetLocalCharacter() + local player = game.Players.LocalPlayer + if player then + if player.Character and player.Character:FindFirstChild("Humanoid") then + player.Character.Humanoid.Health = 0 + end + end +end + +local function createTextButton(text,style,fontSize,buttonSize,buttonPosition) + local newTextButton = Instance.new("TextButton") + newTextButton.Font = Enum.Font.Arial + newTextButton.FontSize = fontSize + newTextButton.Size = buttonSize + newTextButton.Position = buttonPosition + newTextButton.Style = style + newTextButton.TextColor3 = Color3.new(1,1,1) + newTextButton.Text = text + return newTextButton +end + +local function CreateTextButtons(frame, buttons, yPos, ySize) + if #buttons < 1 then + error("Must have more than one button") + end + + local buttonNum = 1 + local buttonObjs = {} + + local function toggleSelection(button) + for i, obj in ipairs(buttonObjs) do + if obj == button then + obj.Style = Enum.ButtonStyle.RobloxButtonDefault + else + obj.Style = Enum.ButtonStyle.RobloxButton + end + end + end + + for i, obj in ipairs(buttons) do + local button = Instance.new("TextButton") + button.Name = "Button" .. buttonNum + button.Font = Enum.Font.Arial + button.FontSize = Enum.FontSize.Size18 + button.AutoButtonColor = true + button.Style = Enum.ButtonStyle.RobloxButton + button.Text = obj.Text + button.TextColor3 = Color3.new(1,1,1) + button.MouseButton1Click:connect(function() toggleSelection(button) obj.Function() end) + button.Parent = frame + buttonObjs[buttonNum] = button + + buttonNum = buttonNum + 1 + end + + toggleSelection(buttonObjs[1]) + + local numButtons = buttonNum-1 + + if numButtons == 1 then + frame.Button1.Position = UDim2.new(0.35, 0, yPos.Scale, yPos.Offset) + frame.Button1.Size = UDim2.new(.4,0,ySize.Scale, ySize.Offset) + elseif numButtons == 2 then + frame.Button1.Position = UDim2.new(0.1, 0, yPos.Scale, yPos.Offset) + frame.Button1.Size = UDim2.new(.35,0, ySize.Scale, ySize.Offset) + + frame.Button2.Position = UDim2.new(0.55, 0, yPos.Scale, yPos.Offset) + frame.Button2.Size = UDim2.new(.35,0, ySize.Scale, ySize.Offset) + elseif numButtons >= 3 then + local spacing = .1 / numButtons + local buttonSize = .9 / numButtons + + buttonNum = 1 + while buttonNum <= numButtons do + buttonObjs[buttonNum].Position = UDim2.new(spacing*buttonNum + (buttonNum-1) * buttonSize, 0, yPos.Scale, yPos.Offset) + buttonObjs[buttonNum].Size = UDim2.new(buttonSize, 0, ySize.Scale, ySize.Offset) + buttonNum = buttonNum + 1 + end + end +end + +function recordVideoClick(recordVideoButton, stopRecordButton) + recordingVideo = not recordingVideo + if recordingVideo then + stopRecordButton.Visible = true + recordVideoButton.Text = "Stop Recording" + else + stopRecordButton.Visible = false + recordVideoButton.Text = "Record Video" + end +end + +function backToGame(buttonClicked, shield, settingsButton) + buttonClicked.Parent.Parent.Parent.Parent.Visible = false + shield.Visible = false + pcall(function() game.GuiService:RemoveCenterDialog(shield) end) + settingsButton.Active = true +end + +function setDisabledState(guiObject) + if guiObject:IsA("TextLabel") then + guiObject.TextTransparency = 0.9 + elseif guiObject:IsA("TextButton") then + guiObject.TextTransparency = 0.9 + guiObject.Active = false + else + if guiObject["ClassName"] then + print("setDisabledState() got object of unsupported type. object type is ",guiObject.ClassName) + end + end +end + +function showEnabledState(guiObject) + if guiObject:IsA("TextLabel") then + guiObject.TextTransparency = 0 + elseif guiObject:IsA("TextButton") then + guiObject.TextTransparency = 0 + guiObject.Active = true + else + if guiObject["ClassName"] then + print("showEnabledState() got object of unsupported type. object type is ",guiObject.ClassName) + end + end +end + + +local function createHelpDialog(baseZIndex) + + if helpButton == nil then + if gui:FindFirstChild("TopLeftControl") and gui.TopLeftControl:FindFirstChild("Help") then + helpButton = gui.TopLeftControl.Help + elseif gui:FindFirstChild("BottomRightControl") and gui.BottomRightControl:FindFirstChild("Help") then + helpButton = gui.BottomRightControl.Help + end + end + + local shield = Instance.new("Frame") + shield.Name = "HelpDialogShield" + shield.Active = true + shield.Visible = false + shield.Size = UDim2.new(1,0,1,0) + shield.BackgroundColor3 = Color3I(51,51,51) + shield.BorderColor3 = Color3I(27,42,53) + shield.BackgroundTransparency = 0.4 + shield.ZIndex = baseZIndex + 1 + + local helpDialog = Instance.new("Frame") + helpDialog.Name = "HelpDialog" + helpDialog.Style = Enum.FrameStyle.RobloxRound + helpDialog.Position = UDim2.new(.2, 0, .2, 0) + helpDialog.Size = UDim2.new(0.6, 0, 0.6, 0) + helpDialog.Active = true + helpDialog.Parent = shield + + local titleLabel = Instance.new("TextLabel") + titleLabel.Name = "Title" + titleLabel.Text = "Keyboard & Mouse Controls" + titleLabel.Font = Enum.Font.ArialBold + titleLabel.FontSize = Enum.FontSize.Size36 + titleLabel.Position = UDim2.new(0, 0, 0.025, 0) + titleLabel.Size = UDim2.new(1, 0, 0, 40) + titleLabel.TextColor3 = Color3.new(1,1,1) + titleLabel.BackgroundTransparency = 1 + titleLabel.Parent = helpDialog + + local buttonRow = Instance.new("Frame") + buttonRow.Name = "Buttons" + buttonRow.Position = UDim2.new(0.1, 0, .07, 40) + buttonRow.Size = UDim2.new(0.8, 0, 0, 45) + buttonRow.BackgroundTransparency = 1 + buttonRow.Parent = helpDialog + + local imageFrame = Instance.new("Frame") + imageFrame.Name = "ImageFrame" + imageFrame.Position = UDim2.new(0.05, 0, 0.075, 80) + imageFrame.Size = UDim2.new(0.9, 0, .9, -120) + imageFrame.BackgroundTransparency = 1 + imageFrame.Parent = helpDialog + + local layoutFrame = Instance.new("Frame") + layoutFrame.Name = "LayoutFrame" + layoutFrame.Position = UDim2.new(0.5, 0, 0, 0) + layoutFrame.Size = UDim2.new(1.5, 0, 1, 0) + layoutFrame.BackgroundTransparency = 1 + layoutFrame.SizeConstraint = Enum.SizeConstraint.RelativeYY + layoutFrame.Parent = imageFrame + + local image = Instance.new("ImageLabel") + image.Name = "Image" + if UserSettings().GameSettings.ControlMode == Enum.ControlMode["Mouse Lock Switch"] then + image.Image = mouseLockLookScreenUrl + else + image.Image = classicLookScreenUrl + end + image.Position = UDim2.new(-0.5, 0, 0, 0) + image.Size = UDim2.new(1, 0, 1, 0) + image.BackgroundTransparency = 1 + image.Parent = layoutFrame + + local buttons = {} + buttons[1] = {} + buttons[1].Text = "Look" + buttons[1].Function = function() + if UserSettings().GameSettings.ControlMode == Enum.ControlMode["Mouse Lock Switch"] then + image.Image = mouseLockLookScreenUrl + else + image.Image = classicLookScreenUrl + end + end + buttons[2] = {} + buttons[2].Text = "Move" + buttons[2].Function = function() + image.Image = "http://morblox.us/asset/?id=45915811" + end + buttons[3] = {} + buttons[3].Text = "Gear" + buttons[3].Function = function() + image.Image = "http://morblox.us/asset/?id=45917596" + end + buttons[4] = {} + buttons[4].Text = "Zoom" + buttons[4].Function = function() + image.Image = "http://morblox.us/asset/?id=45915825" + end + + CreateTextButtons(buttonRow, buttons, UDim.new(0, 0), UDim.new(1,0)) + + + -- set up listeners for type of mouse mode, but keep constructing gui at same time + delay(0, function() + waitForChild(gui,"UserSettingsShield") + waitForChild(gui.UserSettingsShield,"Settings") + waitForChild(gui.UserSettingsShield.Settings,"SettingsStyle") + waitForChild(gui.UserSettingsShield.Settings.SettingsStyle, "GameSettingsMenu") + waitForChild(gui.UserSettingsShield.Settings.SettingsStyle.GameSettingsMenu, "CameraField") + waitForChild(gui.UserSettingsShield.Settings. SettingsStyle.GameSettingsMenu.CameraField, "DropDownMenuButton") + gui.UserSettingsShield.Settings.SettingsStyle.GameSettingsMenu.CameraField.DropDownMenuButton.Changed:connect(function(prop) + if prop ~= "Text" then return end + if buttonRow.Button1.Style == Enum.ButtonStyle.RobloxButtonDefault then -- only change if this is the currently selected panel + if gui.UserSettingsShield.Settings.SettingsStyle.GameSettingsMenu.CameraField.DropDownMenuButton.Text == "Classic" then + image.Image = classicLookScreenUrl + else + image.Image = mouseLockLookScreenUrl + end + end + end) + end) + + + local okBtn = Instance.new("TextButton") + okBtn.Name = "OkBtn" + okBtn.Text = "OK" + okBtn.Size = UDim2.new(0.3, 0, 0, 45) + okBtn.Position = UDim2.new(0.35, 0, .975, -50) + okBtn.Font = Enum.Font.Arial + okBtn.FontSize = Enum.FontSize.Size18 + okBtn.BackgroundTransparency = 1 + okBtn.TextColor3 = Color3.new(1,1,1) + okBtn.Style = Enum.ButtonStyle.RobloxButtonDefault + okBtn.MouseButton1Click:connect( + function() + shield.Visible = false + pcall(function() game.GuiService:RemoveCenterDialog(shield) end) + end) + okBtn.Parent = helpDialog + + robloxLock(shield) + return shield +end + +local function createLeaveConfirmationMenu(baseZIndex,shield) + local frame = Instance.new("Frame") + frame.Name = "LeaveConfirmationMenu" + frame.BackgroundTransparency = 1 + frame.Size = UDim2.new(1,0,1,0) + frame.Position = UDim2.new(0,0,2,400) + frame.ZIndex = baseZIndex + 4 + + local yesButton = createTextButton("Yes",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size24,UDim2.new(0,128,0,50),UDim2.new(0,313,0.8,0)) + yesButton.Name = "YesButton" + yesButton.ZIndex = baseZIndex + 4 + yesButton.Parent = frame + pcall(function() yesButton:SetVerb("Exit") end) + + local noButton = createTextButton("No",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size24,UDim2.new(0,128,0,50),UDim2.new(0,90,0.8,0)) + noButton.Name = "NoButton" + noButton.Parent = frame + noButton.ZIndex = baseZIndex + 4 + noButton.MouseButton1Click:connect(function() + goToMenu(shield.Settings.SettingsStyle,"GameMainMenu","down") + shield.Settings:TweenSize(UDim2.new(0,525,0,430),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) + end) + + local leaveText = Instance.new("TextLabel") + leaveText.Name = "LeaveText" + leaveText.Text = "Are you sure you want to leave this game?" + leaveText.Size = UDim2.new(1,0,0.8,0) + leaveText.TextWrap = true + leaveText.TextColor3 = Color3.new(1,1,1) + leaveText.Font = Enum.Font.ArialBold + leaveText.FontSize = Enum.FontSize.Size36 + leaveText.BackgroundTransparency = 1 + leaveText.ZIndex = baseZIndex + 4 + leaveText.Parent = frame + + return frame +end + +local function createResetConfirmationMenu(baseZIndex,shield) + local frame = Instance.new("Frame") + frame.Name = "ResetConfirmationMenu" + frame.BackgroundTransparency = 1 + frame.Size = UDim2.new(1,0,1,0) + frame.Position = UDim2.new(0,0,2,400) + frame.ZIndex = baseZIndex + 4 + + local yesButton = createTextButton("Yes",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size24,UDim2.new(0,128,0,50),UDim2.new(0,313,0,299)) + yesButton.Name = "YesButton" + yesButton.ZIndex = baseZIndex + 4 + yesButton.Parent = frame + yesButton.MouseButton1Click:connect(function() + resumeGameFunction(shield) + resetLocalCharacter() + end) + + local noButton = createTextButton("No",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size24,UDim2.new(0,128,0,50),UDim2.new(0,90,0,299)) + noButton.Name = "NoButton" + noButton.Parent = frame + noButton.ZIndex = baseZIndex + 4 + noButton.MouseButton1Click:connect(function() + goToMenu(shield.Settings.SettingsStyle,"GameMainMenu","down") + shield.Settings:TweenSize(UDim2.new(0,525,0,430),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) + end) + + local resetCharacterText = Instance.new("TextLabel") + resetCharacterText.Name = "ResetCharacterText" + resetCharacterText.Text = "Are you sure you want to reset your character?" + resetCharacterText.Size = UDim2.new(1,0,0.8,0) + resetCharacterText.TextWrap = true + resetCharacterText.TextColor3 = Color3.new(1,1,1) + resetCharacterText.Font = Enum.Font.ArialBold + resetCharacterText.FontSize = Enum.FontSize.Size36 + resetCharacterText.BackgroundTransparency = 1 + resetCharacterText.ZIndex = baseZIndex + 4 + resetCharacterText.Parent = frame + + local fineResetCharacterText = resetCharacterText:Clone() + fineResetCharacterText.Name = "FineResetCharacterText" + fineResetCharacterText.Text = "You will be put back on a spawn point" + fineResetCharacterText.Size = UDim2.new(0,303,0,18) + fineResetCharacterText.Position = UDim2.new(0, 109, 0, 215) + fineResetCharacterText.FontSize = Enum.FontSize.Size18 + fineResetCharacterText.Parent = frame + + return frame +end + +local function createGameMainMenu(baseZIndex, shield) + local gameMainMenuFrame = Instance.new("Frame") + gameMainMenuFrame.Name = "GameMainMenu" + gameMainMenuFrame.BackgroundTransparency = 1 + gameMainMenuFrame.Size = UDim2.new(1,0,1,0) + gameMainMenuFrame.ZIndex = baseZIndex + 4 + gameMainMenuFrame.Parent = settingsFrame + + -- GameMainMenu Children + + local gameMainMenuTitle = Instance.new("TextLabel") + gameMainMenuTitle.Name = "Title" + gameMainMenuTitle.Text = "Game Menu" + gameMainMenuTitle.BackgroundTransparency = 1 + gameMainMenuTitle.Font = Enum.Font.ArialBold + gameMainMenuTitle.FontSize = Enum.FontSize.Size36 + gameMainMenuTitle.Size = UDim2.new(1,0,0,36) + gameMainMenuTitle.Position = UDim2.new(0,0,0,4) + gameMainMenuTitle.TextColor3 = Color3.new(1,1,1) + gameMainMenuTitle.ZIndex = baseZIndex + 4 + gameMainMenuTitle.Parent = gameMainMenuFrame + + local robloxHelpButton = createTextButton("Help",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size18,UDim2.new(0,164,0,50),UDim2.new(0,82,0,239)) + robloxHelpButton.Name = "HelpButton" + robloxHelpButton.ZIndex = baseZIndex + 4 + robloxHelpButton.Parent = gameMainMenuFrame + if useNewGui then + helpButton = robloxHelpButton + else + robloxHelpButton.Visible = false + end + + local helpDialog = createHelpDialog(baseZIndex) + helpDialog.Parent = gui + + helpButton.MouseButton1Click:connect( + function() + local centerDialogSuccess = pcall(function() game.GuiService:AddCenterDialog(helpDialog, Enum.CenterDialogType.ModalDialog, + --ShowFunction + function() + helpDialog.Visible = true + end, + --HideFunction + function() + helpDialog.Visible = false + end) + end) + if centerDialogSuccess == false then + helpDialog.Visible = true + end + end) + helpButton.Active = true + + local helpShortcut = Instance.new("TextLabel") + helpShortcut.Name = "HelpShortcutText" + helpShortcut.Text = "F1" + helpShortcut.Visible = false + helpShortcut.BackgroundTransparency = 1 + helpShortcut.Font = Enum.Font.Arial + helpShortcut.FontSize = Enum.FontSize.Size12 + helpShortcut.Position = UDim2.new(0,85,0,0) + helpShortcut.Size = UDim2.new(0,30,0,30) + helpShortcut.TextColor3 = Color3.new(0,1,0) + helpShortcut.ZIndex = baseZIndex + 4 + helpShortcut.Parent = robloxHelpButton + + local screenshotButton = createTextButton("Screenshot",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size18,UDim2.new(0,168,0,50),UDim2.new(0,254,0,239)) + screenshotButton.Name = "ScreenshotButton" + screenshotButton.ZIndex = baseZIndex + 4 + screenshotButton.Parent = gameMainMenuFrame + screenshotButton.Visible = not macClient + pcall(function() screenshotButton:SetVerb("Screenshot") end) + + local screenshotShortcut = helpShortcut:clone() + screenshotShortcut.Name = "ScreenshotShortcutText" + screenshotShortcut.Text = "PrintSc" + screenshotShortcut.Position = UDim2.new(0,118,0,0) + screenshotShortcut.Visible = true + screenshotShortcut.Parent = screenshotButton + + + local recordVideoButton = createTextButton("Record Video",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size18,UDim2.new(0,168,0,50),UDim2.new(0,254,0,290)) + recordVideoButton.Name = "RecordVideoButton" + recordVideoButton.ZIndex = baseZIndex + 4 + recordVideoButton.Parent = gameMainMenuFrame + recordVideoButton.Visible = not macClient + local supportVideoCapture = pcall(function() return UserSettings().GameSettings.VideoUploadPromptBehavior end) + if supportVideoCapture then + pcall(function() recordVideoButton:SetVerb("RecordToggle") end) + end + + local recordVideoShortcut = helpShortcut:clone() + recordVideoShortcut.Name = "RecordVideoShortcutText" + recordVideoShortcut.Text = "F12" + recordVideoShortcut.Position = UDim2.new(0,120,0,0) + recordVideoShortcut.Parent = recordVideoButton + + local stopRecordButton = Instance.new("ImageButton") + stopRecordButton.Name = "StopRecordButton" + stopRecordButton.BackgroundTransparency = 1 + stopRecordButton.Image = "rbxasset://textures/ui/RecordStop.png" + stopRecordButton.Size = UDim2.new(0,59,0,27) + if supportVideoCapture then + pcall(function() stopRecordButton:SetVerb("RecordToggle") end) + end + stopRecordButton.MouseButton1Click:connect(function() recordVideoClick(recordVideoButton, stopRecordButton) end) + stopRecordButton.Visible = false + stopRecordButton.Parent = gui + + local reportAbuseButton = createTextButton("Report Abuse",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size18,UDim2.new(0,164,0,50),UDim2.new(0,82,0,290)) + reportAbuseButton.Name = "ReportAbuseButton" + reportAbuseButton.ZIndex = baseZIndex + 4 + reportAbuseButton.Parent = gameMainMenuFrame + + local leaveGameButton = createTextButton("Leave Game",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size24,UDim2.new(0,340,0,50),UDim2.new(0,82,0,358)) + leaveGameButton.Name = "LeaveGameButton" + leaveGameButton.ZIndex = baseZIndex + 4 + leaveGameButton.Parent = gameMainMenuFrame + + local resumeGameButton = createTextButton("Resume Game",Enum.ButtonStyle.RobloxButtonDefault,Enum.FontSize.Size24,UDim2.new(0,340,0,50),UDim2.new(0,82,0,54)) + resumeGameButton.Name = "resumeGameButton" + resumeGameButton.ZIndex = baseZIndex + 4 + resumeGameButton.Parent = gameMainMenuFrame + resumeGameButton.MouseButton1Click:connect(function() resumeGameFunction(shield) end) + + local gameSettingsButton = createTextButton("Game Settings",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size24,UDim2.new(0,340,0,50),UDim2.new(0,82,0,172)) + gameSettingsButton.Name = "SettingsButton" + gameSettingsButton.ZIndex = baseZIndex + 4 + gameSettingsButton.Parent = gameMainMenuFrame + + local resetButton = createTextButton("Reset Character",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size24,UDim2.new(0,340,0,50),UDim2.new(0,82,0,105)) + resetButton.Name = "ResetButton" + resetButton.ZIndex = baseZIndex + 4 + resetButton.Parent = gameMainMenuFrame + + return gameMainMenuFrame +end + +local function createGameSettingsMenu(baseZIndex, shield) + local gameSettingsMenuFrame = Instance.new("Frame") + gameSettingsMenuFrame.Name = "GameSettingsMenu" + gameSettingsMenuFrame.BackgroundTransparency = 1 + gameSettingsMenuFrame.Size = UDim2.new(1,0,1,0) + gameSettingsMenuFrame.ZIndex = baseZIndex + 4 + + local title = Instance.new("TextLabel") + title.Name = "Title" + title.Text = "Settings" + title.Size = UDim2.new(1,0,0,48) + title.Position = UDim2.new(0,9,0,-9) + title.Font = Enum.Font.ArialBold + title.FontSize = Enum.FontSize.Size36 + title.TextColor3 = Color3.new(1,1,1) + title.ZIndex = baseZIndex + 4 + title.BackgroundTransparency = 1 + title.Parent = gameSettingsMenuFrame + + local fullscreenText = Instance.new("TextLabel") + fullscreenText.Name = "FullscreenText" + fullscreenText.Text = "Fullscreen Mode" + fullscreenText.Size = UDim2.new(0,124,0,18) + fullscreenText.Position = UDim2.new(0,62,0,145) + fullscreenText.Font = Enum.Font.Arial + fullscreenText.FontSize = Enum.FontSize.Size18 + fullscreenText.TextColor3 = Color3.new(1,1,1) + fullscreenText.ZIndex = baseZIndex + 4 + fullscreenText.BackgroundTransparency = 1 + fullscreenText.Parent = gameSettingsMenuFrame + + local fullscreenShortcut = Instance.new("TextLabel") + fullscreenShortcut.Visible = false + fullscreenShortcut.Name = "FullscreenShortcutText" + fullscreenShortcut.Text = "F11" + fullscreenShortcut.BackgroundTransparency = 1 + fullscreenShortcut.Font = Enum.Font.Arial + fullscreenShortcut.FontSize = Enum.FontSize.Size12 + fullscreenShortcut.Position = UDim2.new(0,186,0,141) + fullscreenShortcut.Size = UDim2.new(0,30,0,30) + fullscreenShortcut.TextColor3 = Color3.new(0,1,0) + fullscreenShortcut.ZIndex = baseZIndex + 4 + fullscreenShortcut.Parent = gameSettingsMenuFrame + + local studioText = Instance.new("TextLabel") + studioText.Name = "StudioText" + studioText.Text = "Studio Mode" + studioText.Size = UDim2.new(0,95,0,18) + studioText.Position = UDim2.new(0,62,0,179) + studioText.Font = Enum.Font.Arial + studioText.FontSize = Enum.FontSize.Size18 + studioText.TextColor3 = Color3.new(1,1,1) + studioText.ZIndex = baseZIndex + 4 + studioText.BackgroundTransparency = 1 + studioText.Parent = gameSettingsMenuFrame + + local studioShortcut = fullscreenShortcut:clone() + studioShortcut.Name = "StudioShortcutText" + studioShortcut.Text = "F2" + studioShortcut.Position = UDim2.new(0,154,0,175) + studioShortcut.Parent = gameSettingsMenuFrame + + if hasGraphicsSlider then + local qualityText = Instance.new("TextLabel") + qualityText.Name = "QualityText" + qualityText.Text = "Graphics Quality" + qualityText.Size = UDim2.new(0,128,0,18) + qualityText.Position = UDim2.new(0,31,0,226) + qualityText.Font = Enum.Font.Arial + qualityText.FontSize = Enum.FontSize.Size18 + qualityText.TextColor3 = Color3.new(1,1,1) + qualityText.ZIndex = baseZIndex + 4 + qualityText.BackgroundTransparency = 1 + qualityText.Parent = gameSettingsMenuFrame + + local graphicsSlider, graphicsLevel = RbxGui.CreateSlider(10,200,UDim2.new(0, 270, 0, 232)) + graphicsSlider.Parent = gameSettingsMenuFrame + graphicsSlider.Bar.ZIndex = baseZIndex + 4 + graphicsSlider.Bar.Slider.ZIndex = baseZIndex + 5 + end + + local fullscreenCheckbox = createTextButton("",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size18,UDim2.new(0,25,0,25),UDim2.new(0,30,0,144)) + fullscreenCheckbox.Name = "FullscreenCheckbox" + fullscreenCheckbox.ZIndex = baseZIndex + 4 + fullscreenCheckbox.Parent = gameSettingsMenuFrame + pcall(function() + if UserSettings().GameSettings:InFullScreen() then + fullscreenCheckbox.Text = "X" + end + end) + fullscreenCheckbox.MouseButton1Click:connect(function() + if fullscreenCheckbox.Text == "" then + fullscreenCheckbox.Text = "X" + else + fullscreenCheckbox.Text = "" + end + end) + pcall(function() fullscreenCheckbox:SetVerb("ToggleFullScreen") end) + + local studioCheckbox = createTextButton("",Enum.ButtonStyle.RobloxButton,Enum.FontSize.Size18,UDim2.new(0,25,0,25),UDim2.new(0,30,0,176)) + studioCheckbox.Name = "StudioCheckbox" + studioCheckbox.ZIndex = baseZIndex + 4 + studioCheckbox.Parent = gameSettingsMenuFrame + pcall(function() + if UserSettings().GameSettings:InStudioMode() then + studioCheckbox.Text = "X" + end + end) + studioCheckbox.MouseButton1Click:connect(function() + if not studioCheckbox.Active then return end + + if studioCheckbox.Text == "" then + studioCheckbox.Text = "X" + else + studioCheckbox.Text = "" + end + end) + pcall(function() studioCheckbox:SetVerb("TogglePlayMode") end) + + if game:FindFirstChild("NetworkClient") then -- we are playing online + setDisabledState(studioText) + setDisabledState(studioShortcut) + setDisabledState(studioCheckbox) + end + + local backButton = createTextButton("OK",Enum.ButtonStyle.RobloxButtonDefault,Enum.FontSize.Size24,UDim2.new(0,180,0,50),UDim2.new(0,170,0,270)) + backButton.Name = "BackButton" + backButton.ZIndex = baseZIndex + 4 + backButton.Parent = gameSettingsMenuFrame + + local syncVideoCaptureSetting = nil + + local supportVideoCapture = pcall(function() return UserSettings().GameSettings.VideoUploadPromptBehavior end) + if supportVideoCapture and not macClient then + local videoCaptureLabel = Instance.new("TextLabel") + videoCaptureLabel.Name = "VideoCaptureLabel" + videoCaptureLabel.Text = "After Capturing Video" + videoCaptureLabel.Font = Enum.Font.Arial + videoCaptureLabel.FontSize = Enum.FontSize.Size18 + videoCaptureLabel.Position = UDim2.new(0,32,0,100) + videoCaptureLabel.Size = UDim2.new(0,164,0,18) + videoCaptureLabel.BackgroundTransparency = 1 + videoCaptureLabel.TextColor3 = Color3I(255,255,255) + videoCaptureLabel.TextXAlignment = Enum.TextXAlignment.Left + videoCaptureLabel.ZIndex = baseZIndex + 4 + videoCaptureLabel.Parent = gameSettingsMenuFrame + + local videoNames = {} + local videoNameToItem = {} + videoNames[1] = "Just Save to Disk" + videoNameToItem[videoNames[1]] = Enum.UploadSetting["Never"] + videoNames[2] = "Upload to YouTube" + videoNameToItem[videoNames[2]] = Enum.UploadSetting["Ask me first"] + + local videoCaptureDropDown = nil + videoCaptureDropDown, updateVideoCaptureDropDownSelection = RbxGui.CreateDropDownMenu(videoNames, + function(text) + UserSettings().GameSettings.VideoUploadPromptBehavior = videoNameToItem[text] + end) + videoCaptureDropDown.Name = "VideoCaptureField" + videoCaptureDropDown.ZIndex = baseZIndex + 4 + videoCaptureDropDown.DropDownMenuButton.ZIndex = baseZIndex + 4 + videoCaptureDropDown.DropDownMenuButton.Icon.ZIndex = baseZIndex + 4 + videoCaptureDropDown.Position = UDim2.new(0, 270, 0, 94) + videoCaptureDropDown.Size = UDim2.new(0,200,0,32) + videoCaptureDropDown.Parent = gameSettingsMenuFrame + + syncVideoCaptureSetting = function() + if UserSettings().GameSettings.VideoUploadPromptBehavior == Enum.UploadSetting["Never"] then + updateVideoCaptureDropDownSelection(videoNames[1]) + elseif UserSettings().GameSettings.VideoUploadPromptBehavior == Enum.UploadSetting["Ask me first"] then + updateVideoCaptureDropDownSelection(videoNames[2]) + else + UserSettings().GameSettings.VideoUploadPromptBehavior = Enum.UploadSetting["Ask me first"] + updateVideoCaptureDropDownSelection(videoNames[2]) + end + end + end + + local cameraLabel = Instance.new("TextLabel") + cameraLabel.Name = "CameraLabel" + cameraLabel.Text = "Character & Camera Controls" + cameraLabel.Font = Enum.Font.Arial + cameraLabel.FontSize = Enum.FontSize.Size18 + cameraLabel.Position = UDim2.new(0,31,0,58) + cameraLabel.Size = UDim2.new(0,224,0,18) + cameraLabel.TextColor3 = Color3I(255,255,255) + cameraLabel.TextXAlignment = Enum.TextXAlignment.Left + cameraLabel.BackgroundTransparency = 1 + cameraLabel.ZIndex = baseZIndex + 4 + cameraLabel.Parent = gameSettingsMenuFrame + + local mouseLockLabel = game.CoreGui.RobloxGui:FindFirstChild("MouseLockLabel",true) + + local enumItems = Enum.ControlMode:GetEnumItems() + local enumNames = {} + local enumNameToItem = {} + for i,obj in ipairs(enumItems) do + enumNames[i] = obj.Name + enumNameToItem[obj.Name] = obj + end + + local cameraDropDown + cameraDropDown, updateCameraDropDownSelection = RbxGui.CreateDropDownMenu(enumNames, + function(text) + UserSettings().GameSettings.ControlMode = enumNameToItem[text] + + pcall(function() + if mouseLockLabel and UserSettings().GameSettings.ControlMode == Enum.ControlMode["Mouse Lock Switch"] then + mouseLockLabel.Visible = true + elseif mouseLockLabel then + mouseLockLabel.Visible = false + end + end) + end) + cameraDropDown.Name = "CameraField" + cameraDropDown.ZIndex = baseZIndex + 4 + cameraDropDown.DropDownMenuButton.ZIndex = baseZIndex + 4 + cameraDropDown.DropDownMenuButton.Icon.ZIndex = baseZIndex + 4 + cameraDropDown.Position = UDim2.new(0, 270, 0, 52) + cameraDropDown.Size = UDim2.new(0,200,0,32) + cameraDropDown.Parent = gameSettingsMenuFrame + + return gameSettingsMenuFrame +end + +if LoadLibrary then + RbxGui = LoadLibrary("RbxGui") + local baseZIndex = 0 +if UserSettings then + + local createOldSettingsDialog = function() + + waitForChild(gui,"BottomLeftControl") + settingsButton = gui.BottomLeftControl:FindFirstChild("SettingsButton") + + if settingsButton == nil then + settingsButton = Instance.new("ImageButton") + settingsButton.Name = "SettingsButton" + settingsButton.BackgroundTransparency = 1 + settingsButton.Active = false + settingsButton.Size = UDim2.new(0,54,0,46) + settingsButton.Position = UDim2.new(0,2,0,50) + settingsButton.Parent = gui.BottomLeftControl + + settingsButton.Image = "http://www.roblox.com/asset/?id=54608960" + settingsButton.Size = UDim2.new(0,33,0,33) + settingsButton.Position = UDim2.new(0, 128, 0.5, -17) + settingsButton.MouseEnter:connect(function() + settingsButton.Image = "http://www.roblox.com/asset/?id=54609004" + end) + settingsButton.MouseLeave:connect(function() + settingsButton.Image = "http://www.roblox.com/asset/?id=54608960" + end) + end + + local shield = Instance.new("TextButton") + shield.Text = "" + shield.Name = "UserSettingsShield" + shield.Active = true + shield.AutoButtonColor = false + shield.Visible = false + shield.Size = UDim2.new(1,0,1,0) + shield.BackgroundColor3 = Color3I(51,51,51) + shield.BorderColor3 = Color3I(27,42,53) + shield.BackgroundTransparency = 0.4 + shield.ZIndex = baseZIndex + 1 + + local frame = Instance.new("Frame") + frame.Name = "Settings" + frame.Position = UDim2.new(0.5, -262, 0.5, -150) + frame.Size = UDim2.new(0, 525, 0, 290) + frame.BackgroundTransparency = 1 + frame.Active = true + frame.Parent = shield + + local settingsFrame = Instance.new("Frame") + settingsFrame.Name = "SettingsStyle" + settingsFrame.Size = UDim2.new(1, 0, 1, 0) + settingsFrame.Style = Enum.FrameStyle.RobloxRound + settingsFrame.Active = true + settingsFrame.ZIndex = baseZIndex + 1 + settingsFrame.Parent = frame + + local title = Instance.new("TextLabel") + title.Name = "Title" + title.Text = "Settings" + title.TextColor3 = Color3I(221,221,221) + title.Position = UDim2.new(0.5, 0, 0, 30) + title.Font = Enum.Font.ArialBold + title.FontSize = Enum.FontSize.Size36 + title.ZIndex = baseZIndex + 1 + title.Parent = settingsFrame + + local cameraLabel = Instance.new("TextLabel") + cameraLabel.Name = "CameraLabel" + cameraLabel.Text = "Character & Camera Controls:" + cameraLabel.Font = Enum.Font.Arial + cameraLabel.FontSize = Enum.FontSize.Size18 + cameraLabel.Position = UDim2.new(0,20,0,105) + cameraLabel.TextColor3 = Color3I(255,255,255) + cameraLabel.TextXAlignment = Enum.TextXAlignment.Left + cameraLabel.ZIndex = baseZIndex + 1 + cameraLabel.Parent = settingsFrame + + local mouseLockLabel = game.CoreGui.RobloxGui:FindFirstChild("MouseLockLabel",true) + + local enumItems = Enum.ControlMode:GetEnumItems() + local enumNames = {} + local enumNameToItem = {} + for i,obj in ipairs(enumItems) do + enumNames[i] = obj.Name + enumNameToItem[obj.Name] = obj + end + + local cameraDropDown + local updateCameraDropDownSelection + cameraDropDown, updateCameraDropDownSelection = RbxGui.CreateDropDownMenu(enumNames, + function(text) + UserSettings().GameSettings.ControlMode = enumNameToItem[text] + + pcall(function() + if mouseLockLabel and UserSettings().GameSettings.ControlMode == Enum.ControlMode["Mouse Lock Switch"] then + mouseLockLabel.Visible = true + elseif mouseLockLabel then + mouseLockLabel.Visible = false + end + end) + end) + cameraDropDown.Name = "CameraField" + cameraDropDown.ZIndex = baseZIndex + 1 + cameraDropDown.Position = UDim2.new(0, 300, 0, 88) + cameraDropDown.Size = UDim2.new(0,200,0,32) + cameraDropDown.Parent = settingsFrame + + local syncVideoCaptureSetting = nil + + local supportVideoCapture = pcall(function() return UserSettings().GameSettings.VideoUploadPromptBehavior end) + if supportVideoCapture then + local videoCaptureLabel = Instance.new("TextLabel") + videoCaptureLabel.Name = "VideoCaptureLabel" + videoCaptureLabel.Text = "After Capturing Video:" + videoCaptureLabel.Font = Enum.Font.Arial + videoCaptureLabel.FontSize = Enum.FontSize.Size18 + videoCaptureLabel.Position = UDim2.new(0,20,0,145) + videoCaptureLabel.TextColor3 = Color3I(255,255,255) + videoCaptureLabel.TextXAlignment = Enum.TextXAlignment.Left + videoCaptureLabel.ZIndex = baseZIndex + 1 + videoCaptureLabel.Parent = settingsFrame + + local videoNames = {} + local videoNameToItem = {} + videoNames[1] = "Just Save to Disk" + videoNameToItem[videoNames[1]] = Enum.UploadSetting["Never"] + videoNames[2] = "Upload to YouTube" + videoNameToItem[videoNames[2]] = Enum.UploadSetting["Ask me first"] + + local videoCaptureDropDown, updateVideoCaptureDropDownSelection = RbxGui.CreateDropDownMenu(videoNames, + function(text) + UserSettings().GameSettings.VideoUploadPromptBehavior = videoNameToItem[text] + end) + videoCaptureDropDown.Name = "VideoCaptureField" + videoCaptureDropDown.ZIndex = baseZIndex + 1 + videoCaptureDropDown.Position = UDim2.new(0, 300, 0, 128) + videoCaptureDropDown.Size = UDim2.new(0,200,0,32) + videoCaptureDropDown.Parent = settingsFrame + + syncVideoCaptureSetting = function() + if gui:FindFirstChild("BottomRightControl") and gui.BottomRightControl:FindFirstChild("RecordToggle") then + videoCaptureLabel.Visible = true + videoCaptureDropDown.Visible = true + if UserSettings().GameSettings.VideoUploadPromptBehavior == Enum.UploadSetting["Never"] then + updateVideoCaptureDropDownSelection(videoNames[1]) + elseif UserSettings().GameSettings.VideoUploadPromptBehavior == Enum.UploadSetting["Ask me first"] then + updateVideoCaptureDropDownSelection(videoNames[2]) + else + UserSettings().GameSettings.VideoUploadPromptBehavior = Enum.UploadSetting["Ask me first"] + updateVideoCaptureDropDownSelection(videoNames[2]) + end + else + videoCaptureLabel.Visible = false + videoCaptureDropDown.Visible = false + end + end + end + + local exitButton = Instance.new("TextButton") + exitButton.Name = "ExitBtn" + exitButton.Font = Enum.Font.Arial + exitButton.FontSize = Enum.FontSize.Size18 + exitButton.Position = UDim2.new(0.5, -100, 0, 200) + exitButton.Size = UDim2.new(0,200,0,50) + exitButton.AutoButtonColor = true + exitButton.Style = Enum.ButtonStyle.RobloxButtonDefault + exitButton.Text = "OK" + exitButton.TextColor3 = Color3I(255,255,255) + exitButton.ZIndex = baseZIndex + 1 + + exitButton.Parent = settingsFrame + + robloxLock(shield) + + exitButton.MouseButton1Click:connect( + function() + shield.Visible = false + pcall(function() game.GuiService:RemoveCenterDialog(shield) end) + settingsButton.Active = true + end + ) + + settingsButton.MouseButton1Click:connect( + function() + local centerDialogSuccess = pcall(function() game.GuiService:AddCenterDialog(shield, Enum.CenterDialogType.ModalDialog, + --showFunction + function() + settingsButton.Active = false + updateCameraDropDownSelection(UserSettings().GameSettings.ControlMode.Name) + + if syncVideoCaptureSetting then + syncVideoCaptureSetting() + end + + shield.Visible = true + end, + --hideFunction + function() + shield.Visible = false + settingsButton.Active = true + end + ) + end) + + if centerDialogSuccess == false then + settingsButton.Active = false + updateCameraDropDownSelection(UserSettings().GameSettings.ControlMode.Name) + + if syncVideoCaptureSetting then + syncVideoCaptureSetting() + end + + shield.Visible = true + end + end + ) + print("Create old settings dialog return") + return shield + end + + local createSettingsDialog = function() + waitForChild(gui,"BottomLeftControl") + settingsButton = gui.BottomLeftControl:FindFirstChild("SettingsButton") + + if settingsButton == nil then + settingsButton = Instance.new("ImageButton") + settingsButton.Name = "SettingsButton" + settingsButton.Image = "rbxasset://textures/ui/SettingsButton.png" + settingsButton.BackgroundTransparency = 1 + settingsButton.Active = false + settingsButton.Size = UDim2.new(0,54,0,46) + settingsButton.Position = UDim2.new(0,2,0,50) + settingsButton.Parent = gui.BottomLeftControl + end + + + if not useNewGui then + settingsButton.Image = "http://www.roblox.com/asset/?id=54608960" + settingsButton.Size = UDim2.new(0,33,0,33) + settingsButton.Position = UDim2.new(0, 128, 0.5, -17) + settingsButton.MouseEnter:connect(function() + settingsButton.Image = "http://www.roblox.com/asset/?id=54609004" + end) + settingsButton.MouseLeave:connect(function() + settingsButton.Image = "http://www.roblox.com/asset/?id=54608960" + end) + end + + local shield = Instance.new("TextButton") + shield.Text = "" + shield.Name = "UserSettingsShield" + shield.Active = true + shield.AutoButtonColor = false + shield.Visible = false + shield.Size = UDim2.new(1,0,1,0) + shield.BackgroundColor3 = Color3I(51,51,51) + shield.BorderColor3 = Color3I(27,42,53) + shield.BackgroundTransparency = 0.4 + shield.ZIndex = baseZIndex + 2 + + local frame = Instance.new("Frame") + frame.Name = "Settings" + frame.Position = UDim2.new(0.5, -262, -0.5, -200) + frame.Size = UDim2.new(0, 525, 0, 430) + frame.BackgroundTransparency = 1 + frame.Active = true + frame.Parent = shield + + local settingsFrame = Instance.new("Frame") + settingsFrame.Name = "SettingsStyle" + settingsFrame.Size = UDim2.new(1, 0, 1, 0) + settingsFrame.Style = Enum.FrameStyle.RobloxRound + settingsFrame.Active = true + settingsFrame.ZIndex = baseZIndex + 3 + settingsFrame.Parent = frame + + local gameMainMenu = createGameMainMenu(baseZIndex, shield) + gameMainMenu.Parent = settingsFrame + + gameMainMenu.ScreenshotButton.MouseButton1Click:connect(function() + backToGame(gameMainMenu.ScreenshotButton, shield, settingsButton) + end) + + gameMainMenu.RecordVideoButton.MouseButton1Click:connect(function() + recordVideoClick(gameMainMenu.RecordVideoButton, gui.StopRecordButton) + backToGame(gameMainMenu.RecordVideoButton, shield, settingsButton) + end) + + if not useNewGui then + pcall(function() + gui.BottomRightControl.RecordToggle.MouseButton1Click:connect(function() + recordVideoClick(gameMainMenu.RecordVideoButton, gui.StopRecordButton) + end) + end) + end + + game.CoreGui.RobloxGui.Changed:connect(function(prop) -- We have stopped recording when we resize + if prop == "AbsoluteSize" and recordingVideo then + recordVideoClick(gameMainMenu.RecordVideoButton, gui.StopRecordButton) + end + end) + + gameMainMenu.ResetButton.Visible = game.Players.LocalPlayer + if game.Players.LocalPlayer ~= nil then + game.Players.LocalPlayer.Changed:connect(function() + gameMainMenu.ResetButton.Visible = game.Players.LocalPlayer + end) + else + delay(0,function() + waitForProperty(game.Players,"LocalPlayer") + gameMainMenu.ResetButton.Visible = game.Players.LocalPlayer + game.Players.LocalPlayer.Changed:connect(function() + gameMainMenu.ResetButton.Visible = game.Players.LocalPlayer + end) + end) + end + + gameMainMenu.ReportAbuseButton.Visible = game:FindFirstChild("NetworkClient") + if not gameMainMenu.ReportAbuseButton.Visible then + game.ChildAdded:connect(function(child) + if child:IsA("NetworkClient") then + gameMainMenu.ReportAbuseButton.Visible = game:FindFirstChild("NetworkClient") + end + end) + end + + gameMainMenu.ResetButton.MouseButton1Click:connect(function() + goToMenu(settingsFrame,"ResetConfirmationMenu","up") + settingsFrame.Parent:TweenSize(UDim2.new(0,525,0,370),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) + end) + + gameMainMenu.LeaveGameButton.MouseButton1Click:connect(function() + goToMenu(settingsFrame,"LeaveConfirmationMenu","down") + settingsFrame.Parent:TweenSize(UDim2.new(0,525,0,300),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) + end) + + local gameSettingsMenu = createGameSettingsMenu(baseZIndex, shield) + gameSettingsMenu.Visible = false + gameSettingsMenu.Parent = settingsFrame + + gameMainMenu.SettingsButton.MouseButton1Click:connect(function() + goToMenu(settingsFrame,"GameSettingsMenu","left") + settingsFrame.Parent:TweenSize(UDim2.new(0,525,0,350),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) + end) + + gameSettingsMenu.BackButton.MouseButton1Click:connect(function() + goToMenu(settingsFrame,"GameMainMenu","right") + settingsFrame.Parent:TweenSize(UDim2.new(0,525,0,430),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) + end) + + local resetConfirmationWindow = createResetConfirmationMenu(baseZIndex, shield) + resetConfirmationWindow.Visible = false + resetConfirmationWindow.Parent = settingsFrame + + local leaveConfirmationWindow = createLeaveConfirmationMenu(baseZIndex,shield) + leaveConfirmationWindow.Visible = false + leaveConfirmationWindow.Parent = settingsFrame + + robloxLock(shield) + + settingsButton.MouseButton1Click:connect( + function() + local centerDialogSuccess = pcall(function() game.GuiService:AddCenterDialog(shield, Enum.CenterDialogType.ModalDialog, + --showFunction + function() + settingsButton.Active = false + updateCameraDropDownSelection(UserSettings().GameSettings.ControlMode.Name) + + if syncVideoCaptureSetting then + syncVideoCaptureSetting() + end + + goToMenu(settingsFrame,"GameMainMenu","right") + shield.Visible = true + settingsFrame.Parent:TweenPosition(UDim2.new(0.5, -262,0.5, -200),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) + settingsFrame.Parent:TweenSize(UDim2.new(0,525,0,430),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) + end, + --hideFunction + function() + settingsFrame.Parent:TweenPosition(UDim2.new(0.5, -262,-0.5, -200),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) + settingsFrame.Parent:TweenSize(UDim2.new(0,525,0,430),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) + shield.Visible = false + settingsButton.Active = true + end + ) + end) + + if centerDialogSuccess == false then + settingsButton.Active = false + updateCameraDropDownSelection(UserSettings().GameSettings.ControlMode.Name) + + if syncVideoCaptureSetting then + syncVideoCaptureSetting() + end + + goToMenu(settingsFrame,"GameMainMenu","right") + settingsFrame.Parent:TweenSize(UDim2.new(0,525,0,430),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,tweenTime,true) + shield.Visible = true + end + end + ) + + return shield + end + + delay(0, function() + for i = 1, #newGuiPlaces do + if game.PlaceId == newGuiPlaces[i] then + useNewGui = true + break + end + end + if useNewGui then + createSettingsDialog().Parent = gui + + gui.BottomLeftControl.SettingsButton.Active = true + gui.BottomLeftControl.SettingsButton.Position = UDim2.new(0,2,0,-2) + + if mouseLockLabel and UserSettings().GameSettings.ControlMode == Enum.ControlMode["Mouse Lock Switch"] then + mouseLockLabel.Visible = true + elseif mouseLockLabel then + mouseLockLabel.Visible = false + end + + -- our script has loaded, get rid of older buttons now + local leaveGameButton = gui.BottomLeftControl:FindFirstChild("Exit") + if leaveGameButton then leaveGameButton:Remove() end + + local topLeft = gui:FindFirstChild("TopLeftControl") + if topLeft then topLeft:Remove() end + + local toggle = gui.BottomLeftControl:FindFirstChild("TogglePlayMode") + if toggle then toggle:Remove() end + + local bottomRightChildren = gui.BottomRightControl:GetChildren() + for i = 1, #bottomRightChildren do + if not string.find(bottomRightChildren[i].Name,"Camera") then + bottomRightChildren[i]:Remove() + end + end + else + if useOldDialog then + createOldSettingsDialog().Parent = gui + else + createSettingsDialog().Parent = gui + end + gui.BottomLeftControl.SettingsButton.Active = true + end + end) + +end --UserSettings call + +local createSaveDialogs = function() + local shield = Instance.new("TextButton") + shield.Text = "" + shield.AutoButtonColor = false + shield.Name = "SaveDialogShield" + shield.Active = true + shield.Visible = false + shield.Size = UDim2.new(1,0,1,0) + shield.BackgroundColor3 = Color3I(51,51,51) + shield.BorderColor3 = Color3I(27,42,53) + shield.BackgroundTransparency = 0.4 + shield.ZIndex = baseZIndex+1 + + local clearAndResetDialog + local save + local saveLocal + local dontSave + local cancel + + local messageBoxButtons = {} + messageBoxButtons[1] = {} + messageBoxButtons[1].Text = "Save" + messageBoxButtons[1].Function = function() save() end + messageBoxButtons[2] = {} + messageBoxButtons[2].Text = "Cancel" + messageBoxButtons[2].Function = function() cancel() end + messageBoxButtons[3] = {} + messageBoxButtons[3].Text = "Don't Save" + messageBoxButtons[3].Function = function() dontSave() end + + local saveDialogMessageBox = RbxGui.CreateStyledMessageDialog("Unsaved Changes", "Save your changes to ROBLOX before leaving?", "Confirm", messageBoxButtons) + saveDialogMessageBox.Visible = true + saveDialogMessageBox.Parent = shield + + + local errorBoxButtons = {} + + local buttonOffset = 1 + if game.LocalSaveEnabled then + errorBoxButtons[buttonOffset] = {} + errorBoxButtons[buttonOffset].Text = "Save to Disk" + errorBoxButtons[buttonOffset].Function = function() saveLocal() end + buttonOffset = buttonOffset + 1 + end + errorBoxButtons[buttonOffset] = {} + errorBoxButtons[buttonOffset].Text = "Keep Playing" + errorBoxButtons[buttonOffset].Function = function() cancel() end + errorBoxButtons[buttonOffset+1] = {} + errorBoxButtons[buttonOffset+1].Text = "Don't Save" + errorBoxButtons[buttonOffset+1].Function = function() dontSave() end + + local errorDialogMessageBox = RbxGui.CreateStyledMessageDialog("Upload Failed", "Sorry, we could not save your changes to ROBLOX.", "Error", errorBoxButtons) + errorDialogMessageBox.Visible = false + errorDialogMessageBox.Parent = shield + + local spinnerDialog = Instance.new("Frame") + spinnerDialog.Name = "SpinnerDialog" + spinnerDialog.Style = Enum.FrameStyle.RobloxRound + spinnerDialog.Size = UDim2.new(0, 350, 0, 150) + spinnerDialog.Position = UDim2.new(.5, -175, .5, -75) + spinnerDialog.Visible = false + spinnerDialog.Active = true + spinnerDialog.Parent = shield + + local waitingLabel = Instance.new("TextLabel") + waitingLabel.Name = "WaitingLabel" + waitingLabel.Text = "Saving to ROBLOX..." + waitingLabel.Font = Enum.Font.ArialBold + waitingLabel.FontSize = Enum.FontSize.Size18 + waitingLabel.Position = UDim2.new(0.5, 25, 0.5, 0) + waitingLabel.TextColor3 = Color3.new(1,1,1) + waitingLabel.Parent = spinnerDialog + + local spinnerFrame = Instance.new("Frame") + spinnerFrame.Name = "Spinner" + spinnerFrame.Size = UDim2.new(0, 80, 0, 80) + spinnerFrame.Position = UDim2.new(0.5, -150, 0.5, -40) + spinnerFrame.BackgroundTransparency = 1 + spinnerFrame.Parent = spinnerDialog + + local spinnerIcons = {} + local spinnerNum = 1 + while spinnerNum <= 8 do + local spinnerImage = Instance.new("ImageLabel") + spinnerImage.Name = "Spinner"..spinnerNum + spinnerImage.Size = UDim2.new(0, 16, 0, 16) + spinnerImage.Position = UDim2.new(.5+.3*math.cos(math.rad(45*spinnerNum)), -8, .5+.3*math.sin(math.rad(45*spinnerNum)), -8) + spinnerImage.BackgroundTransparency = 1 + spinnerImage.Image = "http://morblox.us/asset/?id=45880710" + spinnerImage.Parent = spinnerFrame + + spinnerIcons[spinnerNum] = spinnerImage + spinnerNum = spinnerNum + 1 + end + + save = function() + saveDialogMessageBox.Visible = false + + --Show the spinner dialog + spinnerDialog.Visible = true + local spin = true + --Make it spin + delay(0, function() + local spinPos = 0 + while spin do + local pos = 0 + + while pos < 8 do + if pos == spinPos or pos == ((spinPos+1)%8) then + spinnerIcons[pos+1].Image = "http://morblox.us/asset/?id=45880668" + else + spinnerIcons[pos+1].Image = "http://morblox.us/asset/?id=45880710" + end + + pos = pos + 1 + end + spinPos = (spinPos + 1) % 8 + wait(0.2) + end + end) + + --Do the save while the spinner is going, function will wait + local result = game:SaveToRoblox() + if not result then + --Try once more + result = game:SaveToRoblox() + end + + --Hide the spinner dialog + spinnerDialog.Visible = false + --And cause the delay thread to stop + spin = false + + --Now process the result + if result then + --Success, close + game:FinishShutdown(false) + clearAndResetDialog() + else + --Failure, show the second dialog prompt + errorDialogMessageBox.Visible = true + end + end + + saveLocal = function() + errorDialogMessageBox.Visible = false + game:FinishShutdown(true) + clearAndResetDialog() + end + + dontSave = function() + saveDialogMessageBox.Visible = false + errorDialogMessageBox.Visible = false + game:FinishShutdown(false) + clearAndResetDialog() + end + cancel = function() + saveDialogMessageBox.Visible = false + errorDialogMessageBox.Visible = false + clearAndResetDialog() + end + + clearAndResetDialog = function() + saveDialogMessageBox.Visible = true + errorDialogMessageBox.Visible = false + spinnerDialog.Visible = false + shield.Visible = false + pcall(function() game.GuiService:RemoveCenterDialog(shield) end) + end + + robloxLock(shield) + shield.Visible = false + return shield +end + +local createReportAbuseDialog = function() + --Only show things if we are a NetworkClient + waitForChild(game,"NetworkClient") + + waitForChild(game,"Players") + waitForProperty(game.Players, "LocalPlayer") + local localPlayer = game.Players.LocalPlayer + + local reportAbuseButton + if gui:FindFirstChild("BottomRightControl") and gui.BottomRightControl:FindFirstChild("ReportAbuse") then + reportAbuseButton = gui.BottomRightControl.ReportAbuse + + if not useOldDialog then + waitForChild(gui,"UserSettingsShield") + waitForChild(gui.UserSettingsShield, "Settings") + waitForChild(gui.UserSettingsShield.Settings,"SettingsStyle") + waitForChild(gui.UserSettingsShield.Settings.SettingsStyle,"GameMainMenu") + waitForChild(gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu, "ReportAbuseButton") + gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu.ReportAbuseButton.Visible = false + end + else + waitForChild(gui,"UserSettingsShield") + waitForChild(gui.UserSettingsShield, "Settings") + waitForChild(gui.UserSettingsShield.Settings,"SettingsStyle") + waitForChild(gui.UserSettingsShield.Settings.SettingsStyle,"GameMainMenu") + waitForChild(gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu, "ReportAbuseButton") + reportAbuseButton = gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu.ReportAbuseButton + end + + + local shield = Instance.new("TextButton") + shield.Name = "ReportAbuseShield" + shield.Text = "" + shield.AutoButtonColor = false + shield.Active = true + shield.Visible = false + shield.Size = UDim2.new(1,0,1,0) + shield.BackgroundColor3 = Color3I(51,51,51) + shield.BorderColor3 = Color3I(27,42,53) + shield.BackgroundTransparency = 0.4 + shield.ZIndex = baseZIndex + 1 + + local closeAndResetDialog + + local messageBoxButtons = {} + messageBoxButtons[1] = {} + messageBoxButtons[1].Text = "Ok" + messageBoxButtons[1].Function = function() closeAndResetDialog() end + local calmingMessageBox = RbxGui.CreateMessageDialog("Thanks for your report!", "Our moderators will review the chat logs and determine what happened. The other user is probably just trying to make you mad.\n\nIf anyone used swear words, inappropriate language, or threatened you in real life, please report them for Bad Words or Threats", messageBoxButtons) + calmingMessageBox.Visible = false + calmingMessageBox.Parent = shield + + local normalMessageBox = RbxGui.CreateMessageDialog("Thanks for your report!", "Our moderators will review the chat logs and determine what happened.", messageBoxButtons) + normalMessageBox.Visible = false + normalMessageBox.Parent = shield + + local frame = Instance.new("Frame") + frame.Name = "Settings" + frame.Position = UDim2.new(0.5, -250, 0.5, -200) + frame.Size = UDim2.new(0.0, 500, 0.0, 400) + frame.BackgroundTransparency = 1 + frame.Active = true + frame.Parent = shield + + local settingsFrame = Instance.new("Frame") + settingsFrame.Name = "ReportAbuseStyle" + settingsFrame.Size = UDim2.new(1, 0, 1, 0) + settingsFrame.Style = Enum.FrameStyle.RobloxRound + settingsFrame.Active = true + settingsFrame.ZIndex = baseZIndex + 1 + settingsFrame.Parent = frame + + local title = Instance.new("TextLabel") + title.Name = "Title" + title.Text = "Report Abuse" + title.TextColor3 = Color3I(221,221,221) + title.Position = UDim2.new(0.5, 0, 0, 30) + title.Font = Enum.Font.ArialBold + title.FontSize = Enum.FontSize.Size36 + title.ZIndex = baseZIndex + 2 + title.Parent = settingsFrame + + local description = Instance.new("TextLabel") + description.Name = "Description" + description.Text = "This will send a complete report to a moderator. The moderator will review the chat log and take appropriate action." + description.TextColor3 = Color3I(221,221,221) + description.Position = UDim2.new(0,20, 0, 55) + description.Size = UDim2.new(1, -40, 0, 40) + description.BackgroundTransparency = 1 + description.Font = Enum.Font.Arial + description.FontSize = Enum.FontSize.Size18 + description.TextWrap = true + description.ZIndex = baseZIndex + 2 + description.TextXAlignment = Enum.TextXAlignment.Left + description.TextYAlignment = Enum.TextYAlignment.Top + description.Parent = settingsFrame + + local playerLabel = Instance.new("TextLabel") + playerLabel.Name = "PlayerLabel" + playerLabel.Text = "Which player?" + playerLabel.BackgroundTransparency = 1 + playerLabel.Font = Enum.Font.Arial + playerLabel.FontSize = Enum.FontSize.Size18 + playerLabel.Position = UDim2.new(0.025,0,0,100) + playerLabel.Size = UDim2.new(0.4,0,0,36) + playerLabel.TextColor3 = Color3I(255,255,255) + playerLabel.TextXAlignment = Enum.TextXAlignment.Left + playerLabel.ZIndex = baseZIndex + 2 + playerLabel.Parent = settingsFrame + + local abusingPlayer = nil + local abuse = nil + local submitReportButton = nil + + local updatePlayerSelection = nil + local createPlayersDropDown = function() + local players = game:GetService("Players") + local playerNames = {} + local nameToPlayer = {} + local children = players:GetChildren() + local pos = 1 + if children then + for i, player in ipairs(children) do + if player:IsA("Player") and player ~= localPlayer then + playerNames[pos] = player.Name + nameToPlayer[player.Name] = player + pos = pos + 1 + end + end + end + local playerDropDown = nil + playerDropDown, updatePlayerSelection = RbxGui.CreateDropDownMenu(playerNames, + function(playerName) + abusingPlayer = nameToPlayer[playerName] + if abuse and abusingPlayer then + submitReportButton.Active = true + end + end) + playerDropDown.Name = "PlayersComboBox" + playerDropDown.ZIndex = baseZIndex + 2 + playerDropDown.Position = UDim2.new(.425, 0, 0, 102) + playerDropDown.Size = UDim2.new(.55,0,0,32) + + return playerDropDown + end + + local abuseLabel = Instance.new("TextLabel") + abuseLabel.Name = "AbuseLabel" + abuseLabel.Text = "What did they do?" + abuseLabel.Font = Enum.Font.Arial + abuseLabel.BackgroundTransparency = 1 + abuseLabel.FontSize = Enum.FontSize.Size18 + abuseLabel.Position = UDim2.new(0.025,0,0,140) + abuseLabel.Size = UDim2.new(0.4,0,0,36) + abuseLabel.TextColor3 = Color3I(255,255,255) + abuseLabel.TextXAlignment = Enum.TextXAlignment.Left + abuseLabel.ZIndex = baseZIndex + 2 + abuseLabel.Parent = settingsFrame + + local abuses = {"Bad Words or Threats","Bad Username","Talking about Dating","Account Trading or Sharing","Asking Personal Questions","Rude or Mean Behavior","False Reporting Me"} + local abuseDropDown, updateAbuseSelection = RbxGui.CreateDropDownMenu(abuses, + function(abuseText) + abuse = abuseText + if abuse and abusingPlayer then + submitReportButton.Active = true + end + end, true) + abuseDropDown.Name = "AbuseComboBox" + abuseDropDown.ZIndex = baseZIndex + 2 + abuseDropDown.Position = UDim2.new(0.425, 0, 0, 142) + abuseDropDown.Size = UDim2.new(0.55,0,0,32) + abuseDropDown.Parent = settingsFrame + + local shortDescriptionLabel = Instance.new("TextLabel") + shortDescriptionLabel.Name = "ShortDescriptionLabel" + shortDescriptionLabel.Text = "Short Description: (optional)" + shortDescriptionLabel.Font = Enum.Font.Arial + shortDescriptionLabel.FontSize = Enum.FontSize.Size18 + shortDescriptionLabel.Position = UDim2.new(0.025,0,0,180) + shortDescriptionLabel.Size = UDim2.new(0.95,0,0,36) + shortDescriptionLabel.TextColor3 = Color3I(255,255,255) + shortDescriptionLabel.TextXAlignment = Enum.TextXAlignment.Left + shortDescriptionLabel.BackgroundTransparency = 1 + shortDescriptionLabel.ZIndex = baseZIndex + 2 + shortDescriptionLabel.Parent = settingsFrame + + local shortDescriptionWrapper = Instance.new("Frame") + shortDescriptionWrapper.Name = "ShortDescriptionWrapper" + shortDescriptionWrapper.Position = UDim2.new(0.025,0,0,220) + shortDescriptionWrapper.Size = UDim2.new(0.95,0,1,-310) + shortDescriptionWrapper.BackgroundColor3 = Color3I(0,0,0) + shortDescriptionWrapper.BorderSizePixel = 0 + shortDescriptionWrapper.ZIndex = baseZIndex + 2 + shortDescriptionWrapper.Parent = settingsFrame + + local shortDescriptionBox = Instance.new("TextBox") + shortDescriptionBox.Name = "TextBox" + shortDescriptionBox.Text = "" + shortDescriptionBox.Font = Enum.Font.Arial + shortDescriptionBox.FontSize = Enum.FontSize.Size18 + shortDescriptionBox.Position = UDim2.new(0,3,0,3) + shortDescriptionBox.Size = UDim2.new(1,-6,1,-6) + shortDescriptionBox.TextColor3 = Color3I(255,255,255) + shortDescriptionBox.TextXAlignment = Enum.TextXAlignment.Left + shortDescriptionBox.TextYAlignment = Enum.TextYAlignment.Top + shortDescriptionBox.TextWrap = true + shortDescriptionBox.BackgroundColor3 = Color3I(0,0,0) + shortDescriptionBox.BorderSizePixel = 0 + shortDescriptionBox.ZIndex = baseZIndex + 2 + shortDescriptionBox.Parent = shortDescriptionWrapper + + submitReportButton = Instance.new("TextButton") + submitReportButton.Name = "SubmitReportBtn" + submitReportButton.Active = false + submitReportButton.Font = Enum.Font.Arial + submitReportButton.FontSize = Enum.FontSize.Size18 + submitReportButton.Position = UDim2.new(0.1, 0, 1, -80) + submitReportButton.Size = UDim2.new(0.35,0,0,50) + submitReportButton.AutoButtonColor = true + submitReportButton.Style = Enum.ButtonStyle.RobloxButtonDefault + submitReportButton.Text = "Submit Report" + submitReportButton.TextColor3 = Color3I(255,255,255) + submitReportButton.ZIndex = baseZIndex + 2 + submitReportButton.Parent = settingsFrame + + submitReportButton.MouseButton1Click:connect(function() + if submitReportButton.Active then + if abuse and abusingPlayer then + frame.Visible = false + game.Players:ReportAbuse(abusingPlayer, abuse, shortDescriptionBox.Text) + if abuse == "Rude or Mean Behavior" or abuse == "False Reporting Me" then + calmingMessageBox.Visible = true + else + normalMessageBox.Visible = true + end + else + closeAndResetDialog() + end + end + end) + + local cancelButton = Instance.new("TextButton") + cancelButton.Name = "CancelBtn" + cancelButton.Font = Enum.Font.Arial + cancelButton.FontSize = Enum.FontSize.Size18 + cancelButton.Position = UDim2.new(0.55, 0, 1, -80) + cancelButton.Size = UDim2.new(0.35,0,0,50) + cancelButton.AutoButtonColor = true + cancelButton.Style = Enum.ButtonStyle.RobloxButtonDefault + cancelButton.Text = "Cancel" + cancelButton.TextColor3 = Color3I(255,255,255) + cancelButton.ZIndex = baseZIndex + 2 + cancelButton.Parent = settingsFrame + + closeAndResetDialog = function() + --Delete old player combo box + local oldComboBox = settingsFrame:FindFirstChild("PlayersComboBox") + if oldComboBox then + oldComboBox.Parent = nil + end + + abusingPlayer = nil updatePlayerSelection(nil) + abuse = nil updateAbuseSelection(nil) + submitReportButton.Active = false + shortDescriptionBox.Text = "" + frame.Visible = true + calmingMessageBox.Visible = false + normalMessageBox.Visible = false + shield.Visible = false + reportAbuseButton.Active = true + pcall(function() game.GuiService:RemoveCenterDialog(shield) end) + end + + cancelButton.MouseButton1Click:connect(closeAndResetDialog) + + reportAbuseButton.MouseButton1Click:connect( + function() + createPlayersDropDown().Parent = settingsFrame + + local centerDialogSuccess = pcall(function() game.GuiService:AddCenterDialog(shield, Enum.CenterDialogType.ModalDialog, + --ShowFunction + function() + reportAbuseButton.Active = false + shield.Visible = true + end, + --HideFunction + function() + reportAbuseButton.Active = true + shield.Visible = false + end) + end) + if centerDialogSuccess == false then + reportAbuseButton.Active = false + shield.Visible = true + end + end + ) + + robloxLock(shield) + return shield +end + +local createChatBar = function() + --Only show a chat bar if we are a NetworkClient + waitForChild(game, "NetworkClient") + + waitForChild(game, "Players") + waitForProperty(game.Players, "LocalPlayer") + + local chatBar = Instance.new("Frame") + chatBar.Name = "ChatBar" + chatBar.Size = UDim2.new(1, 0, 0, 22) + chatBar.Position = UDim2.new(0, 0, 1, 0) + chatBar.BackgroundColor3 = Color3.new(0,0,0) + chatBar.BorderSizePixel = 0 + + local chatBox = Instance.new("TextBox") + chatBox.Text = "" + chatBox.Visible = false + chatBox.Size = UDim2.new(1,-4,1,0) + chatBox.Position = UDim2.new(0,2,0,0) + chatBox.TextXAlignment = Enum.TextXAlignment.Left + chatBox.Font = Enum.Font.Arial + chatBox.ClearTextOnFocus = false + chatBox.FontSize = Enum.FontSize.Size14 + chatBox.TextColor3 = Color3.new(1,1,1) + chatBox.BackgroundTransparency = 1 + chatBox.Parent = chatBar + + local chatButton = Instance.new("TextButton") + chatButton.Size = UDim2.new(1,-4,1,0) + chatButton.Position = UDim2.new(0,2,0,0) + chatButton.AutoButtonColor = false + chatButton.Text = "To chat click here or press \"/\" key" + chatButton.TextXAlignment = Enum.TextXAlignment.Left + chatButton.Font = Enum.Font.Arial + chatButton.FontSize = Enum.FontSize.Size14 + chatButton.TextColor3 = Color3.new(1,1,1) + chatButton.BackgroundTransparency = 1 + chatButton.Parent = chatBar + + local activateChat = function() + if chatBox.Visible then + return + end + chatButton.Visible = false + chatBox.Text = "" + chatBox.Visible = true + chatBox:CaptureFocus() + end + + chatButton.MouseButton1Click:connect(activateChat) + + local hotKeyEnabled = true + local toggleHotKey = function(value) + hotKeyEnabled = value + end + + local guiService = game:GetService("GuiService") + local newChatMode = pcall(function() + guiService:AddSpecialKey(Enum.SpecialKey.ChatHotkey) + guiService.SpecialKeyPressed:connect(function(key) if key == Enum.SpecialKey.ChatHotkey and hotKeyEnabled then activateChat() end end) + end) + if not newChatMode then + guiService:AddKey("/") + guiService.KeyPressed:connect(function(key) if key == "/" and hotKeyEnabled then activateChat() end end) + end + + chatBox.FocusLost:connect( + function(enterPressed) + if enterPressed then + if chatBox.Text ~= "" then + local str = chatBox.Text + if string.sub(str, 1, 1) == '%' then + game.Players:TeamChat(string.sub(str, 2)) + else + game.Players:Chat(str) + end + end + end + chatBox.Text = "" + chatBox.Visible = false + chatButton.Visible = true + end) + robloxLock(chatBar) + return chatBar, toggleHotKey +end + +--Spawn a thread for the help dialog +delay(0, + function() + local helpDialog = createHelpDialog(0) + helpDialog.Parent = gui + + helpButton.MouseButton1Click:connect( + function() + local centerDialogSuccess = pcall(function() game.GuiService:AddCenterDialog(helpDialog, Enum.CenterDialogType.ModalDialog, + --ShowFunction + function() + helpDialog.Visible = true + end, + --HideFunction + function() + helpDialog.Visible = false + end) + end) + if centerDialogSuccess == false then + helpDialog.Visible = true + end + end) + helpButton.Active = true + end) + +--Spawn a thread for the Save dialogs +local isSaveDialogSupported = pcall(function() local var = game.LocalSaveEnabled end) +if isSaveDialogSupported then + delay(0, + function() + local saveDialogs = createSaveDialogs() + saveDialogs.Parent = gui + + game.RequestShutdown = function() + local centerDialogSuccess = pcall(function() game.GuiService:AddCenterDialog(saveDialogs, Enum.CenterDialogType.QuitDialog, + --ShowFunction + function() + saveDialogs.Visible = true + end, + --HideFunction + function() + saveDialogs.Visible = false + end) + end) + + if centerDialogSuccess == false then + saveDialogs.Visible = true + end + return true + end + end) +end + +--Spawn a thread for the Report Abuse dialogs +print("about to create") +delay(0, + function() + createReportAbuseDialog().Parent = gui + print("parenting report abuse") + if gui:FindFirstChild("BottomRightControl") and gui.BottomRightControl:FindFirstChild("ReportAbuse") then + gui.BottomRightControl.ReportAbuse.Active = true + elseif useOldDialog then + gui.BottomRightControl.ReportAbuse.Active = true + print("old stuff") + else + waitForChild(gui,"UserSettingsShield") + waitForChild(gui.UserSettingsShield, "Settings") + waitForChild(gui.UserSettingsShield.Settings,"SettingsStyle") + waitForChild(gui.UserSettingsShield.Settings.SettingsStyle,"GameMainMenu") + waitForChild(gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu, "ReportAbuseButton") + gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu.ReportAbuseButton.Active = true + end + end) + +--Spawn a thread for Chat Bar +local isChatBarSupported, coreGuiVersion = pcall(function() return game.CoreGui.Version end) -- isChatBarSupported is for PC Lua chat, coreGuiVersion should be >=2 as well +local isMacChat, version = pcall(function() return game.GuiService.Version end) +if isMacChat and version >= 2 then + delay(0, + function() + waitForChild(game, "Players") + waitForProperty(game.Players, "LocalPlayer") + + local advancedChatBarSupported = pcall(function() return game.Players.LocalPlayer.ChatMode end) + local chatBar, toggleHotKey = createChatBar() + + if advancedChatBarSupported then + local function toggleChatBar(chatMode) + if chatMode == Enum.ChatMode.Menu then + chatBar.Parent = nil + game.GuiService:SetGlobalSizeOffsetPixel(0,0) + toggleHotKey(false) + elseif chatMode == Enum.ChatMode.TextAndMenu then + chatBar.Parent = gui + game.GuiService:SetGlobalSizeOffsetPixel(0,-22) + toggleHotKey(true) + end + end + game.Players.LocalPlayer.Changed:connect( + function(prop) + if prop == "ChatMode" then + toggleChatBar(game.Players.LocalPlayer.ChatMode) + end + end) + toggleChatBar(game.Players.LocalPlayer.ChatMode) + else + chatBar.Parent = gui + game.GuiService:SetGlobalSizeOffsetPixel(0,-22) + end + end) +end + + +local BurningManPlaceID = 41324860 +-- TODO: remove click to walk completely if testing shows we don't need it +-- Removes click to walk option from Burning Man +delay(0, + function() + waitForChild(game,"NetworkClient") + waitForChild(game,"Players") + waitForProperty(game.Players, "LocalPlayer") + waitForProperty(game.Players.LocalPlayer, "Character") + waitForChild(game.Players.LocalPlayer.Character, "Humanoid") + waitForProperty(game, "PlaceId") + pcall(function() + if game.PlaceId == BurningManPlaceID then + game.Players.LocalPlayer.Character.Humanoid:SetClickToWalkEnabled(false) + game.Players.LocalPlayer.CharacterAdded:connect(function(character) + waitForChild(character, "Humanoid") + character.Humanoid:SetClickToWalkEnabled(false) + end) + end + end) + end) + end --LoadLibrary if \ No newline at end of file diff --git a/public/asset/7 b/public/asset/7 index d2d36fe..8933f36 100644 --- a/public/asset/7 +++ b/public/asset/7 @@ -53,7 +53,7 @@ popupImage.Parent = popupFrame local backing = Instance.new("ImageLabel") backing.BackgroundTransparency = 1 backing.Size = UDim2.new(1,0,1,0) -backing.Image = "http://www.roblox.com/asset/?id=47574181" +backing.Image = "http://www.morblox.us/asset/?id=47574181" backing.Name = "Backing" backing.ZIndex = 2 backing.Parent = popupImage diff --git a/public/asset/8 b/public/asset/8 index 4a24c4b..c9fe473 100644 --- a/public/asset/8 +++ b/public/asset/8 @@ -34,7 +34,7 @@ function makeFriend(fromPlayer,toPlayer) 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.PopupImage.Image = "http://www.roblox.com/thumbs/avatar.ashx?userId="..tostring(fromPlayer.userId).."&x=352&y=352" + popup.PopupImage.Image = "http://www.morblox.us/thumbs/avatar.ashx?userId="..tostring(fromPlayer.userId).."&x=352&y=352" showTwoButtons() popup.Visible = true @@ -73,7 +73,7 @@ game.Players.FriendRequestEvent:connect(function(fromPlayer,toPlayer,event) if event == Enum.FriendRequestEvent.Accept then game:GetService("GuiService"):SendNotification("You are Friends", "With " .. toPlayer.Name .. "!", - "http://www.roblox.com/thumbs/avatar.ashx?userId="..tostring(toPlayer.userId).."&x=48&y=48", + "http://www.morblox.us/thumbs/avatar.ashx?userId="..tostring(toPlayer.userId).."&x=48&y=48", 5, function() @@ -84,7 +84,7 @@ game.Players.FriendRequestEvent:connect(function(fromPlayer,toPlayer,event) if friendRequestBlacklist[fromPlayer] then return end -- previously cancelled friend request, we don't want it! game:GetService("GuiService"):SendNotification("Friend Request", "From " .. fromPlayer.Name, - "http://www.roblox.com/thumbs/avatar.ashx?userId="..tostring(fromPlayer.userId).."&x=48&y=48", + "http://www.morblox.us/thumbs/avatar.ashx?userId="..tostring(fromPlayer.userId).."&x=48&y=48", 8, function() makeFriend(fromPlayer,toPlayer) @@ -92,7 +92,7 @@ game.Players.FriendRequestEvent:connect(function(fromPlayer,toPlayer,event) elseif event == Enum.FriendRequestEvent.Accept then game:GetService("GuiService"):SendNotification("You are Friends", "With " .. fromPlayer.Name .. "!", - "http://www.roblox.com/thumbs/avatar.ashx?userId="..tostring(fromPlayer.userId).."&x=48&y=48", + "http://www.morblox.us/thumbs/avatar.ashx?userId="..tostring(fromPlayer.userId).."&x=48&y=48", 5, function() diff --git a/public/asset/9 b/public/asset/9 index ec53dd7..161c0e6 100644 --- a/public/asset/9 +++ b/public/asset/9 @@ -418,64 +418,7 @@ local Chat = { } --------------------------------------------------- -local function GetNameValue(pName) - local value = 0 - for index = 1, #pName do - local cValue = string.byte(string.sub(pName, index, index)) - local reverseIndex = #pName - index + 1 - if #pName%2 == 1 then - reverseIndex = reverseIndex - 1 - end - if reverseIndex%4 >= 2 then - cValue = -cValue - end - value = value + cValue - end - return value%8 -end -function Chat:ComputeChatColor(pName) - return self.ChatColors[GetNameValue(pName) + 1].Color -end - --- This is context based scrolling -function Chat:EnableScrolling(toggle) - -- Genius idea gone to fail, if we switch the camera type we can effectively lock the - -- camera and do no click scrolling - self.MouseOnFrame = false - if self.RenderFrame then - self.RenderFrame.MouseEnter:connect(function() - local character = Player.Character - local torso = WaitForChild(character, 'Torso') - local humanoid = WaitForChild(character, 'Humanoid') - local head = WaitForChild(character, 'Head') - if toggle then - self.MouseOnFrame = true - Camera.CameraType = 'Scriptable' - -- Get relative position of camera and keep to it - Spawn(function() - local currentRelativePos = Camera.CoordinateFrame.p - torso.Position - while Chat.MouseOnFrame do - Camera.CoordinateFrame = CFrame.new(torso.Position + currentRelativePos, head.Position) - wait(0.015) - end - end) - end - end) - - self.RenderFrame.MouseLeave:connect(function() - Camera.CameraType = 'Custom' - self.MouseOnFrame = false - end) - end -end - --- TODO: Scrolling using Mouse wheel -function Chat:OnScroll(speed) - if self.MouseOnFrame then - -- - end -end -- Check if we are running on a touch device function Chat:IsTouchDevice() @@ -503,85 +446,7 @@ function Chat:ScrollQueue(value) end end --- Handles the rendering of the text objects in their appropriate places -function Chat:UpdateQueue(field) - -- Have to do some sort of correction here - for i = #self.MessageQueue, 1, -1 do - if self.MessageQueue[i] then - for _, label in pairs(self.MessageQueue[i]) do - if label and type(label) ~= 'table' and type(label) ~= 'number' then - if label:IsA('TextLabel') or label:IsA('TextButton') then - if self.SlotPositions_List[i] and self.MessageQueue[i] ~= field then - label.Position = self.SlotPositions_List[i][1] - UDim2.new(0, 0, field['Message'].Size.Y.Scale, 0) - label.Position = UDim2.new(self.Configuration.XScale, 0, label.Position.Y.Scale, 0) - else - label.Position = UDim2.new(self.Configuration.XScale, 0, label.Position.Y.Scale - field['Message'].Size.Y.Scale , 0) - end - if field == self.MessageQueue[i] then - -- Just to show up popping effect for the latest message in chat - Spawn(function() - wait(0.15) - while label.TextTransparency > 0 do - label.TextTransparency = label.TextTransparency - 0.2 - wait() - end - end) - end - if label.Position.Y.Scale < -0.05 or label.Position.Y.Scale > 1.0 then - label.TextTransparency = 1.0 - else - label.TextTransparency = 0.0 - end - end - end - end - end - end -end -function Chat:InsertIntoQueue(field) - -- This is a ring buffer where insertions happen at the beginning - -- One optimization here would be to not copy the queue by reference - -- And reuse the same queue and do the insertion in place - -- But rendering code must be changed accordingly and this becomes rather hard to manage - -- plus the effects are minimal - -- TODO: Revist if this becomes a problem for optimization - local tmpQueue = self.MessageQueue - self.MessageQueue = {} - self.MessageQueue[1] = field - self.MessageQueue[1].Previous = tmpQueue[i] - self.MessageQueue[1].Next = nil - - self.SlotPositions_List = {} - self.SlotPositions_List[1] = {field.Position, field.Size} - - if tmpQueue[self.Configuration.HistoryLength] then - if tmpQueue[self.Configuration.HistoryLength]['Player'] then - tmpQueue[self.Configuration.HistoryLength]['Player']:Destroy() - end - if tmpQueue[self.Configuration.HistoryLength]['Message'] then - tmpQueue[self.Configuration.HistoryLength]['Message']:Destroy() - end - tmpQueue[self.Configuration.HistoryLength] = nil - end - - for i = 1, self.Configuration.HistoryLength - 1 do - if tmpQueue[i] and tmpQueue[i]['Player'] and tmpQueue[i]['Player'].Parent then - table.insert(self.MessageQueue, tmpQueue[i]) - self.MessageQueue[#self.MessageQueue].Previous = tmpQueue[i+1] or nil - self.MessageQueue[#self.MessageQueue].Next = tmpQueue[i-1] or nil - - self.SlotPositions_List[#self.MessageQueue] = {tmpQueue[i]['Message'].Position, tmpQueue[i]['Message'].Size} - end - end - -- Now, render the queue - Chat:UpdateQueue(field) -end - -function Chat:CreateScrollBar() - -- Code for scrolling is in here, partially, but scroll bar drawing isn't drawn - -- TODO: Implement -end function Chat:FocusOnChatBar() if self.ClickToChatButton then @@ -620,7 +485,7 @@ function Chat:CreateTouchButton() Size = UDim2.new(1, 0, 1, 0); Position = UDim2.new(0, 0, 0, 0); BackgroundTransparency = 1.0; - Image = 'http://morblox.us/asset/?id=97078724' + Image = 'http://www.roblox.com/asset/?id=97078724' }; } self.TapToChatLabel = self.ChatTouchFrame.ChatLabel @@ -740,106 +605,7 @@ function Chat:ComputeSpaceString(pLabel) return nString end --- When the playerChatted event fires --- The message is what the player chatted -function Chat:UpdateChat(cPlayer, message) - local pName = cPlayer.Name - local pLabel - local mLabel - -- Our history stores upto 50 messages that is 100 textlabels - -- If we ever hit the mark, which would be in every popular game btw - -- we wrap around and reuse the labels - if #self.MessageQueue > self.Configuration.HistoryLength then - pLabel = self.MessageQueue[#self.MessageQueue]['Player'] - mLabel = self.MessageQueue[#self.MessageQueue]['Message'] - pLabel.Text = pName - pLabel.Name = pName - pLabel.TextColor3 = Chat:ComputeChatColor(pName) - - local nString - - if not self.CachedSpaceStrings_List[pName] then - nString = Chat:ComputeSpaceString(pLabel) - else - nString = self.CachedSpaceStrings_List[pName] - end - - mLabel.Name = pName .. " - message" - mLabel.Text = nString .. message; - - -- Reinserted at the beginning, ring buffer - self.MessageQueue[#self.MessageQueue] = nil - else - -- Haven't hit the mark yet, so keep creating - pLabel = Gui.Create'TextButton' - { - Name = pName; - Text = pName .. ":"; - TextColor3 = Chat:ComputeChatColor(pName); - FontSize = Chat.Configuration.FontSize; - TextXAlignment = Enum.TextXAlignment.Left; - TextYAlignment = Enum.TextYAlignment.Top; - Parent = self.RenderFrame; - TextWrapped = false; - Size = UDim2.new(1, 0, 0.1, 0); - BackgroundTransparency = 1.0; - TextTransparency = 1.0; - Position = UDim2.new(0, 0, 1, 0); - BorderSizePixel = 0.0; - }; - - local nString - - if not self.CachedSpaceStrings_List[pName] then - nString = Chat:ComputeSpaceString(pLabel) - else - nString = self.CachedSpaceStrings_List[pName] - end - - mLabel = Gui.Create'TextButton' - { - Name = pName .. ' - message'; - -- Max is 3 lines - Size = UDim2.new(1, 0, 0.5, 0); - Text = nString .. message; - TextColor3 = Chat.Configuration.MessageColor; - FontSize = Chat.Configuration.FontSize; - TextXAlignment = Enum.TextXAlignment.Left; - TextYAlignment = Enum.TextYAlignment.Top; - Parent = self.RenderFrame; - TextWrapped = true; - BackgroundTransparency = 1.0; - TextTransparency = 1.0; - Position = UDim2.new(0, 0, 1, 0); - BorderSizePixel = 0.0; - }; - end - - -- This is to find if we need to wrap the text around - -- Expensive, but works well and worthwhile - -- This will give beautiful multilines as well - local heightField = 0.1 * self.RenderFrame.AbsoluteSize.Y - - while heightField < mLabel.TextBounds.Y do - heightField = heightField + 1 - end - - pLabel.Visible = true - mLabel.Visible = true - - mLabel.Size = UDim2.new(1, 0, heightField/self.RenderFrame.AbsoluteSize.Y, 0) - pLabel.Size = mLabel.Size - local yPixels = self.RenderFrame.AbsoluteSize.Y - local yFieldSize = mLabel.TextBounds.Y - - local queueField = {} - queueField['Player'] = pLabel - queueField['Message'] = mLabel - queueField['SpawnTime'] = tick() -- Used for identifying when to make the message invisible - - Chat:InsertIntoQueue(queueField) -end function Chat:ScreenSizeChanged() while self.Frame.AbsoluteSize.Y > 120 do @@ -864,7 +630,7 @@ function Chat:CreateGui() Gui.Create'ImageLabel' { Name = 'Background'; - Image = 'http://morblox.us/asset/?id=97120937'; --96551212'; + Image = 'http://www.roblox.com/asset/?id=97120937'; --96551212'; Size = UDim2.new(1.3, 0, 1.64, 0); Position = UDim2.new(0, 0, 0, 0); BackgroundTransparency = 1.0; @@ -891,7 +657,7 @@ function Chat:CreateGui() BackgroundTransparency = 1.0; ClipsDescendants = true; ZIndex = 0.0; - Visible = false; + }; }; @@ -1042,7 +808,7 @@ function Chat:CreateSafeChatGui() Size = UDim2.new(0, 44, 0, 31); Position = UDim2.new(0, 1, 0.35, 0); BackgroundTransparency = 1.0; - Image = 'http://morblox.us/asset/?id=97080365'; + Image = 'http://www.roblox.com/asset/?id=97080365'; }; } @@ -1115,48 +881,9 @@ function Chat:FindMessageInSafeChat(message, list) return foundMessage end --- Just a wrapper around our PlayerChatted event -function Chat:PlayerChatted(...) - local args = {...} - local argCount = select('#', ...) - local player - local message - -- This doesn't look very good, but what else to do? - if args[2] then - player = args[2] - end - if args[3] then - message = args[3] - end - if PlayersService.ClassicChat then - if Player.ChatMode == Enum.ChatMode.TextAndMenu then - Chat:UpdateChat(player, message) - elseif Player.ChatMode == Enum.ChatMode.Menu and string.sub(message, 3) == '/sc' then - Chat:UpdateChat(player, message) - else - if Chat:FindMessageInSafeChat(message, self.SafeChat_List) then - Chat:UpdateChat(player, message) - end - end - end -end --- After 5 minutes of existence, the labels become invisible --- Runs only every 5 seconds and has to loop through 50 values --- Shouldn't be too expensive -function Chat:CullThread() - while true do - if #self.MessageQueue > 0 then - for _, field in pairs(self.MessageQueue) do - if tick() - field['SpawnTime'] > self.Configuration.LifeTime and field['Player'] and field['Message'] then - field['Player'].Visible = false - field['Message'].Visible = false - end - end - end - wait(5.0) - end -end + + -- RobloxLock everything so users can't delete them(?) function Chat:LockAllFields(gui) diff --git a/public/asset/index.php b/public/asset/index.php index 6673617..21e5f8b 100644 --- a/public/asset/index.php +++ b/public/asset/index.php @@ -4,7 +4,7 @@ ob_start(); function sign($data) { $PrivKey = file_get_contents("./PrivKey.pem"); openssl_sign($data, $signature, $PrivKey, OPENSSL_ALGO_SHA1); - echo "" . sprintf("%%%s%%%s", base64_encode($signature), $data); + echo sprintf("%%%s%%%s", base64_encode($signature), $data); } $id = (int)($_GET["id"] ?? die(json_encode(["message" => "Error handling your request."]))); @@ -55,8 +55,6 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/asset/" . $id)){ sign($file); }else if($id == 20){ sign($file); - }else if($id == 52177590){ - sign($file); }else{ echo $file; }