Advertisement
Star80

Roblox Player Viewer Script(Patch Made)

Mar 30th, 2023 (edited)
1,965
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.72 KB | Gaming | 0 0
  1. guiL = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  2.  
  3. for _,b in pairs(guiL:GetDescendants()) do
  4.         if b.Name == "Gui" and b.ClassName == "ScreenGui" then b:Destroy() end
  5.     end
  6.  
  7. function guimaker()
  8.     -- creates onscreen gui
  9.     local Gui = Instance.new("ScreenGui")
  10.     local Frame = Instance.new("Frame")
  11.     local Top = Instance.new("TextLabel")
  12.     local ScrollingFrame = Instance.new("ScrollingFrame")
  13.     local Frame_2 = Instance.new("Frame")
  14.     local SUser = Instance.new("Folder")
  15.     local TextButton = Instance.new("TextButton")
  16.     local TextBox = Instance.new("TextBox")
  17.     local SItem = Instance.new("Folder")
  18.     local TextButton_2 = Instance.new("TextButton")
  19.     local TextBox_2 = Instance.new("TextBox")
  20.  
  21.  
  22.     Gui.Name = "Gui"
  23.     Gui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  24.     Gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  25.     Gui.DisplayOrder = 999999999
  26.  
  27.     Frame.Parent = Gui
  28.     Frame.Active = true
  29.     Frame.BackgroundColor3 = Color3.fromRGB(122, 122, 122)
  30.     Frame.BorderColor3 = Color3.fromRGB(100, 100, 100)
  31.     Frame.BorderSizePixel = 2
  32.     Frame.Position = UDim2.new(1, -200, 1, -100)
  33.     Frame.Size = UDim2.new(0, 200, 0, 100)
  34.  
  35.     Top.Name = "Top"
  36.     Top.Parent = Frame
  37.     Top.BackgroundColor3 = Color3.fromRGB(167, 167, 167)
  38.     Top.BackgroundTransparency = 0.200
  39.     Top.BorderColor3 = Color3.fromRGB(100, 100, 100)
  40.     Top.BorderSizePixel = 2
  41.     Top.Size = UDim2.new(1, 1, 0, 22)
  42.     Top.SizeConstraint = Enum.SizeConstraint.RelativeXX
  43.     Top.ZIndex = 999999999
  44.     Top.Font = Enum.Font.SciFi
  45.     Top.Text = "PlayerViewer - LocatePlayer"
  46.     Top.TextColor3 = Color3.fromRGB(0, 0, 0)
  47.     Top.TextSize = 14.000
  48.  
  49.     ScrollingFrame.Parent = Frame
  50.     ScrollingFrame.Active = true
  51.     ScrollingFrame.BackgroundColor3 = Color3.fromRGB(122, 122, 122)
  52.     ScrollingFrame.BorderColor3 = Color3.fromRGB(100, 100, 100)
  53.     ScrollingFrame.BorderSizePixel = 2
  54.     ScrollingFrame.Position = UDim2.new(0, 0, 0, 22)
  55.     ScrollingFrame.Size = UDim2.new(1, 1, 0.779999971, 1)
  56.  
  57.     Frame_2.Parent = ScrollingFrame
  58.     Frame_2.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  59.     Frame_2.BackgroundTransparency = 1.000
  60.     Frame_2.BorderSizePixel = 0
  61.     Frame_2.Size = UDim2.new(0.930000007, 1, 1, 1)
  62.  
  63.     SUser.Name = "SUser"
  64.     SUser.Parent = Frame_2
  65.  
  66.     TextButton.Parent = SUser
  67.     TextButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  68.     TextButton.Position = UDim2.new(0, 0, 0, 35)
  69.     TextButton.Size = UDim2.new(0.474999994, 1, 0, 22)
  70.     TextButton.Font = Enum.Font.Ubuntu
  71.     TextButton.Text = "Locate"
  72.     TextButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  73.     TextButton.TextScaled = true
  74.     TextButton.TextSize = 14.000
  75.     TextButton.TextWrapped = true
  76.  
  77.     TextBox.Parent = SUser
  78.     TextBox.BackgroundColor3 = Color3.fromRGB(67, 67, 67)
  79.     TextBox.BackgroundTransparency = 0.200
  80.     TextBox.BorderColor3 = Color3.fromRGB(100, 100, 100)
  81.     TextBox.BorderSizePixel = 2
  82.     TextBox.Position = UDim2.new(0, 0, 0, 5)
  83.     TextBox.Size = UDim2.new(0.474999994, 1, 0, 22)
  84.     TextBox.Font = Enum.Font.Ubuntu
  85.     TextBox.PlaceholderText = "Insert Player Username Here..."
  86.     TextBox.Text = ""
  87.     TextBox.TextColor3 = Color3.fromRGB(0, 0, 0)
  88.     TextBox.TextScaled = true
  89.     TextBox.TextSize = 14.000
  90.     TextBox.TextWrapped = true
  91.  
  92.     SItem.Name = "SItem"
  93.     SItem.Parent = Frame_2
  94.  
  95.     TextButton_2.Parent = SItem
  96.     TextButton_2.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  97.     TextButton_2.Position = UDim2.new(1, 0, 0, 35)
  98.     TextButton_2.Size = UDim2.new(-0.474999994, 1, 0, 22)
  99.     TextButton_2.Font = Enum.Font.Ubuntu
  100.     TextButton_2.Text = "Locate"
  101.     TextButton_2.TextColor3 = Color3.fromRGB(255, 255, 255)
  102.     TextButton_2.TextScaled = true
  103.     TextButton_2.TextSize = 14.000
  104.     TextButton_2.TextWrapped = true
  105.  
  106.     TextBox_2.Parent = SItem
  107.     TextBox_2.BackgroundColor3 = Color3.fromRGB(67, 67, 67)
  108.     TextBox_2.BackgroundTransparency = 0.200
  109.     TextBox_2.BorderColor3 = Color3.fromRGB(100, 100, 100)
  110.     TextBox_2.BorderSizePixel = 2
  111.     TextBox_2.Position = UDim2.new(1, 0, 0, 5)
  112.     TextBox_2.Size = UDim2.new(-0.474999994, 1, 0, 22)
  113.     TextBox_2.Font = Enum.Font.Ubuntu
  114.     TextBox_2.PlaceholderText = "Insert Player Item Here...(MAY LAG)"
  115.     TextBox_2.Text = ""
  116.     TextBox_2.TextColor3 = Color3.fromRGB(0, 0, 0)
  117.     TextBox_2.TextScaled = true
  118.     TextBox_2.TextSize = 14.000
  119.     TextBox_2.TextWrapped = true
  120. end
  121.  
  122.  
  123. guimaker()
  124. sgui = guiL:WaitForChild("Gui").Frame.ScrollingFrame.Frame
  125. suser = sgui.SUser
  126. sitm = sgui.SItem
  127.  
  128. function FindPlayer(String)
  129.     bool = false
  130.     user = nil
  131.     for _,p in pairs(game:GetService("Players"):GetChildren()) do
  132.         if (string.sub(string.lower(p.Name),1,string.len(String))) == string.lower(String) and String ~= "" then
  133.             bool = true
  134.             user = p
  135.             return user, bool
  136.         end
  137.     end
  138.     return user, bool
  139. end
  140.  
  141. function FindItem(String)
  142.     bool = false
  143.     item = nil
  144.     for _,p in pairs(game:GetService("Players"):GetChildren()) do
  145.         for _,i in pairs(p.Backpack:GetChildren()) do
  146.             if (string.sub(string.lower(i.Name),1,string.len(String))) == string.lower(String) and String ~= ""  then
  147.                 bool = true
  148.                 item = p
  149.                 return item, bool
  150.             end
  151.         end
  152.     end
  153.     if item == nil then
  154.         for _,p in pairs(game.Players:GetChildren()) do
  155.             if p.Character:FindFirstChildOfClass("Tool", true) then
  156.                 i = p.Character:FindFirstChildOfClass("Tool", true)
  157.                 if (string.sub(string.lower(i.Name),1,string.len(String))) == string.lower(String) and String ~= ""  then
  158.                     bool = true
  159.                     item = p
  160.                     print(item)
  161.                     return item, bool
  162.                 end
  163.             end
  164.         end
  165.     end
  166.     return item, bool
  167. end
  168. function sPlayerc()
  169.     FindPlayer(tostring(suser.TextBox.Text))
  170.     if bool then
  171.         PlayerToLocate = user
  172.         suser.TextButton.Text = "Found!"
  173.         task.wait(1)
  174.         suser.TextButton.Text = "Locate Player"
  175.     else
  176.         PlayerToLocate = ""
  177.         suser.TextButton.Text = "Not Found."
  178.         task.wait(1)
  179.         suser.TextButton.Text = "Locate Player"
  180.     end
  181.     return PlayerToLocate
  182. end
  183.  
  184. function sItemc()
  185.     FindItem(tostring(sitm.TextBox.Text))
  186.     if bool then
  187.         PlayerToLocate = item
  188.         sitm.TextButton.Text = "Found!"
  189.         task.wait(1)
  190.         sitm.TextButton.Text = "Locate Item"
  191.     else
  192.         PlayerToLocate = ""
  193.         sitm.TextButton.Text = "Not Found."
  194.         task.wait(1)
  195.         sitm.TextButton.Text = "Locate Item"
  196.     end
  197.     return PlayerToLocate
  198. end
  199.  
  200.  
  201.  
  202. function createDis(attatchment, name, display, health, l, h, color) -- creates UI for username
  203.     local bill = Instance.new("BillboardGui")
  204.     local button1 = Instance.new("TextButton")
  205.  
  206.  
  207.     bill.Parent = guiL
  208.     bill.Adornee = attatchment
  209.     bill.AlwaysOnTop = true
  210.     bill.Size = UDim2.new(l, 0, h, 0)
  211.     bill.StudsOffset = Vector3.new( -((l / 2) - 0.75), 3, 0)
  212.     bill.Name = "HarkzGUI"
  213.     bill.Active = true
  214.  
  215.  
  216.     button1.Parent = bill
  217.     button1.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  218.     button1.BackgroundTransparency = 0.2
  219.     button1.BorderColor3 = color
  220.     button1.BorderSizePixel = 3
  221.     button1.BorderMode = Enum.BorderMode.Inset
  222.     button1.Size = UDim2.new(l/2, 0, h/2, 0)
  223.     button1.TextColor3 = color
  224.     button1.TextScaled = true
  225.     button1.TextSize = 14
  226.     button1.TextWrapped = true
  227.     button1.Font = Enum.Font.Ubuntu
  228.  
  229.     button1.Text = "@"..name..", "..display.." Health: "..health
  230. end
  231.  
  232. function createArrow(attatchment, color)
  233.     local bill = Instance.new("BillboardGui")
  234.     local img = Instance.new("ImageLabel")
  235.  
  236.     bill.Parent = guiL
  237.     bill.Parent = guiL
  238.     bill.Adornee = attatchment
  239.     bill.AlwaysOnTop = true
  240.     bill.Size = UDim2.new(2, 0, 1, 0)
  241.     bill.StudsOffset = Vector3.new(0, 2.12, 0)
  242.     bill.Name = "harkarrow"
  243.     bill.Active = true
  244.  
  245.     img.Parent = bill
  246.     img.BackgroundTransparency = 1
  247.     img.Image = "rbxassetid://12930275268"
  248.     img.ImageColor3 = color
  249.     img.Size = UDim2.new(1,0, 1,0)
  250.     img.Active = true
  251.     img.ImageTransparency = 0.2
  252. end
  253.  
  254. function createItem(attatchment, item, color, x, y) -- creates UI for Tools
  255.     local bill = Instance.new("BillboardGui")
  256.     local button2 = Instance.new("TextButton")
  257.  
  258.  
  259.     bill.Parent = guiL
  260.     bill.Adornee = attatchment
  261.     bill.AlwaysOnTop = true
  262.     bill.Size = UDim2.new(2, 0, 2, 0)
  263.     bill.StudsOffset = Vector3.new(x, y, 0)
  264.     bill.Name = "HarkzGUI"
  265.     bill.Active = true
  266.  
  267.  
  268.     button2.Parent = bill
  269.     button2.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  270.     button2.BackgroundTransparency = 0.200
  271.     button2.BorderColor3 = color
  272.     button2.BorderSizePixel = 3
  273.     button2.BorderMode = Enum.BorderMode.Inset
  274.     button2.Size = UDim2.new(1, 0, 1, 0)
  275.     button2.TextColor3 = color
  276.     button2.TextScaled = true
  277.     button2.TextSize = 14
  278.     button2.TextWrapped = true
  279.     button2.Font = Enum.Font.Ubuntu
  280.  
  281.     button2.Text = tostring(item)
  282. end
  283.  
  284.  
  285. while wait() do -- loop
  286.     if not guiL:FindFirstChild("Gui") then
  287.         guimaker()
  288.         sgui = guiL:WaitForChild("Gui").Frame
  289.     end
  290.  
  291.     if guiL:FindFirstChild("Gui") then
  292.         suser.TextButton.MouseButton1Click:Connect(sPlayerc)
  293.         sitm.TextButton.MouseButton1Click:Connect(sItemc)
  294.     end
  295.  
  296.     for _,b in pairs(guiL:GetDescendants()) do
  297.         if b.Name == "HarkzGUI" or b.Name == "harkarrow" or b.Name == "Gui" and b.ClassName == "BillboardGui" then b:Destroy() end
  298.     end
  299.  
  300.     for _,p in pairs(game.Players:GetChildren()) do
  301.         if p.ClassName == "Player" then
  302.             if workspace:WaitForChild(p.Name) then
  303.                 character = workspace:WaitForChild(p.Name)
  304.             end
  305.             if character:FindFirstChild("Humanoid") then
  306.  
  307.                 if character:FindFirstChild("Head") then
  308.                     health = character.Humanoid.Health
  309.                     mhealth = character.Humanoid.MaxHealth
  310.  
  311.                     percent = math.floor((health / mhealth) * 100)
  312.                     if percent >= 75 then -- this part was written by the ai and i loved it so much that i kept it
  313.                         color = Color3.fromRGB(0,255,0)
  314.                     elseif percent < 75 and percent > 25 then
  315.                         color = Color3.fromRGB(255,255,0)
  316.                     else
  317.                         color = Color3.fromRGB(255,0,0)
  318.                     end
  319.  
  320.                     head = character.Head
  321.  
  322.                     createDis(head, p.Name, p.DisplayName, character.Humanoid.Health, 3, 1.5, (color))
  323.                     if p.Name == tostring(PlayerToLocate) then
  324.                         if character:FindFirstChild("Head") then
  325.                             createArrow(head, color)
  326.                         end
  327.                     end
  328.                 end
  329.  
  330.                 q = false
  331.                 offset = 1.25
  332.                 for n in pairs(p.Backpack:GetChildren()) do offset -= 1.25 q = true end
  333.  
  334.  
  335.                 for _,i in pairs(p.Backpack:GetChildren()) do
  336.                     if character:FindFirstChild("Head") then
  337.                         if i.ClassName == "Tool" then
  338.                             createItem(head, i.Name, Color3.fromRGB(100,100,100), offset, 5)
  339.                         else
  340.                             createItem(head, i.Name.." [, isA '"..i.ClassName.."']", Color3.new(0.8, 0.25,0.25), offset, 5)
  341.                         end
  342.  
  343.                     end
  344.                     offset += 2.5
  345.                 end
  346.  
  347.                 offset = 1.25
  348.                 for _,n in pairs(character:GetDescendants()) do if n.ClassName == "Tool" then offset -= 1.25 end end
  349.  
  350.                 for _,i in pairs(character:GetDescendants()) do
  351.                     if character:FindFirstChild("Head", true) then
  352.                         if i.ClassName == "Tool" then
  353.                             if q then
  354.                                 createItem(head, i.Name, Color3.fromRGB(10,255,5), offset, 7.5)
  355.                                 offset += 2.5
  356.                             else
  357.                                 createItem(head, i.Name, Color3.fromRGB(10,255,5), offset, 5)
  358.                                 offset += 2.5
  359.                             end
  360.                         end
  361.  
  362.                     end
  363.                 end
  364.  
  365.             end
  366.         end
  367.     end
  368. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement