What do you want to achieve? I want to make a security scanner that when you click a person, a frame pops up and it has info such as their account age, their rank in the group, and their tools.
What is the issue? I do not know how to make that exactly.
What solutions have you tried so far? YouTube Videos.
I don’t need you guys to give me a script, that is not what I am asking for (though if you want to you can). I want to know HOW to do it. Give me some examples and/or systems to help me through the process.
To do this, you will need a few things, first off you’ll need a user interface, a click detector of some sort, and then finally the player age and group information.
For the user interface, the easiest way to make something “pop up” is by just setting the frame visible.
frame.Visible = true
Next, I would make a click detector for each player, the easiest way to do this would probably be to add a click detector in every part of the player, so no matter where the player is clicked, the function fires. Something like this would work.
for i,v in pairs(game.Players:GetChildren()) do
if v.Character then
for i, m in pairs(v.Character:GetDescendants()) do
if m:IsA("BasePart") then
local cd = Instance.new("ClickDetector", m)
cd.MouseClick:connect(function() onClick(v) end)
end
end
end
end
Now, you will need the function to actually do what you want. Something like this should work:
function onClick(v)
frame.Visible = true
frame.PlayerAge.Text = v.AccountAge
frame.GroupRank.Text = v:GetRoleInGroup(groupID)
end
That’s the basic framework you will need to be able to make your security scanner.
EDIT: To view the players tools, you can just add another loop sorting through the players backpack.
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)