I am trying to utilize this API made by Usering.
This is section of my script.
Content = script.Parent.Content
VisitsText = Content.Page.Visits
PlaceVisitCount = function(plr)
return tonumber(DecodeJSON(GET("Users/PlaceVisitCount","UserId=" .. tostring(plr))).PlaceVisits)
end;
VisitsText.Text = "Place Visits: " .. PlaceVisitCount
It should make make the text label the amount of place visits the player you clicked on has.
However this did not work for me.
And I have to use plr to define the player or else it will not work and not display that players stats.
plr is the person they clicked on (I cut that function out of the script because it would clutter up the page.)
How would I use this API correctly?
Usering's API module script
--[[
DOCUMENTATION
To use this, make sure to require this ModuleScript in your scripts.
RbxApi = require(game.ReplicatedStorage.RobloxAPI)
CREATED BY: Usering
CREATE DATE (MM/DD/YY): 04/05/14
MODIFY DATE (MM/DD/YY): 04/22/14
NOTES:
- Make sure HttpService's HttpEnabled is set to true
VERSION: 1.1
CHANGELOG:
- Added api.robloxapi.com/Users/UserId
| Gets the UserId of a Username
--]]
HttpService = game.HttpService
GET = function(api,params)
return HttpService:GetAsync("http://api.robloxapi.com/" .. api .. "?" .. params)
end
DecodeJSON = function(str)
return HttpService:JSONDecode(str)
end
API = {
Groups = {
GroupOwner = function(GroupId)
return DecodeJSON(GET("Groups/GroupOwner","GroupId=" .. tostring(GroupId))).Owner
end;
GroupDescription = function(GroupId)
return DecodeJSON(GET("Groups/GroupDescription","GroupId=" .. tostring(GroupId))).Description
end;
GroupName = function(GroupId)
return DecodeJSON(GET("Groups/GroupName","GroupId=" .. tostring(GroupId))).Name
end
};
Users = {
FriendCount = function(UserId)
return tonumber(DecodeJSON(GET("Users/FriendCount","UserId=" .. tostring(UserId))).Friends)
end;
ForumPostCount = function(UserId)
return tonumber(DecodeJSON(GET("Users/ForumPostCount","UserId=" .. tostring(UserId))).ForumPosts)
end;
PlaceVisitCount = function(UserId)
return tonumber(DecodeJSON(GET("Users/PlaceVisitCount","UserId=" .. tostring(UserId))).PlaceVisits)
end;
KnockoutCount = function(UserId)
return tonumber(DecodeJSON(GET("Users/KnockoutCount","UserId=" .. tostring(UserId))).Knockouts)
end;
CurrentUsername = function(UserId)
return DecodeJSON(GET("Users/CurrentUsername","UserId=" .. tostring(UserId))).Username
end;
AllUsernames = function(UserId)
return DecodeJSON(GET("Users/AllUsernames","UserId=" .. tostring(UserId))).Usernames
end;
OnlineStatus = function(UserId)
return DecodeJSON(GET("Users/UserOnlineStatus","UserId=" .. tostring(UserId))).Status
end;
UserId = function(Username)
return DecodeJSON(GET("Users/UserId","Username=" .. tostring(Username))).UserId
end
};
Assets = {
PlayerOwnsAsset = function(AssetId,UserId)
owns = GET("Assets/PlayerOwnsAsset","UserId=" .. tostring(UserId) .. "&AssetId=" .. tostring(AssetId))
if owns == "true" then
return true
elseif owns == "false" then
return false
end
end;
ItemRap = function(AssetId)
return DecodeJSON(GET("Assets/ItemRAP.php", "AssetId=" .. tostring(AssetId))).AssetId
end
}
}
return API

3 comments
Why "Users" ?
At the bottom of the API it is returning a table called "API". There is table at the bottom called API and it is also defining Users as a table with a bunch of functions such as "PlaceVistCount". So to call it you need to do RbxApi.Users.PlaceVistCount
I tried that and it still breaks my whole script.