diff --git a/CoreGui2011.rbxm b/CoreGui2011.rbxm index 6cb363e..35fd428 100644 --- a/CoreGui2011.rbxm +++ b/CoreGui2011.rbxm @@ -5,29 +5,1071 @@ false - GUI_Copy - script.Playerlist:clone().Parent = game.StarterGui + Sorter + print("Special thanks to Bitl, Carrot, iago, winsupermario1234, Khangaroo, drslicendice, coke, TheLivingBee, Raymonf, and a bunch of play - testers for help making 2011 fully stable and work. 8)") +script.Playerlist:clone().Parent = game.StarterGui +script.Dialogs:clone().Parent = game.StarterGui +script.Health:clone().Parent = game.StarterGui +script.ReenableDialogScript:clone().Parent = game.Lighting +script.TimeoutScript:clone().Parent = game.Lighting +script.ResetCommand:clone().Parent = game.Workspace script:remove() true - + - Playerlist + true + + ReenableDialogScript + wait(5) +local dialog = script.Parent +if dialog:IsA("Dialog") then + dialog.InUse = false +end +script:Remove() + true - + + + + true + + TimeoutScript + wait(5) +local dialog = script.Parent +if dialog:IsA("Dialog") then + dialog.InUse = false +end +script:Remove() + + true + + + + + false + + ResetCommand + function onChatted(msg, speaker) + + source = string.lower(speaker.Name) + msg = string.lower(msg) + -- Note: This one is NOT caps sensitive + + if msg == "!!!reset" then + speaker.Character.Humanoid.Health = 0 + end +end + +function onPlayerEntered(newPlayer) + newPlayer.Chatted:connect(function(msg) onChatted(msg, newPlayer) end) +end + +game.Players.ChildAdded:connect(onPlayerEntered) + true + + + + + Health + true + + + + false + 4285215356 + 1 + 4279970357 + 1 + tray + + 0.5 + -44 + 1 + -26 + + + 0 + 170 + 0 + 18 + + 2 + 0 + true + 1 + true + + + + false + 4294967295 + 1 + 4279970357 + 1 + rbxasset://textures/healthgui/bkg.png + bkg + + 0 + 0 + 0 + 0 + + + 1 + 0 + 1 + 0 + + 0 + true + 1 + true + + + + + false + 4294967295 + 1 + 4279970357 + 1 + rbxasset://textures/healthgui/BarRed.png + barRed + + 0.0189999994 + 0 + 0.100000001 + 0 + + + 0 + 0 + 0 + 0 + + 0 + true + 1 + true + + + + + false + 4294967295 + 1.00000012 + 4279970357 + 0 + bar2 + + 0.0189999994 + 0 + 0.100000001 + 0 + + + 0.192000002 + 0 + 0.829999983 + 0 + + 0 + 0 + true + 1 + true + + + + false + + Init + h = game.Players.LocalPlayer.Character.Humanoid +tray = script.Parent.Parent +base = tray.Parent +local lastHealth = 100 +local lastHealth2 = 100 +local maxWidth = 0.96 + +function UpdateGUI(health) + local width = (health / h.MaxHealth) * maxWidth + local height = 0.83 + local lastX = tray.bar.Position.X.Scale + local x = 0.019 + (maxWidth - width) + local y = 0.1 + + tray.bar.Position = UDim2.new(x,0,y, 0) + tray.bar.Size = UDim2.new(width, 0, height, 0) + -- If more than 1/4 health, bar = green. Else, bar = red. + if( (health / h.MaxHealth) > 0.25 ) then + tray.barRed.Size = UDim2.new(0, 0, 0, 0) + else + tray.barRed.Position = tray.bar.Position + tray.barRed.Size = tray.bar.Size + tray.bar.Size = UDim2.new(0, 0, 0, 0) + end + + if ( (lastHealth - health) > (h.MaxHealth / 10) ) then + lastHealth = health + + if h.Health ~= h.MaxHealth then + delay(0,function() + AnimateHurtOverlay() + end) + delay(0,function() + AnimateBars(x, y, lastX, height) + end) + end + else + lastHealth = health + end +end + +function AnimateBars(x, y, lastX, height) + local width = math.abs(x - lastX) + if( x > lastX ) then + x = lastX + end + tray.bar2.Position = UDim2.new(x,0, y, 0) + tray.bar2.Size = UDim2.new(width, 0, height, 0) + tray.bar2.BackgroundTransparency = 0 + local GBchannels = 1 + local j = 0.2 + + local i_total = 30 + for i=1,i_total do + -- Increment Values + if (GBchannels < 0.2) then + j = -j + end + GBchannels = GBchannels + j + if (i > (i_total - 10)) then + tray.bar2.BackgroundTransparency = tray.bar2.BackgroundTransparency + 0.1 + end + tray.bar2.BackgroundColor3 = Color3.new(1, GBchannels, GBchannels) + + wait(0.02) + end +end + +function AnimateHurtOverlay() + -- Start: + -- overlay.Position = UDim2.new(0, 0, 0, -22) + -- overlay.Size = UDim2.new(1, 0, 1.15, 30) + + -- Finish: + -- overlay.Position = UDim2.new(-2, 0, -2, -22) + -- overlay.Size = UDim2.new(4.5, 0, 4.65, 30) + + overlay = base.hurtOverlay + overlay.Visible = true + overlay.Position = UDim2.new(-2, 0, -2, -22) + overlay.Size = UDim2.new(4.5, 0, 4.65, 30) + -- Animate In, fast + local i_total = 2 + local wiggle_total = 0 + local wiggle_i = 0.02 + for i=1,i_total do + overlay.Position = UDim2.new( (-2 + (2 * (i/i_total)) + wiggle_total/2), 0, (-2 + (2 * (i/i_total)) + wiggle_total/2), -22 ) + overlay.Size = UDim2.new( (4.5 - (3.5 * (i/i_total)) + wiggle_total), 0, (4.65 - (3.5 * (i/i_total)) + wiggle_total), 30 ) + wait(0.01) + end + + i_total = 30 + + wait(0.03) + + -- Animate Out, slow + for i=1,i_total do + if( math.abs(wiggle_total) > (wiggle_i * 3) ) then + wiggle_i = -wiggle_i + end + wiggle_total = wiggle_total + wiggle_i + overlay.Position = UDim2.new( (0 - (2 * (i/i_total)) + wiggle_total/2), 0, (0 - (2 * (i/i_total)) + wiggle_total/2), -22 ) + overlay.Size = UDim2.new( (1 + (3.5 * (i/i_total)) + wiggle_total), 0, (1.15 + (3.5 * (i/i_total)) + wiggle_total), 30 ) + wait(0.01) + end + + -- Hide after we're done + overlay.Position = UDim2.new(10, 0, 0, 0) + overlay.Visible = false +end + +h.Changed:connect(function() + UpdateGUI(h.Health) + if ( (lastHealth2 - h.Health) > (h.MaxHealth / 10) ) then + lastHealth2 = h.Health + else + lastHealth2 = h.Health + end end) + true + + + + + + false + 4294967295 + 1 + 4279970357 + 1 + rbxasset://textures/healthgui/Bar.png + bar + + 0.0189999994 + 0 + 0.100000001 + 0 + + + 0.959999979 + 0 + 0.829999983 + 0 + + 0 + true + 1 + true + + + + + false + 4294967295 + 1 + 4279970357 + 0 + rbxasset://textures/healthgui/label.png + label + + 0.680000007 + 0 + 0.300000012 + 0 + + + 0.25 + 0 + 0.349999994 + 0 + + 0 + true + 1 + true + + + + + + false + 4290164919 + 1 + 4279970357 + 1 + rbxasset://textures/healthgui/HurtOverlay.png + hurtOverlay + + 2 + 0 + 0 + -22 + + + 1 + 0 + 1.1500001 + 30 + + 0 + false + 1 + true + + + + + false + + Hide + while true do + game.Players.LocalPlayer.PlayerGui.HealthGUI.tray.Visible = false + game.Players.LocalPlayer.PlayerGui.HealthGUI.hurtOverlay.Visible = false +end + true + + + + + + Dialogs + true + + + + false + 4288914085 + 1 + 4279970357 + 1 + ControlFrame + + 0 + 0 + 0 + 0 + + + 1 + 0 + 1 + 0 + + 0 + 0 + true + 1 + true + + + + false + 4288914085 + 1 + 4279970357 + 1 + BottomLeftControl + + 0 + 0 + 1 + -46 + + + 0 + 130 + 0 + 46 + + 0 + 0 + true + 1 + true + + + + + false + 4288914085 + 1 + 4279970357 + 1 + NotificationBox + + 1 + -200 + 0.5 + 0 + + + 0 + 200 + 0.419999987 + 0 + + 0 + true + 1 + true + + + + false Init - --rbxsig%bMgJMPt2chG7JIOhV0y5so/4dL1lRGiT3ELG0LsKh4QrqkG8sRdndraomuViGbDkVOWLXwIilzkhlSJSCjgZ9zXp6fS+SekW/n/RVWjNLA/gPThKLVxP6HmHRK9WTzIQ4ZTXjBmaExcdxBb1remqDPHWHlO2QoxZBqHs5sDGlQI=% ---rbxassetid%48488235% ---rbxsig%NGgzAS16V87kRv1YSTnTXts2fZjkDnnBr6KQq6h00V6iAQ8ZzNuc8zVRUQM/7krGgX+IJGvOqwZDpx1SiZICdYGcC6hhL0znChB4Stf54czFbYfp8ZY9k46+XGAFZtXYXuTLmIushHX/mDwEknP1qY16rTWjm/8J9o3nGx14W78=% ---rbxassetid%45284430% + --rbxsig%XeVmMtUuu+dXh8pEbcaTkr2m9RJZXY42LaACJ12YYcuPtOUxy4Azi8uMDGU8ZTh7cvZC9BlOWgqmZHKjESSdfOZl0/cgd2JKHPZ2UqiqA1slJa7R5GtCcGXlNPHW8KDYgJGRuwe8h5CSiMDOl6QLTSEegTOG7fzHk/n1AFcRN8I=% +--rbxassetid%39250920% --fixed by Carrot#0559 + +function waitForProperty(instance, name) + while not instance[name] do + instance.Changed:wait() + end +end + +local beter = game.Lighting + +function waitForDialogChildrenMyLord(beter, name) + while not beter:FindFirstChild(name) do + beter.ChildAdded:wait() + end +end + +local bois = game.Players.LocalPlayer.PlayerGui + +function waitForFaker(bois, name) + while not bois:FindFirstChild(name) do + bois.ChildAdded:wait() + end +end + + +local mainFrame +local choices = {} +local lastChoice +local choiceMap = {} +local currentConversationDialog +local currentConversationPartner +local currentAbortDialogScript + +local tooFarAwayMessage = "You are too far away to chat!" +local tooFarAwaySize = 300 +local characterWanderedOffMessage = "Chat ended because you walked away" +local characterWanderedOffSize = 350 +local conversationTimedOut = "Chat ended because you didn't reply" +local conversationTimedOutSize = 350 + +local player +local screenGui +local chatNotificationGui +local messageDialog +local timeoutScript = game.Lighting.ReenableDialogScript +local reenableDialogScript = game.Lighting.TimeoutScript +local dialogMap = {} +local dialogConnections = {} + +local gui = nil +--waitForDialogChildrenMyLord(game,"CoreGui") +--waitForDialogChildrenMyLord(game.CoreGui,"RobloxGui") +--if game.CoreGui.RobloxGui:FindFirstChild("ControlFrame") then +-- gui = game.CoreGui.RobloxGui.ControlFrame +--else +-- gui = game.CoreGui.RobloxGui +--end + +function currentTone() + if currentConversationDialog then + return currentConversationDialog.Tone + else + return Enum.DialogTone.Neutral + end +end + + +function createChatNotificationGui() + chatNotificationGui = Instance.new("BillboardGui") + chatNotificationGui.Name = "ChatNotificationGui" + chatNotificationGui.ExtentsOffset = Vector3.new(0,1,0) + chatNotificationGui.Size = UDim2.new(4, 0, 5.42857122, 0) + chatNotificationGui.SizeOffset = Vector2.new(0,0) + chatNotificationGui.StudsOffset = Vector3.new(0.4, 4.3, 0) + chatNotificationGui.Enabled = true + chatNotificationGui.Active = true + + local image = Instance.new("ImageLabel") + image.Name = "Image" + image.Active = false + image.BackgroundTransparency = 1 + image.Position = UDim2.new(0,0,0,0) + image.Size = UDim2.new(1.0,0,1.0,0) + image.Image = "" + image.Parent = chatNotificationGui + + + local button = Instance.new("ImageButton") + button.Name = "Button" + button.AutoButtonColor = false + button.Position = UDim2.new(0.0879999995, 0, 0.0529999994, 0) + button.Size = UDim2.new(0.829999983, 0, 0.460000008, 0) + button.Image = "" + button.BackgroundTransparency = 1 + button.Parent = image +end + +function getChatColor(tone) + if tone == Enum.DialogTone.Neutral then + return Enum.ChatColor.Blue + elseif tone == Enum.DialogTone.Friendly then + return Enum.ChatColor.Green + elseif tone == Enum.DialogTone.Enemy then + return Enum.ChatColor.Red + end +end + +function styleChoices(tone) + for i, obj in pairs(choices) do + resetColor(obj, tone) + end + resetColor(lastChoice, tone) +end + +function styleMainFrame(tone) + if tone == Enum.DialogTone.Neutral then + mainFrame.Style = Enum.FrameStyle.ChatBlue + mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botBlue_tailRight.png" + elseif tone == Enum.DialogTone.Friendly then + mainFrame.Style = Enum.FrameStyle.ChatGreen + mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botGreen_tailRight.png" + elseif tone == Enum.DialogTone.Enemy then + mainFrame.Style = Enum.FrameStyle.ChatRed + mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botRed_tailRight.png" + end + + styleChoices(tone) +end +function setChatNotificationTone(gui, purpose, tone) + if tone == Enum.DialogTone.Neutral then + gui.Image.Image = "rbxasset://textures/chatBubble_botBlue_notify_bkg.png" + elseif tone == Enum.DialogTone.Friendly then + gui.Image.Image = "rbxasset://textures/chatBubble_botGreen_notify_bkg.png" + elseif tone == Enum.DialogTone.Enemy then + gui.Image.Image = "rbxasset://textures/chatBubble_botRed_notify_bkg.png" + end + if purpose == Enum.DialogPurpose.Quest then + gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_bang.png" + elseif purpose == Enum.DialogPurpose.Help then + gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_question.png" + elseif purpose == Enum.DialogPurpose.Shop then + gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_money.png" + end +end + +function createMessageDialog() + messageDialog = Instance.new("Frame"); + messageDialog.Name = "DialogScriptMessage" + messageDialog.Style = Enum.FrameStyle.RobloxRound + messageDialog.Visible = false + + local text = Instance.new("TextLabel") + text.Name = "Text" + text.Position = UDim2.new(0,0,0,-1) + text.Size = UDim2.new(1,0,1,0) + text.FontSize = Enum.FontSize.Size14 + text.BackgroundTransparency = 1 + text.TextColor3 = Color3.new(1,1,1) + text.Parent = messageDialog +end + +function showMessage(msg, size) + messageDialog.Text.Text = msg + messageDialog.Size = UDim2.new(0,size,0,40) + messageDialog.Position = UDim2.new(0.5, -size/2, 0.5, -40) + messageDialog.Visible = true + wait(2) + messageDialog.Visible = false +end + +function variableDelay(str) + local length = math.min(string.len(str), 100) + wait(0.75 + ((length/75) * 1.5)) +end + +function resetColor(frame, tone) + if tone == Enum.DialogTone.Neutral then + frame.BackgroundColor3 = Color3.new(0/255, 0/255, 179/255) + frame.Number.TextColor3 = Color3.new(45/255, 142/255, 245/255) + elseif tone == Enum.DialogTone.Friendly then + frame.BackgroundColor3 = Color3.new(0/255, 77/255, 0/255) + frame.Number.TextColor3 = Color3.new(0/255, 190/255, 0/255) + elseif tone == Enum.DialogTone.Enemy then + frame.BackgroundColor3 = Color3.new(140/255, 0/255, 0/255) + frame.Number.TextColor3 = Color3.new(255/255,88/255, 79/255) + end +end + +function highlightColor(frame, tone) + if tone == Enum.DialogTone.Neutral then + frame.BackgroundColor3 = Color3.new(2/255, 108/255, 255/255) + frame.Number.TextColor3 = Color3.new(1, 1, 1) + elseif tone == Enum.DialogTone.Friendly then + frame.BackgroundColor3 = Color3.new(0/255, 128/255, 0/255) + frame.Number.TextColor3 = Color3.new(1, 1, 1) + elseif tone == Enum.DialogTone.Enemy then + frame.BackgroundColor3 = Color3.new(204/255, 0/255, 0/255) + frame.Number.TextColor3 = Color3.new(1, 1, 1) + end +end + +function wanderDialog() + print("Wander") + mainFrame.Visible = false + endDialog() + showMessage(characterWanderedOffMessage, characterWanderedOffSize) +end + +function timeoutDialog() + print("Timeout") + mainFrame.Visible = false + endDialog() + showMessage(conversationTimedOut, conversationTimedOutSize) +end +function normalEndDialog() + print("Done") + endDialog() +end + +function endDialog() + if currentAbortDialogScript then + currentAbortDialogScript:Remove() + currentAbortDialogScript = nil + end + + local dialog = currentConversationDialog + currentConversationDialog = nil + if dialog and dialog.InUse then + local reenableScript = reenableDialogScript:Clone() + reenableScript.archivable = false + reenableScript.Disabled = false + reenableScript.Parent = dialog + end + + for dialog, gui in pairs(dialogMap) do + if dialog and gui then + gui.Enabled = not dialog.InUse + end + end + + currentConversationPartner = nil +end + +function sanitizeMessage(msg) + if string.len(msg) == 0 then + return "..." + else + return msg + end +end + +function selectChoice(choice) + renewKillswitch(currentConversationDialog) + + --First hide the Gui + mainFrame.Visible = false + if choice == lastChoice then + game.Chat:Chat(game.Players.LocalPlayer.Character, "Goodbye!", getChatColor(currentTone())) + + normalEndDialog() + else + local dialogChoice = choiceMap[choice] + + game.Chat:Chat(game.Players.LocalPlayer.Character, sanitizeMessage(dialogChoice.UserDialog), getChatColor(currentTone())) + wait(1) + --currentConversationDialog:SignalDialogChoiceSelected(player, dialogChoice) + game.Chat:Chat(currentConversationPartner, sanitizeMessage(dialogChoice.ResponseDialog), getChatColor(currentTone())) + + variableDelay(dialogChoice.ResponseDialog) + presentDialogChoices(currentConversationPartner, dialogChoice:GetChildren()) + end +end + +function newChoice(numberText) + local frame = Instance.new("TextButton") + frame.BackgroundColor3 = Color3.new(0/255, 0/255, 179/255) + frame.AutoButtonColor = false + frame.BorderSizePixel = 0 + frame.Text = "" + frame.MouseEnter:connect(function() highlightColor(frame, currentTone()) end) + frame.MouseLeave:connect(function() resetColor(frame, currentTone()) end) + frame.MouseButton1Click:connect(function() selectChoice(frame) end) + + local number = Instance.new("TextLabel") + number.Name = "Number" + number.TextColor3 = Color3.new(127/255, 212/255, 255/255) + number.Text = numberText + number.FontSize = Enum.FontSize.Size14 + number.BackgroundTransparency = 1 + number.Position = UDim2.new(0,4,0,2) + number.Size = UDim2.new(0,20,0,24) + number.TextXAlignment = Enum.TextXAlignment.Left + number.TextYAlignment = Enum.TextYAlignment.Top + number.Parent = frame + + local prompt = Instance.new("TextLabel") + prompt.Name = "UserPrompt" + prompt.BackgroundTransparency = 1 + prompt.TextColor3 = Color3.new(1,1,1) + prompt.FontSize = Enum.FontSize.Size14 + prompt.Position = UDim2.new(0,28, 0, 2) + prompt.Size = UDim2.new(1,-32, 1, -4) + prompt.TextXAlignment = Enum.TextXAlignment.Left + prompt.TextYAlignment = Enum.TextYAlignment.Top + prompt.TextWrap = true + prompt.Parent = frame + + return frame +end +function initialize(parent) + choices[1] = newChoice("1)") + choices[2] = newChoice("2)") + choices[3] = newChoice("3)") + choices[4] = newChoice("4)") + + lastChoice = newChoice("5)") + lastChoice.UserPrompt.Text = "Goodbye!" + lastChoice.Size = UDim2.new(1,0,0,28) + + mainFrame = Instance.new("Frame") + mainFrame.Name = "UserDialogArea" + mainFrame.Size = UDim2.new(0, 350, 0, 200) + mainFrame.Style = Enum.FrameStyle.ChatBlue + mainFrame.Visible = false + + local imageLabel = Instance.new("ImageLabel") + imageLabel.Name = "Tail" + imageLabel.Size = UDim2.new(0,62,0,53) + imageLabel.Position = UDim2.new(1,8,0.25) + imageLabel.Image = "rbxasset://textures/chatBubble_botBlue_tailRight.png" + imageLabel.BackgroundTransparency = 1 + imageLabel.Parent = mainFrame + + for n, obj in pairs(choices) do + obj.Parent = mainFrame + end + lastChoice.Parent = mainFrame + + mainFrame.Parent = parent +end + +function presentDialogChoices(talkingPart, dialogChoices) + if not currentConversationDialog then + return + end + + currentConversationPartner = talkingPart + local sortedDialogChoices = {} + for n, obj in pairs(dialogChoices) do + if obj:IsA("DialogChoice") then + table.insert(sortedDialogChoices, obj) + end + end + table.sort(sortedDialogChoices, function(a,b) return a.Name < b.Name end) + + if #sortedDialogChoices == 0 then + normalEndDialog() + return + end + + local pos = 1 + local yPosition = 0 + choiceMap = {} + for n, obj in pairs(choices) do + obj.Visible = false + end + + for n, obj in pairs(sortedDialogChoices) do + if pos <= #choices then + --3 lines is the maximum, set it to that temporarily + choices[pos].Size = UDim2.new(1, 0, 0, 24*3) + choices[pos].UserPrompt.Text = obj.UserDialog + local height = math.ceil(choices[pos].UserPrompt.TextBounds.Y/24)*24 + + choices[pos].Position = UDim2.new(0, 0, 0, yPosition) + choices[pos].Size = UDim2.new(1, 0, 0, height) + choices[pos].Visible = true + + choiceMap[choices[pos]] = obj + + yPosition = yPosition + height + pos = pos + 1 + end + end + + lastChoice.Position = UDim2.new(0,0,0,yPosition) + lastChoice.Number.Text = pos .. ")" + + mainFrame.Size = UDim2.new(0, 350, 0, yPosition+24+32) + mainFrame.Position = UDim2.new(0,20,0.0, -mainFrame.Size.Y.Offset-20) + styleMainFrame(currentTone()) + mainFrame.Visible = true +end + +function doDialog(dialog) + while not Instance.Lock(dialog, player) do + wait() + end + + if dialog.InUse then + Instance.Unlock(dialog) + return + else + dialog.InUse = true + Instance.Unlock(dialog) + end + + currentConversationDialog = dialog + game.Chat:Chat(dialog.Parent, dialog.InitialPrompt, getChatColor(dialog.Tone)) + variableDelay(dialog.InitialPrompt) + + presentDialogChoices(dialog.Parent, dialog:GetChildren()) +end + +function renewKillswitch(dialog) + if currentAbortDialogScript then + currentAbortDialogScript:Remove() + currentAbortDialogScript = nil + end + + currentAbortDialogScript = timeoutScript:Clone() + currentAbortDialogScript.archivable = false + currentAbortDialogScript.Disabled = false + currentAbortDialogScript.Parent = dialog +end + +function checkForLeaveArea() + while currentConversationDialog do + if currentConversationDialog.Parent and (player:DistanceFromCharacter(currentConversationDialog.Parent.Position) >= currentConversationDialog.ConversationDistance) then + wanderDialog() + end + wait(1) + end +end + +function startDialog(dialog) + if dialog.Parent and dialog.Parent:IsA("BasePart") then + if player:DistanceFromCharacter(dialog.Parent.Position) >= dialog.ConversationDistance then + showMessage(tooFarAwayMessage, tooFarAwaySize) + return + end + + for dialog, gui in pairs(dialogMap) do + if dialog and gui then + gui.Enabled = false + end + end + + renewKillswitch(dialog) + + delay(1, checkForLeaveArea) + doDialog(dialog) + end +end + +function removeDialog(dialog) + if dialogMap[dialog] then + dialogMap[dialog]:Remove() + dialogMap[dialog] = nil + end + if dialogConnections[dialog] then + dialogConnections[dialog]:disconnect() + dialogConnections[dialog] = nil + end +end + +function addDialog(dialog) + if dialog.Parent then + if dialog.Parent:IsA("BasePart") then + local chatGui = chatNotificationGui:clone() + chatGui.Enabled = not dialog.InUse + chatGui.Adornee = dialog.Parent + chatGui.Parent = game.Players.LocalPlayer.PlayerGui + chatGui.Image.Button.MouseButton1Click:connect(function() startDialog(dialog) end) + setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone) + + dialogMap[dialog] = chatGui + + dialogConnections[dialog] = dialog.Changed:connect(function(prop) + if prop == "Parent" and dialog.Parent then + --This handles the reparenting case, seperate from removal case + removeDialog(dialog) + addDialog(dialog) + elseif prop == "InUse" then + chatGui.Enabled = not currentConversationDialog and not dialog.InUse + if dialog == currentConversationDialog then + timeoutDialog() + end + elseif prop == "Tone" or prop == "Purpose" then + setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone) + end + end) + else -- still need to listen to parent changes even if current parent is not a BasePart + dialogConnections[dialog] = dialog.Changed:connect(function(prop) + if prop == "Parent" and dialog.Parent then + --This handles the reparenting case, seperate from removal case + removeDialog(dialog) + addDialog(dialog) + end + end) + end + end +end + + +--[[function fetchScripts() + local model = game:GetService("InsertService"):LoadAsset(39226062) + if type(model) == "string" then -- load failed, lets try again + wait(0.1) + model = game:GetService("InsertService"):LoadAsset(39226062) + end + if type(model) == "string" then -- not going to work, lets bail + return + end + + waitForDialogChildrenMyLord(model,"TimeoutScript") + timeoutScript = model.TimeoutScript + waitForDialogChildrenMyLord(model,"ReenableDialogScript") + reenableDialogScript = model.ReenableDialogScript +end +]]-- + +function onLoad() + waitForProperty(game.Players, "LocalPlayer") + player = game.Players.LocalPlayer + waitForProperty(player, "Character") + + --print("Fetching Scripts") + --fetchScripts() + + --print("Creating Guis") + createChatNotificationGui() + + waitForFaker(bois,"Dialogs") + --print("Creating MessageDialog") + createMessageDialog() + messageDialog.Parent = game.Players.LocalPlayer.PlayerGui.Dialogs + + + --print("Initializing Frame") + local frame = Instance.new("Frame") + frame.Name = "DialogFrame" + frame.Position = UDim2.new(0,0,0,0) + frame.Size = UDim2.new(0,0,0,0) + frame.BackgroundTransparency = 1 + frame.Parent = game.Players.LocalPlayer.PlayerGui.Dialogs.ControlFrame.BottomLeftControl + initialize(frame) + + --print("Adding Dialogs") + game.CollectionService.ItemAdded:connect(function(obj) if obj:IsA("Dialog") then addDialog(obj) end end) + game.CollectionService.ItemRemoved:connect(function(obj) if obj:IsA("Dialog") then removeDialog(obj) end end) + for i, obj in pairs(game.CollectionService:GetCollection("Dialog")) do + if obj:IsA("Dialog") then + addDialog(obj) + end + end +end + +onLoad() + true + + + + + + Playerlist + true + + + + false + + Init + --fixed by Carrot#0559 --for non corescript use ---rbxsig%IEUAo3Q1k4Rwb3ZcqPBum//j3+Jm/9Nv0JyCeCRWUrggWps7aG81/aPzlH9pPlMkkdsZwLsCRu6eTTrqzXn2DAJNPRs7y8akc3z91r1DP3jwomfpdT+2DBAmPk3Cdj8NXQzP6T+uEYm2kk2TW9pXonKvCgRVqXFx8J7mTr+aM1M=% ---rbxassetid%45284430% local t = {} local function ScopedConnect(parentInstance, instance, event, signalFunc, syncFunc, removeFunc) @@ -4638,20 +5680,6 @@ local function rebuildBoard(owner, boardType, numStats) 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 - - if not smallPlayerList.Parent then return 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 @@ -6207,257 +7235,10 @@ else setupBuildToolManagement() end end) -end - - ----------------------------------- Start Player Hover Code ---------------------------------------- -if contextMenu3d then - local inMenu = false - - function waitForProperty(instance, name) - while not instance[name] do - instance.Changed:wait() - end - end - - function makeNewActionButton() - local button = Instance.new("TextButton") - button.Name = "ActionButton" - button.Style = Enum.ButtonStyle.RobloxButtonDefault - button.BackgroundColor3 = Color3.new(0,0,0) - button.BorderColor3 = Color3.new(1,0,0) - button.BackgroundTransparency = 0.5 - button.Size = UDim2.new(1,0,0,50) - button.Text = "" - button.Font = Enum.Font.ArialBold - button.FontSize = Enum.FontSize.Size18 - button.TextColor3 = Color3.new(1,1,1) - button.ZIndex = 4 - return button - end - - function getContextElements(currentContextMenuPlayer) - local elements = {} - for i, contextElement in ipairs(contextMenuElements) do - local element = contextElement - - 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 element.Type == "Button" then - local button = makeNewActionButton() - button.Name = "ContextButton" .. i - button.Visible = isVisible - button.Text = contextElement.Text - button.MouseButton1Click:connect(function() - if button.Active then - local success, result = pcall(function() element.DoIt(currentContextMenuPlayer) end) - end - end) - - contextElement.Button = button - contextElement.Element = button - - table.insert(elements,contextElement) - end - end - - return elements - end - - function findContextElement(contextElements, button) - for i = 1, #contextElements do - if contextElements[i].Button == button then - return contextElements[i] - end - end - end - - function populateActions(scrollFrame, nullFrame, recalcFunction, otherPlayer) - local elements = getContextElements(otherPlayer) - for i = 1, #elements do - if elements[i].Button.Visible then - elements[i].Button.Parent = scrollFrame - else - elements[i].Button.Parent = nullFrame - end - - local actionButtonCon - actionButtonCon = elements[i].Button.MouseButton1Click:connect(function() - actionButtonCon:disconnect() - - local nullFrameChildren = nullFrame:GetChildren() - for j = 1, #nullFrameChildren do - local contextElement = findContextElement(elements, nullFrameChildren[j]) - pcall(function() nullFrameChildren[j].Visible = contextElement.IsVisible(otherPlayer) end) - if nullFrameChildren[j].Visible then - nullFrameChildren[j].Parent = scrollFrame - end - end - - local scrollFrameChildren = scrollFrame:GetChildren() - for j = 1, #scrollFrameChildren do - local contextElement = findContextElement(elements, scrollFrameChildren[j]) - pcall(function() scrollFrameChildren[j].Visible = contextElement.IsVisible(otherPlayer) end) - if not scrollFrameChildren[j].Visible then - scrollFrameChildren[j].Parent = nullFrame - end - end - - elements[i].Button.Parent = nullFrame - recalcFunction() - end) - end - end - - - function createContextMenu(otherPlayer) - - local frame = Instance.new("Frame") - frame.Name = "ContextMenuFrame" - frame.Style = Enum.FrameStyle.RobloxRound - frame.Size = UDim2.new(0,300,0,400) - frame.Position = UDim2.new(0.5,-150,0.5,-200) - frame.ZIndex = 2 - - local scrollFrame, scrollUpButton, scrollDownButton, recalc, scrollBar = RbxGui.CreateScrollingFrame() - - scrollFrame.Name = "Actions" - scrollFrame.BackgroundTransparency = 1 - scrollFrame.Position = UDim2.new(0,0,0,25) - scrollFrame.Size = UDim2.new(1,-20,1,-80) - scrollFrame.ZIndex = 3 - scrollFrame.Parent = frame - - local nullFrame = Instance.new("Frame") - nullFrame.Name = "NullFrame" - nullFrame.BackgroundTransparency = 1 - nullFrame.Visible = false - nullFrame.Parent = frame - - local scrollButtons = Instance.new("Frame") - scrollButtons.Name = "ScrollButtons" - scrollButtons.BackgroundTransparency = 1 - scrollButtons.Position = UDim2.new(1,-17,0,25) - scrollButtons.Size = UDim2.new(0,17,1,-80) - scrollButtons.ZIndex = 3 - scrollButtons.Parent = frame - - scrollUpButton.ZIndex = 3 - scrollUpButton.Parent = scrollButtons - scrollDownButton.Position = UDim2.new(0,0,1,-17) - scrollDownButton.ZIndex = 3 - scrollDownButton.Parent = scrollButtons - - scrollBar.Size = UDim2.new(1,0,1,-34) - scrollBar.Position = UDim2.new(0,0,0,17) - scrollBar.Parent = scrollButtons - - local playerImage = Instance.new("ImageLabel") - playerImage.Name = "PlayerImage" - playerImage.BackgroundTransparency = 1 - playerImage.Image = "http://www.roblox.com/thumbs/avatar.ashx?userId=" .. tostring(otherPlayer.userId) .. "&x=352&y=352" - playerImage.Position = UDim2.new(0.5,-150,0.5,-150) - playerImage.Size = UDim2.new(0,300,0,300) - playerImage.Parent = frame - - local playerName = Instance.new("TextLabel") - playerName.Name = "PlayerName" - playerName.BackgroundTransparency = 1 - playerName.Font = Enum.Font.ArialBold - playerName.FontSize = Enum.FontSize.Size24 - playerName.Position = UDim2.new(0,-8,0,-6) - playerName.Size = UDim2.new(1,16,0,24) - playerName.Text = otherPlayer["Name"] - playerName.TextColor3 = Color3.new(1,1,1) - playerName.TextWrap = true - playerName.ZIndex = 3 - playerName.Parent = frame - - local doneButtonCon - - local doneButton = Instance.new("TextButton") - doneButton.Name = "DoneButton" - doneButton.Style = Enum.ButtonStyle.RobloxButton - doneButton.Font = Enum.Font.ArialBold - doneButton.FontSize = Enum.FontSize.Size36 - doneButton.Position = UDim2.new(0.25,0,1,-50) - doneButton.Size = UDim2.new(0.5,0,0,50) - doneButton.Text = "Done" - doneButton.TextColor3 = Color3.new(1,1,1) - doneButton.ZIndex = 3 - doneButton.Parent = frame - doneButton.Modal = true - doneButtonCon = doneButton.MouseButton1Click:connect(function() - doneButtonCon:disconnect() - inMenu = false - game.GuiService:RemoveCenterDialog(frame) - frame:remove() - end) - - populateActions(scrollFrame, nullFrame, recalc, otherPlayer) - recalc() - - return frame - end - - function makeContextInvisible(menu) - menu.Visible = false - end - - function goToContextMenu(otherPlayer) - - local menu = createContextMenu(otherPlayer) - - game.GuiService:AddCenterDialog(menu, Enum.CenterDialogType.PlayerInitiatedDialog, - --ShowFunction - function() - menu.Visible = true - menu:TweenSize(UDim2.new(0,300,0,400),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,0.5,true) - end, - --HideFunction - function() - menu:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,0.5,true,function() makeContextInvisible(menu) end) - end) - menu.Parent = game.CoreGui.RobloxGui - - inMenu = true - end - - waitForProperty(game.Players, "LocalPlayer") - - local currSelectedPlayer = nil - if game.Players.LocalPlayer["HoverOnPlayerChanged"] then - game.Players.LocalPlayer.HoverOnPlayerChanged:connect(function(otherPlayer) - if not inMenu then - if otherPlayer and otherPlayer.userId < 0 then return end -- we don't want this for guests - end - wait(0.5) - currSelectedPlayer = otherPlayer - end) - end - - if game.Players.LocalPlayer["MouseDownOnPlayer"] then - game.Players.LocalPlayer.MouseDownOnPlayer:connect(function(otherPlayer) - if currSelectedPlayer ~= otherPlayer then return end - if not inMenu and otherPlayer.userId > 0 then - goToContextMenu(otherPlayer) - end - end) - end -end ----------------------------------- End Player Hover Code ---------------------------------------- +end true - \ No newline at end of file +