Answered by
6 years ago Edited 6 years ago
Keep in mind; this is the code itself, the person above me is correct. ROBLOX blocked discord APIs, so you need your own proxy.
line 2, you defined player wrong.
1 | local player = game.Players.Name |
The whole script's wrong; generally.
You should NOT use a LocalScript; instead, you should use a Script instead when you're working with webhooks.
I'm assuming that you're using LocalScript due to line 05, when you did "game.Players.LocalPlayer". Just to clarify, that'd only work on LocalScripts.
line 05, why is that there? it should be outside the array.
line 07, that's not even a proper string. it should be
1 | player.Name.. " signed on!" |
you need to learn how to use variables in strings.
^ in your case, you it should be // player.." signed on!" instead; IF you defined player properly on line 02.
line 09, don't use the same variable, you're confusing it. rename the other variable (in this case, I'm talking about "HookData" on line 09, var hookdata already exists on line 04)
We can prevent this by maybe changing the name.
HookDatajson maybe?
line 10, again; you have TWO "HookData", it won't know which one to pick.
Here, I'll help you with your code.
01 | local url = "// webhook url" |
02 | local http = game:GetService( "HttpService" ) |
04 | game.Teams [ "Mobile Task Force" ] .PlayerAdded:connect( function (player) |
07 | [ 'username' ] = "SCPF Signing Bot" , |
08 | [ 'content' ] = player.Name.. " signed on!" |
11 | local HookDatajson = http:JSONEncode(HookData) |
12 | http:PostAsync(url, HookDatajson) |