Skip to content

Instantly share code, notes, and snippets.

@Sleitnick
Last active September 9, 2015 01:59
Show Gist options
  • Select an option

  • Save Sleitnick/3e7318916f9b24ad31e7 to your computer and use it in GitHub Desktop.

Select an option

Save Sleitnick/3e7318916f9b24ad31e7 to your computer and use it in GitHub Desktop.
RbxLinkTest
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