Hiya, I’ve hit a dead-end in one of my scripts. I am trying to make a player info section where you click the player on a custom playerlist and it displays information about them. However, I am unsure how to write it. Here are my scripts for reference. I do not want you to write a script for me, just guidance as I want to create the script myself.
function LoadList()
for _,FindPlayerWhenLeft in pairs(Playerlist.ScrollingFrame:GetChildren()) do
if FindPlayerWhenLeft.Name == "User" then
FindPlayerWhenLeft:Destroy()
end
end
for _,Player in pairs(game.Players:GetPlayers()) do
local NewPlayer = Templates.User:Clone()
NewPlayer.Visible = true
NewPlayer.Text = Player.Name
NewPlayer.Parent = Playerlist.ScrollingFrame
end
end
Players.PlayerAdded:Connect(LoadList)
Players.PlayerRemoving:Connect(LoadList)
LoadList()
function OnPlayerClicked()
for _,FindPlayer in pairs(Playerlist.ScrollingFrame:GetChildren()) do
if FindPlayer.Name == "User" then
-- Stuck what to write here
end
end
end
if you have a template for the players information you’re requesting, you could enable it after they click, what player it is, tween the gui nice n smooth, and input the information of the player in there probably would be my guess, replacing text labels and things within the script, im not too sure exactly what type of information of the player you’re looking for but thats where i’d start i guess
For information I want It’s just simple stuff like the players rank, Id, Name and avatar. My main point sorry if it wasn’t clear I was just unsure how I am suppose to get the players information through a textbutton
oh okay, so, with the text button, you could check if the users name exists, which i think you’ve done there, find it within the player list, grab their playerid in Players, for the name u can kinda just copy from the findplayer loop, or the textbutton itself alternatively, given its already preloaded in there for you when u start and probably would be more reliable. im not sure about rank though, i havent been in groups long enough to remember but im sure you could find it somewhere (i think u can use GetRankInGroup with a changing variable to determine this?), although the avatar is a little tricky, you could get a headshot photo of some kind and plaster it on there as well. hopefully it makes sense! my brain goes all over
hopefully i answered your question well enough, if i didnt thats okay, glad to help anyway! im a little new to scripting myself so pseudocode is kinda my go to rn lol, hopefully you figure it out and all goes well, best of luck!