Here in the script, when I click on a player the TextLabel and Image becomes a value of the leaderstats, but the problem is that the local hum = target.Parent is looking for the player in the game.workspace, how do I get the local hum = target.Parent to go to game.Players?
Is that leaderstats are in game.Players and not game.workspace
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local sc = script.Parent.Holder
local selection = Instance.new("SelectionBox")
selection.Color3 = Color3.fromRGB(255, 0, 0)
selection.Parent = script
mouse.Button2Down:connect(function()
local target = mouse.Target
if not target then
selection.Adornee = nil
else
local hum = target
if hum ~= nil then
sc.Player.Image = "https://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&userId="..hum.UserId --PlayerID
sc.Attack.Text = "Attack: "..hum.leaderstats.Attack.Value --leaderstats
sc.Agility.Text = "Agility: "..hum.leaderstats.Aggility.Value --leaderstats
sc.Defense.Text = "Defense: "..hum.leaderstats.Defense.Value --leaderstats
sc.Ki.Text = "Ki: "..hum.leaderstats.Energy.Value --leaderstats
sc.Username.Text = ""..hum.Name --PlayerName
end
end
end)
Error line 16 userid is not a valid member of part

5 comments
try mouse.Button2Down:connect(function(target) target = mouse.Target
Also it should just be hum = target not target.Parent, target.Parent will give you the humaniod, target gives you the Player in Players
if sc is the leaderstats then it should be sc.Parent = target and sc.Name needs to = "leaderstats" if your trying to use the game's default leaderstats.
@KenUSM Button2Down does not pass anything, don't give OP false information.
I've done everything I say but the error on line 15 -- userid is not a valid member of part