Security Scanner Help

I am currently making a security scanner that tells the name, tools, account age, and role in the group. I got the account age and role in group to work fine but I am having issues with the tools in the players backpack and their name.
Here is the script:

local Mouse = Player:GetMouse()

local tool = script.Parent

local Frame = game.Players.LocalPlayer.PlayerGui:WaitForChild('ScreenGui'):WaitForChild('Frame') --Object path to the GUI frame containing the age and rank textboxes.
local groupID = 4796549 --ID of your group.

	for _,Target in pairs(game.Players:GetPlayers()) do
		if Mouse.Target:IsDescendantOf(Target.Character) then
			Frame.Visible = true
			Frame.AccAge.Text = Target.AccountAge
			Frame.RoleInGroup.Text = Target:GetRoleInGroup(groupID)
			Frame.Loop.Text = Target.Name
			Frame.Visible = false

-- Make sure they can't use the tool while it is not selected.
	Frame.Visible = false

Maybe because you haven’t called it in your script yet.

Because this looks like a LocalScript, I’m going to go off that assumption.

You can try to call Players:GetPlayerFromCharacter(Mouse.Target.Parent). (I’m not too good with ClientSide functions). The target wouldn’t be the player’s Player Model, instead it would be a limb, such as an arm or leg. So you need to get the parent, and just to be safe I would go with that code sample I provided in case the player’s Player Model name has changed.

That part

Frame.Loop.Text = Target.Name

It is that part. Sorry.

I’ve edited my post, in case you haven’t seen it already. You replied while I was editing and I didn’t notice.

Where would I put the code? Would I replace the Frame.Loop.Text = Target.Name part with that?

Wherever you are trying to identify the player/player name, that’s where that code sample should go.

I replaced it with this
Player:GetPlayerFromCharacter(Mouse.Target.Parent) = Frame.Loop.Text
But there is an error under the equal sign

It shouldn’t be Player:GetPlayerFromCharacter(Mouse.Target.Parent) = Frame.Loop.Text, try

local PlayerOfvisible = game:GetService("Players"):GetPlayerFromCharacter(Mouse.Target.Parent)

What you’re doing with Player:GetPlayerFromCharacter(Mouse.Target.Parent) is trying to call the Player object, but you should be calling the game.Players object.

Right what you’re doing here is you’re setting the player as whatever the text is, you need to invert it so the text is whatever the player’s name is.

Edit: You also need to add a .Name at the end to make it a string.

Edit Edit:


Frame.Loop.Text = game:GetService("Players"):GetPlayerFromCharacter(Mouse.Target.Parent).Name
1 Like

Doesn’t work. There are no errors but it still doesn’t work.

I got the name thing to work. Now I have another question, when you click the player I want it to show all of their tools in a list, how do I do that?

You do :GetPlayerFromCharacter(), as you did, then you’d do .Backpack. For example:

local Player = game:GetService('Players'):GetPlayerFromCharacter(Mouse.Hit)
local ToolsInBackpack = Player.Backpack:GetChildren() 

for i,v in pairs(ToolsInBackpack) do
   if v:IsA("Tool")
     print(v.Name) --Would go through and print the names of EVERY **tool** in the backpack, you could then display the v.Name onto a textlabel inside a GUI, cloning the textlabel for each item.

I want the a text label of a gui to be turned to a list of the tools.

Then you’d simply do:

TextLabel.Text = v.Name

TextLabel is the textlabel you want to display the tools name, and this HAS to be inside of the for loop. However, it will only be able to display 1 tools name at a time, so I suggest making a frame and then just cloning a TextLabel, parenting it to the frame, and then changing the text to v.Name

Oh I forgot to tell you. I got the Name thing to work by just doing

Frame.AccName.Text = Target.Name

Oh great! Then that means when defining player you could just do Players:GetPlayerFromCharacter(Target)

So should I change the player variable to that?

Well what is the Player variable currently?

local Player = game.Players.LocalPlayer