I am using HttpService to try to load an external array in a pastebin with user IDs but it returns a value the game reads as a whole string. I want to do this so I can dynamically add, remove, and change ranks of staff.
Not sure what I am doing wrong. Any help? I know I'm doing something wrong. I do not get an error but it prints the entire contents of the pastebin.
The script is a regular script located in ServerScriptService
[This is just part of the script, the closure is correct]
game.Players.PlayerAdded:connect(function(player) local AdminList = {Http:GetAsync("https://pastebin.com/raw/F8fypE8N", false)} -- admin list local ModList = {Http:GetAsync("https://pastebin.com/raw/AS0ZvPb3", false)} -- mod list local HeadModList = {Http:GetAsync("https://pastebin.com/raw/exgyN5Xk", false)} -- list for i = 1, #AdminList do print(AdminList[i]) if tostring(player.UserId) == tostring(AdminList[i]) then localRank = 1 game:GetService("ReplicatedStorage"):WaitForChild("AdminComms"):FireAllClients(player.UserId, localRank) end end
The pastebin are in this format;
{ 26675160, 26666928 }
Thanks if you can help!
The problem is that your calls to GetAsync
are returning single strings as opposed to tuples of strings. You should encode your pastebin text in JSON format (see below), obtain the data as a string through Http.GetAsync
and then convert the string to a table using Http.JSONDecode
. You will also need to convert the user IDs to numbers by using tonumber
.
To make your pastebin text satisfy the JSON encoding, format it to have the same syntax as the following (you can add additional whitespace if desired):
["entry1", "entry2", "blah blah blah"]