Security Scanner Help

This is my script so far:

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

local tool = script.Parent

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


tool.Activated:Connect(function()
	for _,Target in pairs(game.Players:GetPlayers()) do
		if Mouse.Target:IsDescendantOf(Target.Character) then
			Frame.Visible = true
			Frame.Parent.Backround.Visible = true
			Frame.AccAge.Text = Target.AccountAge
			Frame.RoleInGroup.Text = Target:GetRoleInGroup(groupID)
			Frame.AccName.Text = Target.Name
			local Player = Player:GetPlayerFromCharacter(Target)
			local ToolsInBackpack = Player.Backpack:GetChildren()
			
			for i,v in pairs(ToolsInBackpack) do
				if v:IsA("Tool")then
					print(v.Name)
				end
			end
			Frame.Tools.Text = v.Name
			wait(3)
			
			Frame.Visible = false
			Frame.Parent.Backround.Visible = false
		end
	end
end)



-- Make sure they can't use the tool while it is not selected.
tool.Unequipped:Connect(function()
	Frame.Visible = false
end)

Yes, so you can do Player.Backpack:GetChildren()

There is a blue line under v:

Frame.Tools.Text = v.Name

Is that line inside of the for loop i told you to add?

Oh, no. Sorry!!!

You need to put it inside of the ToolsInBackpack loop.

I just tested it.
Error: GetPlayerFromCharacter is not a valid member if Player

You have to do

game:GetService(“Players”):GetPlayerFromCharacter(Target)

You can’t do GetPlayerFromCharacter from the LocalPlayer object.

So do I replace the player variable with that?

Uh, how you will use :GetPlayerFromCharacter() without the player’s character?

Also, from what i noticed, you made 2 variables called “Player”, meaning the script will give you 2 options to identify what “Player” is.

1 Like

Can you fix the script to make it work?

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

local tool = script.Parent

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


tool.Activated:Connect(function()
	for _,Target in ipairs(game.Players:GetPlayers()) do
		if Mouse.Target:IsDescendantOf(Target.Character) then
			Frame.Visible = true
			Frame.Parent.Backround.Visible = true
			Frame.AccAge.Text = tostring(Target.AccountAge)
			Frame.RoleInGroup.Text = tostring(Target:GetRoleInGroup(groupID))
			Frame.AccName.Text = Target.Name
			local ToolsInBackpack = Target.Backpack:GetChildren()
			
			for i,v in ipairs(ToolsInBackpack) do
				if v:IsA("Tool") then 
					print(v.Name)
                    Frame.Tools.Text = v.Name
				end
			end
			
			wait(3)
			
			Frame.Visible = false
			Frame.Parent.Backround.Visible = false
		end
	end
end)



-- Make sure they can't use the tool while it is not selected.
tool.Unequipped:Connect(function()
	Frame.Visible = false
end)

This is the only thing i can think of right now, i hope it works…

Doesn’t work. No errors. :confused:

Can you show us the explorer? 30char

Can you help me? 30 charrrrrrrr

Aight, i removed it, tell me if it works.

I don’t want it so it just shows players inventories that have two items.

Doesn’t work :confused: 30 charrrrsss