Last active
September 9, 2015 01:59
-
-
Save Sleitnick/3e7318916f9b24ad31e7 to your computer and use it in GitHub Desktop.
RbxLinkTest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local version = "1.0.0" | |
| local plugin = PluginManager():CreatePlugin() | |
| local toolbar = plugin:CreateToolbar("RbxLink") | |
| local button = toolbar:CreateButton("RbxLink", "RbxLink Plugin", "") | |
| local http = game:GetService("HttpService") | |
| local endpoint = "http://localhost:8080/StudioLink" | |
| local synced = nil | |
| local syncing = false | |
| function AttemptSync() | |
| syncing = true | |
| local maxAttempts = 4 | |
| for i = 1,maxAttempts do | |
| local success, val = pcall(function() | |
| return http:GetAsync(endpoint) | |
| end) | |
| if (success) then | |
| synced = val | |
| break | |
| end | |
| end | |
| if (synced) then | |
| print("Synced:", synced) | |
| else | |
| warn("Sync failed") | |
| end | |
| syncing = false | |
| end | |
| function Click() | |
| if (not synced) then | |
| if (syncing) then return end | |
| AttemptSync() | |
| end | |
| end | |
| button.Click:connect(Click) | |
| print("RBX Link Test Running! Version: " .. version) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment