i making a plugin like autoscale (from zacbytes) and i wanna add there update ui but i dont know how i detect plugin is updated
httpservice can handle this, unless there’s some magical function that can get the current plugin’s version.
i dont know how to use httpservice
Go to game settings, then to security and click HTTP requests
i know how to do this, i dont know how to use on script
Well I cant help you with making a script sorry.
If you have never played before with HttpService
, I’d recommend you to take a look at this. In simple terms, it lets you make HTTP requests from your experience/server.
Sometimes you want to retrieve (GET) or send data (POST) to a proxy server/API you have mounted, this is the way. Recently I’ve made a copy game like Pls Donate, which required a proxy server to make requests and retrieve player’s inventory. This is a small example where you use HttpService
. There’s also multiple methods like GetAsync
, PostAsync
or RequestAsync
(which has more to deal with, and I highly recommend to use this last one over the others). But also there’s more methods which are more used like GenerateGUID
(a random string that is used to give unique identifiers to certain objects, like pets for an inventory).
JSONDecode
and JSONEncode
when handling requests (GET and POST, depending on which one you’re making). There’s much more but I recommend to check it out.
One solution is to add the plugin’s version to the description of the plugin’s on-site library link. With this you can periodically query the plugin’s on-site description in order to determine if it has been updated or not.
local marketplace = game:GetService("MarketplaceService")
local pluginId = 0 --Change to plugin's ID.
local pluginVersion = "1.2.3" --Current plugin's version.
local function checkIfUpdated()
local success, result = pcall(function()
return marketplace:GetProductInfo(pluginId)
end)
if success then
if result then
if result.Description ~= pluginVersion then
print("Plugin has updated to version "..result.Description..".")
end
end
else
warn(result)
end
end
task.spawn(function()
while task.wait(60) do --Every minute.
checkIfUpdated()
end
end)
this is good idea, i got new idea from your code, whats is this? i require plugin version module id and detects its changed
Yeah, having a key/field in some module script named version
or similar is another common way to go about this.
do u know this error?
return true
output : nil