How could I check versions from a client sided module?

Hi!
I have tried 2 things to make a version checker:

  • HttpService
  • Require with a module returning the version

But, none of those work on a client sided module.

So, how would I check the version?
Thansk for any help!

1 Like

Why do you need to only use the client? You can easily invoke a RemoteFunction to return the data from the server using your preferred method (HttpService/require).

2 Likes

Yes, but this is not working.

--//client
script.Server.Script.Parent = game.ServerScriptService
--server
local Vers = require(8788148542).Version
print(Vers)
if Vers ~= "1.0.2" then
	warn("[PreloadService]: PreloadService is out of date! Please update your module.")
else 
	print("[PreloadService]: Up to date, 1.0.2!")
end 

You cannot access ServerScriptService from the client. It is a server-only service.

Then how could I do this? This is a toolbox module, I cant control what they put in SSS.

In order to communicate with server scripts from the client, consider the usage of a RemoteEvent

1 Like

It hink I can just do a “Put in SSS” folder. Thanks!

Why not just put it in ReplicatedStorage?

Just move the local script to a directory where it can execute, i.e; StarterGui.

That wouldn’t solve op’s issue.

OP would need to use a RemoteEvent for the client to interact with the server script.

OP would need to either:
→ Place the script in replicated storage where it is both accessible by the client and server
→ Create a remote event and interact with it that way

Just make sure if you’re using a remote event that you have the version check on the server and not the client. The client asks for the info.

local marketplace = game:GetService("MarketplaceService")

local success, result = pcall(function()
	return marketplace:GetProductInfo(8788148542)
end)

if success then
	if result then
		if result.Description:match("1.0.2") then
			print("Version 1.0.2 module.")
		end
	end
end

All on the client.

1 Like

Yes, but what op was attempting to currently do wasn’t possible on the client.

This line: script.Server.Script.Parent = game.ServerScriptService

Here’s an alternate solution to the one I already provided.

--CLIENT
local Replicated = game:GetService("ReplicatedStorage")
local Remote = Replicated:WaitForChild("RemoteEvent")

Remote.OnClientEvent:Connect(function(ModuleVersion)
	print("Version "..ModuleVersion.." module.")
end)
--SERVER
local Players = game:GetService("Players")
local Replicated = game:GetService("ReplicatedStorage")
local Remote = Replicated.RemoteEvent
local Module = require(8788148542)

Players.PlayerAdded:Connect(function(Player)
	Remote:FireClient(Player, Module.Version)
end)

The local script (client-side) should be placed inside the “StarterPlayerScripts” folder. The server script should be placed inside the “ServerScriptService” folder. This implementation makes use of a single RemoteEvent instance named “RemoteEvent”, this should be placed inside the “ReplicatedStorage” directory.

2 Likes