Security Scanner

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?

I tested the thing out with my alt and when I clicked my alt it wouldn’t work. FYI: I only used the local script info. Do I need to add anything else?

Yeah, it does not work when you click on a person when you equip the tool.