Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to I check if an ID init64 is a valid PlaceID?

If there is a possible way for a script to see if a number init64 is a valid PlaceID please let me know because it is needed.

1 answer

✓ Accepted answer
function IsGameValid(id)
local isgame
	local success,message = pcall(function()
	local gameid = game:GetService('MarketplaceService'):GetProductInfo(id)	
isgame = gameid.AssetTypeId == 9
	end)
  return success and isgame
end 

This function returns whether the given ID is a game. If you wanted to do something if this is true then you would do this:

if IsGameValid(1) then --Change 1 to an ID.
--Code here
end

Hope this helped!

1 comment

0

Sorry, forgot to make the function check if it was a game. I edited my answer so now it should work properly.

This discussion is preserved as it was. New answers, comments, and votes are closed.