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

New to FE scripting, remotefunction I made not working?

Asked by
Robin5D 186
6 years ago
Edited 6 years ago
hs = game:GetService("HttpService")
function script.Parent.RemoteFunction.OnServerInvoke(player, url)
    local response = hs:GetAsync(url)
    return response
end

So, I'm working on a discord message interface surfacegui that will display Discord messages on a SurfaceGui inside of ROBLOX, using a Node.js backend to fetch messages, channels. and more for a Discord bot that will be put in a guild. I can't seem to get my remotefunction for HTTP requests to work, yet when I try using getasync normally from a script, rendering and everything works, and I can print normally. With the remotefunction, I'm pretty sure it returns something empty, as I cannot index anything.

Response should be instant. Any help?

Firing it with

request = game.ReplicatedStorage.RemoteFunction
local messageresult = request:InvokeServer("http://no.ip.for.you:noportforyou/discordget/fetchmessages/309898788900831233/30")
messageresult = hs:JSONDecode(messageresult)

This works perfectly fine in a script, normally using GetAsync.

0
Bump, still having problemos. Robin5D 186 — 6y
0
Reminder: the onserverinvoke is in a server script, the firing it with script is a localscript Robin5D 186 — 6y

Answer this question