Hi, I'm making an EXP database, and want to find out wether or not the searched player in the database is in my main group or not, and what it's rank is. I use data stores in the script.
-- Enable Check local DSService = game:GetService("DataStoreService") local PlayerDataStorage = DSService:GetDataStore("vpqARwiBjdvaStxoZmCxUxxd") script.Parent.MouseButton1Click:connect(function() ScanName = script.Parent.Parent.TextBox.Text script.Parent.Parent.TextBox.Text = "Name Here" script.Parent.Parent.Loading.Visible = true local PlayerDataSave = ScanName.."vpqARwiBjdvaStxoZmCxUxxdPlayerSave:" PlayerEXP = PlayerDataStorage:GetAsync(PlayerDataSave.."EXP") local PlayerCOMMENT = PlayerDataStorage:GetAsync(PlayerDataSave.."OFC") PlayerID = PlayerDataStorage:GetAsync(PlayerDataSave.."ID") if PlayerEXP then script.Parent.Parent.Loading.Text = "Data found. Viewing..." wait(1) ViewData() script.Parent.Parent.Loading.Visible = false script.Parent.Parent.Loading.Text = "Loading..." else script.Parent.Parent.Loading.Text = "Data not found. Aborting..." wait(1) script.Parent.Parent.Loading.Visible = false script.Parent.Parent.Loading.Text = "Loading..." end end) function ViewData() script.Parent.Parent.Parent.DataView.PlayerName.Text = "Player Name: "..ScanName script.Parent.Parent.Parent.DataView.PlayerEXP.Text = "EXP: "..PlayerEXP local HTTPID = "http://api.roblox.com/users/"..PlayerID script.Parent.Parent.Parent.DataView.PlayerRankAI.Text = "Rank: "..HTTPID:GetRoleInGroup(2842013) script.Parent.Parent.Parent.DataView.PlayerId.Text = ("UserId: "..PlayerID) script.Parent.Parent.Parent.DataView.Visible = true end
At line 33 and 34 I tried the "http://api.roblox.com/users/"..PlayerID" way, however, it did not work, neither did putting the player ID in directly.
Is there anyway I can find out a players rank in a group without the player being online? Aswell if the player is in a group?
ROBLOX Web Api's can help with interacting with a user who is Offline.
You can find them here: http://wiki.roblox.com/index.php?title=Web_APIs
Basically, to find out if a player is in a group or not, you can use the following code:
local HS = game:GetService("HttpService") local playerid = 10 -- Change this to the userId of the Player your looking at local groupid = 1 -- Change this to the groupId of the group you want to search if (HS:GetAsync("https://www.roblox.com/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=" .. playerid .. "&groupid=" .. groupid)) then -- player is in the group else -- player is not in the group end
You can do the same with RankId or RoleName
Hope this helps.
Other Scripters, If I have got the above wrong, please tell me.