The script:
local GlitchURL = "https://flightwarebot.glitch.me/" --Place the glitch project URL inside of the quotes local ReplicatedStorage = game:GetService("ReplicatedStorage") local Remotes = ReplicatedStorage:WaitForChild("Remotes") local HttpService = game:GetService("HttpService") --Getting player's UserId local UserId game.Players.PlayerAdded:Connect(function(player) UserId = player.UserId end) --Making sure we don't get nil value. repeat print("UserId not found") wait() until UserId ~= nil local RoleId local function rankUser(UserId, RoleId) HttpService:GetAsync(GlitchURL.. "ranker?userid="..UserId.."&rank="..RoleId) --Error occurs at line 17. end Remotes.Fighter.OnServerEvent:Connect(function(player) RoleId = 5 rankUser(UserId, RoleId) player:Kick("You have been ranked.") end) Remotes.Airline.OnServerEvent:Connect(function(player) RoleId = 2 rankUser(UserId, RoleId) player:Kick("You have been ranked.") end) Remotes.Stunt.OnServerEvent:Connect(function(player) RoleId = 4 rankUser(UserId, RoleId) player:Kick("You have been ranked.") end) Remotes.Ground.OnServerEvent:Connect(function(player) RoleId = 6 rankUser(UserId, RoleId) player:Kick("You have been ranked.") end) Remotes.Cargo.OnServerEvent:Connect(function(player) RoleId = 3 rankUser(UserId, RoleId) player:Kick("You have been ranked.") end)
I have no idea why this happens. Please help. All and any is appreciated.
That website returns a 404 when trying to load it, make sure it is online before you start asking what's wrong. And other than that make sure the code on glitch is setup properly because that's most likely what is causing the 401.
wrap the function side a pcall sinse youre making a request outside roblox so like
pcall(function() HttpService:GetAsync end)
also, go into game settings and make sure the game has http and api access enabled