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

How can I send data from a website to the ROBLOX server?

Asked by
Link43758 175
9 years ago

Hi, I want to make a remote admin panel using HttpService. This is how I was thinking I should do things:

  1. The game owner goes on my website
  2. A command is chosen and added to the database
  3. Every second, the game sees if a new command was added to the database
  4. If there is a new command, the command is run
  5. Repeat every 1 second However, I was wondering if there was a way to do this without having:
while wait(1) do
    -- stuff
end

Thank you! * Link43758

2 answers

Log in to vote
3
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

Unfortunately, no. The HTTP service only allows you to request a page, and cannot accept one that the webserver sends of its own accord (HTTP as a protocol doesn't allow this).


If performance is a concern, though, you could do a few things to reduce webserver requests and Lua operations.

Consider only requesting every 20 seconds or so usually; however, each response from the panel states whether or not someone recently logged onto the admin panel; if so, the ROBLOX server increases the request rate to once per second.

That way, if an operation takes at least 20 seconds to perform from logging on, you'll get it just as fast but on average send 5% as many requests.

You could also reduce requests caused by having multiple ROBLOX servers open by conferring with DataStores to essentially have only one ROBLOX server sending requests at a time, though this might have a more significant Lua performance cost (but some better network / admin webserver performance)


It's not clear from your question, so I'll make the recommendation:

Your ROBLOX Lua script should probably not be the thing identifying if something has changed. This should probably be handled by the webserver so that significantly less information is sent across and less information needs to be processed.

Best way to do this is to send to the webserver the timestamp of the last request, and only share messages made since then (maybe plus a bit to be safe).

Ad
Log in to vote
-1
Answered by
Adryin 120
9 years ago

Do you want to run the function when any propety of an item is changed? if so,

script.Parent.Changed:connect(function(pt) --stuff end) Changed is a variable for nearly everything..

Answer this question