Sorry if this title makes absolute so sense to you. I had no idea what to make it. So I made a handheld security scanner tool. When equipped, you can click any player and it shows you their username, acc age, role in group, and their tools. I want to make it so when you hover over the tool name, an x comes up. And when you click the x, it deletes the tool from their inventory, and from the gui. Here is my script:
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.Equipped:Connect(function()
Frame.Visible = true
Frame.Parent.Backround.Visible = true
end)
tool.Activated:Connect(function()
for _,Target in pairs(game.Players:GetPlayers()) do
if Mouse.Target:IsDescendantOf(Target.Character) then
Frame.AccAge.Text = Target.AccountAge
Frame.RoleInGroup.Text = Target:GetRoleInGroup(groupID)
Frame.AccName.Text = Target.Name
local ToolsInBackpack = Target.Backpack:GetChildren()
local listStr = ""
Frame.Tools.Text = ""
for i,v in pairs(ToolsInBackpack) do
if v:IsA("Tool") then
print(v.Name)
Frame.Tools.Text = Frame.Tools.Text..v.Name.."\n"
end
end
end
end
end)
-- Make sure they can't use the tool while it is not selected.
tool.Unequipped:Connect(function()
Frame.Visible = false
Frame.Parent.Backround.Visible = false
end)
Thanks for reading.