How do I check if there's a new published version of the game?

I’m making a prompt asking you if you want to rejoin. I don’t know how to code this.
really later, here’s a working version (note the variable names may be off and you may reach the cap so increase the waits. haven’t tested for that. you need that last wait to make sure roblox has fully updated.)
working code:

local mps = game:GetService("MarketplaceService")
while task.wait(5) do
	local oldver = mps:GetProductInfo(game.PlaceId)
	task.wait(5)
	local newver = mps:GetProductInfo(game.PlaceId)
	if oldver ~= newver then
		warn("Detected update")
		task	.wait(5)
		--do stuff
	end
end
2 Likes

Could you provide more details in what you mean? The title and the main content of this post is a little confusing due to the relation of both of these things.

I realized that the title was weird and i updated. Basically: if i publish a version of the game the prompt appears. How do I do this?

Unsure if this would work but I found this. I did not even know you could use :GetProductInfo on a game but it seems so.

1 Like

Why are there 2 variables doing the same thing?

Um what do you mean? I don’t see that in the code.

updateTime and checkUpdate (characters)

They don’t do the same. The “checkUpdate” value is the current update and the “updateTime” is the latest update. The reason why you would need both of these values is because we want to check if the current version is not equals to the update before because if we did not have this if statement it would be always saying there is a new update when there is not so we use this if statement to filter out the updated versions.

1 Like

Ohhh thank you I’ll try it. Characters

Question: will this check every minute?

Yea it will. There will be a buffer so you have to be wary of that. The reason is because you don’t want to exhaust it.

I know, i know. Thank you! Characters

Oh damn it. It doesn’t work. The script is a server script triggering a local script via remote event.

Can you explain a bit? You should just have the script in serverscriptservice and it should work ok…

Wait i think it’s an error with my local script actually it is.

"Expected identifier when parsing expression, got ‘=’. I have no idea why this appears. It’s just making the UI visible. It waits for playergui, game paused (making the prompt appear in the pause menu), waits for confirm update and makes it visible.

Can you show your code? Also are you sure this is related to the post?

I’m so stupid i found the issue. I was changing visible in the variable. I’m a walking L lol

Still doesn’t appear. E. The worst part is that it doesn’t error nor does it work. Debugging is the worst part of coding.