Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can you use HTTPService with a module script?

I'm trying to make a discord bot/webhook in a module script so I can execute it whenever I want. If I use it, all it does is error: HTTP 400 (HTTP/1.1 400 Bad Request) I have been having a hard time with this and have been searching for an hour and a half with no answers for roblox scripting.

2 comments

0

I hope this question gets answered and doesn't have the fate of going unanswered.

0

Well how are you attaining the module? Are you keeping the modules scope or the callers? If you just make the module try to request any http it will fail, you can however load the module like a variable list and run it though an environment that normally can make requests.

1 answer

✓ Accepted answer

The answer to your question is "It can". You see, a ModuleScript can be run from the server or the client. If you require the ModuleScript from a Script, it is running on the server and so will be fine (since you can only use HttpService from the server). Similarly, it won't work if it's a LocalScript that requires it.

Since you're getting that error, I believe this confirms that you are referencing HttpService correctly and from the right place - the problem is that you're using it incorrectly (sending in a bad http request).

See here for details on HttpService; it also has links on how to properly send requests.

This discussion is preserved as it was. New answers, comments, and votes are closed.