I have:
- A NODEJS bot on my VPS that also hosts an API [Web Request Listener]
- This is on port 1000
- I am sending requests to this from roblox studio and it works, from ingame it doesnt (I GET 403)
HTTP REQUESTS TO PORT 3000 WORK PERFECT TO THE SAME IP FOR ANOTHER BOT THAT IS RUNNING.
CODE:
local event = game.ReplicatedStorage.Events.SendToAPI
local http = game:GetService("HttpService")
local function sendContact(plr, ver, json, url)
print("trying to send!")
print(json)
local suc, err = pcall(function()
return http:PostAsync("http://[IP]:1000/contact",json)
end)
print("sent.... ")
print(suc, err)
if suc then
print('Success! HTTP Sent')
game.ReplicatedStorage.Events.Notif:FireClient(plr, "Sucesss", "Sent message to kieranl29!", 3, true, Color3.fromRGB(74, 221, 108))
elseif err then
warn('HTTP Error: ' .. err)
end
end
local function sendVerify(plr, ver, json)
local suc, err = pcall(function()
return http:PostAsync("http://[IP]:1000/verifyuser",json)
end)
print("sent verify")
print(suc, err)
print("verify sent.")
if suc or err then
if err == "Unable to DM user" then
return game.ReplicatedStorage.Events.Notif:FireClient(plr, "ERROR!", "We are unable to dm you, Please enable your dm's! \n Ensure you are in our discord server!", 5, true, Color3.fromRGB(255, 0, 0))
end
if suc then
--print('Success! HTTP Sent')
return game.ReplicatedStorage.Events.Notif:FireClient(plr, "Sucesss", "Please check your DMS for further steps!!", 3, true, Color3.fromRGB(74, 221, 108))
end
elseif err then
warn('HTTP Error: ' .. err)
game.ReplicatedStorage.Events.Notif:FireClient(plr, "Error", err, 3, true, Color3.fromRGB(255, 0, 0))
end
end
event.OnServerEvent:Connect(function(plr, ver, json, url)
if ver == "VERIFY" then
sendVerify(plr, ver, json)
print("SENDING VERIFY FUNCTION")
else
sendContact(plr, ver, json, url)
end
end)