Is there any way to detect whether a player is online? I have search a lot trying to find anything about anything. I have found a few things but they don't work, and or don't do what I want.
I have found a few things like https://api.roblox.com/users/USERID/onlinestatus/ but the page doesn't exist anymore.
I know some scripting but I don't even know where to start with this, all I have for a slight idea is
01 | [ |
02 | { |
03 | "Id" : 12345678 , |
04 | "Username" : "user" , |
05 | "AvatarUri" : "" , |
06 | "AvatarFinal" : true , |
07 | "IsOnline" : true |
08 | } |
09 | ] |
10 |
11 | { |
12 | "Id" : 12345678 , |
13 | "Username" : "user name" |
14 | } |
But it returns with errors and such. And I get something working, is there any way to make it perform a function? like delete or make a part or model.
there was a question like this WAY backin 2014 when roblox didnt have good security and stored the data of your player on a website(but this api is probaly destoryed) you can try this but it might not work.
01 | local http = game:GetService( "HttpService" ) |
02 |
03 | game.Players.PlayerAdded:connect( function (plr) |
04 | plr.Chatted:connect( function (msg) |
05 | if msg:lower():sub( 1 , 7 ) = = "status/" then |
06 | local id = tonumber (msg:sub( 8 )) --Get the ID after the "/" in "status/" |
07 | if id ~ = nil then --If the ID doesn't return nil after being converted to a number then continue. |
08 | local status = http:GetAsync( "http://apiroblox.netne.net/GetUserStatus.php?id=" ..id) --Get online status of the player from the ID. |
09 | local m = Instance.new( "Message" , game.Workspace) |
10 | m.Text = "Status of player ID " ..id.. ": " .. tostring (status) |
11 | end --if theres any error delete this end |
12 | end |
13 | end ) |
14 | end ) |
if that doesnt work you can only see the status of your friends.
1 | local Players = game:GetService( "Players" ) |
2 | local player = Players.LocalPlayer |
3 | local onlineFriends = player:GetFriendsOnline( 200 ) --max players |
4 | for i, friend in pairs (onlineFriends) do |
5 | print (friend.UserName) |
6 | end |
sorry, thats the best i can do.
Now, i'm not the greatest but you could use the :WaitForChild
method, take my answer lightly though.