Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to fix "Unable to cast token to bool", how to fix?

Asked by
GITSTP 19
4 years ago

I am trying to get a userid from a username in a roblox endpoint using HTTP requests, yes HTTP Requests are turned on, yes I specified Enum.HttpContentType

Here is the script:

local HTTP = game:GetService("HttpService")

script.Parent.MouseButton1Click:Connect(function()
    local User = script.Parent.Parent.Username.Text


    local Response1 = HTTP:JSONDecode(
        HTTP:GetAsync("https://api.roblox.com/users/get-by-username?username="..User, Enum.HttpContentType.ApplicationJson)
    )

    local UserID = Response1.Id

    print("Got User ID of "..game.Players.LocalPlayer.Name)

    local GetUserFollowers = HTTP:JSONDecode(
        HTTP:GetAsync("https://friends.roblox.com/v1/users/"..UserID.."/followings/count", Enum.HttpContentType.ApplicationJson)
    )

    local FollowerCount = GetUserFollowers.count

    print("Getting follower count of "..User)
    script.Parent.Parent.Output.Followers.Text = ("Follower Count: "..FollowerCount)
end)
0
My indents are correct on my script. Indents are bad on this post though lol GITSTP 19 — 4y
0
What line does the error happen on? Don't see any places where this error could crop up off the bat. whenallthepigsfly 541 — 4y
0
Line 8 GITSTP 19 — 4y
0
Did you ever get the answer to this question or figure it out? LiquifySlashes 0 — 2y

Answer this question