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.
tool.Activated:Connect(function()
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
wait(3)
Frame.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)
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.
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.
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.
end
end
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