So, I was planning my game to have the ability to join the player's friends in different games outside of my game. So if the player wants to know which his/her friends are playing. He will type a TextBox and teleports him/her to his/her friends. I found something on the Developer Roblox website.
And yes, I succeed when I printed the table. But then when I tried putting it on the Text, there is something wrong... It returns only a single friend of my own.
local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait() local dict = player:GetFriendsOnline(10) while true do wait() for i, friend in pairs(dict) do local number = #dict script.Parent.TextLabel.Text = "Friends Online ("..number.."):" script.Parent.Text = friend.UserName.." ("..friend.LastLocation..")" end end
I looped it so when a friend is no longer playing, it updates.