Roblox Api How to get where is LastLocation?

I using nodejs https and I tried /onlinestatus/ but thats not correct, when I am on game, GameId always null
but this should “Game Name”

how I can fix this?

1 Like
local players = game:GetService("Players")

players.PlayerAdded:Connect(function(player)
	local onlineFriends = player:GetFriendsOnline()
	for i, friend in pairs(onlineFriends) do
		print(friend.UserName, friend.LastLocation)
	end
end)

Like this.

You need to make sure you either have your user presence visible to Everyone or add authentication of an account that has permission to see your user presence (e.g. friends) in your request headers.

1 Like

Please read closer. They said:

how I can do? if you know can you make code example?

This is probably the long way to do it but oh well:

You can set up a simple hello-express website running on a low-profile server (i.e. Log In - Replit) and maintain it with services like https://uptimerobot.com/. Once you get the link where you can make HTTP requests from, use that to return a JSON table of the online friends of each player and decode it in Studio to use it as your advantage.

Knowledge of JavaScript is required as well.
Please see https://noblox.js.org/, (noblox.js Global) the library I recommend you use for achieving that. Installing can be done via npm install noblox.js on the terminal.

But I use nodejs , not Roblox Studio

1 Like

If you aren’t using Studio, you can ask in the noblox.js Discord server, you will get much more help.

1 Like

thanks!
and I found how I can:
https://noblox.js.org/global.html#getPresences
https://noblox.js.org/global.html#UserPresence

1 Like