Security Scanner

  1. What do you want to achieve? I want to make a security scanner that when you click a person, a frame pops up and it has info such as their account age, their rank in the group, and their tools.

  2. What is the issue? I do not know how to make that exactly.

  3. What solutions have you tried so far? YouTube Videos.

I don’t need you guys to give me a script, that is not what I am asking for (though if you want to you can). I want to know HOW to do it. Give me some examples and/or systems to help me through the process.

1 Like

To do this, you will need a few things, first off you’ll need a user interface, a click detector of some sort, and then finally the player age and group information.

For the user interface, the easiest way to make something “pop up” is by just setting the frame visible.

frame.Visible = true

Next, I would make a click detector for each player, the easiest way to do this would probably be to add a click detector in every part of the player, so no matter where the player is clicked, the function fires. Something like this would work.

for i,v in pairs(game.Players:GetChildren()) do
    if v.Character then
        for i, m in pairs(v.Character:GetDescendants()) do
            if m:IsA("BasePart") then
                local cd = Instance.new("ClickDetector", m)
                cd.MouseClick:connect(function() onClick(v) end)
            end
        end
    end
end

Now, you will need the function to actually do what you want. Something like this should work:

function onClick(v)
    frame.Visible = true
    frame.PlayerAge.Text = v.AccountAge
    frame.GroupRank.Text = v:GetRoleInGroup(groupID)
end

That’s the basic framework you will need to be able to make your security scanner.

EDIT: To view the players tools, you can just add another loop sorting through the players backpack.

2 Likes

Actually just putting a click detector on a model will make the whole thing clickable.

Was unaware of that, good to know! Thanks.

Wouldn’t it be easier to use mouse input instead of click detectors since this is being done with a tool?

2 Likes

Does this work if you just simply click the player?

It’s "GetRoleInGroup(groupID), GetRankInGroup will show the rankID, not the rank name, instead of GetRoleInGroup.

I believe what he stated as “rank” was supposed to be “role” to show the string value.

In regards to find someones group role (rank is regarding the number):
https://developer.roblox.com/en-us/api-reference/function/Player/GetRoleInGroup

In @New_Item example, you just have to switch:

Before:    
frame.GroupRank.Text = v:GetRankInGroup(groupID)

After:
frame.GroupRank.Text = v:GetRoleInGroup(groupID)

So what about getting their tools and account age?

Yes. The old mouse object has a Button1Down event and you can get a clicked-on part with the Target property, and find the player from there.

The account age was in @New_Item 's example.

Review the function onClick(v). v stands for the player and it is grabbing the players account age as well as other info.

You guys are too smart. Im having trouble following. lol

First Question: Where do I put the script and what type of script?
Second Question: How do I make it so you can simply click any player if you have the security scanner equipped?

You would have something like this in a localscript inside the scanner tool.

local tool = script.Parent

local frame = --Object path to the GUI frame containing the age and rank textboxes.
local groupID = --ID of your group.

local playerMouse = nil
local clickConnection = nil

-- The player mouse is passed in as a parameter of the Equipped event.
tool.Equipped:Connect(function(mouse)
	playerMouse = mouse
	clickConnection = playerMouse.Button1Down:Connect(function()
		if (playerMouse.Target and playerMouse.Target.Parent) then
			local player = game:GetService("Players"):GetPlayerFromCharacter(playerMouse.Target.Parent)
			if (player) then
				frame.Visible = true
				frame.PlayerAge.Text = player.AccountAge
				frame.GroupRank.Text = player:GetRoleInGroup(groupID)
			end
		end
	end)
end))

-- Make sure they can't use the tool while it is not selected.
tool.Unequipped:Connect(function()
	frame.Visible = true
	if (clickConnection) then
		clickConnection:Disconnect()
		clickConnection = nil
	end
	playerMouse = nil
end)

How do I do the tools thing? Im not sure how to do it.

Use a loop similar to this one.

for i,v in pairs(player.Backpack:GetChildren()) do
-- do whatever you want to with their items here
end

I want it to say what items are in their inventory

Try this.

for i,v in pairs(player.Backpack:GetChildren()) do
    frame.Text = frame.Text..','..v.Name
end

That would show a list of all of the players items.

Building off what @New_Item said:

local text = ""
for _, tool in ipairs(player.Backpack:GetChildren()) do
	text = text..(tool.Name).."\n"
end
frame.ToolList.Text = text

“\n” can be replaced with ", " if you would rather have it on one line.

Are there any changes I need to make to your first script? I tested it out with my alt and nothing would click. Do I need to change anything?