Sorry I constantly keep making posts. I am trying to make a GUI where you click a player on the player lists and it returns information about them. However I am struggling with what to write to get the player that you want information to be displayed about, Due to my lack of scripting knowledge some of my attempts are fairly mediocre I have tried to get the player by doing NewPlayer = Button.Name. I am oblivious to any other ways of doing this so if you can help I’d be very much appreciative. Here is my script so far. Feel free to correct any errors I have made.
for _,GetPlayers in pairs(Playerlist.ScrollingFrame:GetChildren()) do
if GetPlayers:IsA("TextButton") then
function OnButtonClicked()
for _,NewPlayer in pairs(Players:GetPlayers()) do
local Information = ModerateFrame.Information
ModerateFrame.Notice:Destroy()
Information.Visible = true
Information.Header.Text = "Information on "..NewPlayer
Information.Rank.Text = NewPlayer:GetRoleInGroup(ServerGroupID)
Information.Username.Text = NewPlayer.Name
Information.UserID.Text = NewPlayer.UserId
Information.Avatar.Image = Players:GetUserThumbnailAsync(NewPlayer.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
end
end
GetPlayers.MouseButton1Click:Connect(OnButtonClicked)
end
end
it returns an error “attempt to concatenate string with Instance” I know this is the case because I have said which player but that is the exact point I am struggling with.