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:

01local HTTP = game:GetService("HttpService")
02 
03script.Parent.MouseButton1Click:Connect(function()
04    local User = script.Parent.Parent.Username.Text
05 
06 
07    local Response1 = HTTP:JSONDecode(
08        HTTP:GetAsync("https://api.roblox.com/users/get-by-username?username="..User, Enum.HttpContentType.ApplicationJson)
09    )
10 
11    local UserID = Response1.Id
12 
13    print("Got User ID of "..game.Players.LocalPlayer.Name)
14 
15    local GetUserFollowers = HTTP:JSONDecode(
View all 23 lines...
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