'Json data not being sent to php files roblox lua
I'm working on a avatar rendering script and it works fine other than the fact it sends no data to the php file hosted on the web. I have a feeling this is related to how roblox lua handles variables/non-static strings since it worked fine when i used what i call static strings. Btw this script is for a version of the roblox cloud compute service from july 2015.
game:GetService("ScriptContext").ScriptsDisabled = true
local HttpService = game:GetService("HttpService")
HttpService.HttpEnabled = true
pcall(function() game:GetService("ContentProvider"):SetBaseUrl(baseUrl) end)
while true do
print("Checking for pending renders.")
local Link = HttpService:GetAsync(baseUrl .."/api/RCCService/PendingRenders.ashx")
local data = HttpService:JSONDecode(Link)
print(data.UserID)
if data.UserID ~= "null" then
if not game.Players.LocalPlayer then
game.Players:CreateLocalPlayer(0)
end
game.Players.LocalPlayer:LoadCharacter(true)
game.Players.LocalPlayer.CharacterAppearance = baseUrl .. "/v1/avatar-fetch/?UserID=" .. data.UserID
local RenderCharacter = game:GetService("ThumbnailGenerator"):Click("PNG", 420, 420, true)
wait(5)
if RenderCharacter then
print("Uploading the image.")
print("B64: " .. tostring(RenderCharacter))
local GatherData = {
["userid"] = data.UserID;
["click"] = RenderCharacter;
}
game:GetService("HttpService"):PostAsync(baseUrl .. "/Thumbnail/ThumbnailConvert.aspx", game:GetService("HttpService"):JSONEncode(GatherData), Enum.HttpContentType.TextPlain)
print("Uploaded place thumbnail successfully!")
else
print("Render doesnt exist, something went wrong.")
end
end
wait(4)
end```
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
