How do I tell if a id is a place or not?

Hello! I’m this is my first post on the forums so if there’s any issues tell me.

What I want to achieve:
I want to make a simple system that checks if a id is a place and then teleports you to that place when the part it is on is touched.

What is the issue?
It is giving me various errors and showing assets like shirts and images which I dont want.

What solutions have you tried so far?
Ive tried Enum.InfoType but it doesnt have what I want. And the only document I found on the forums is this.

This is what I have currently:

local tpservice = game:GetService("TeleportService")

script.Parent.Parent.PlaceID.Changed:Connect(function(PropertyChanged)
	if tonumber(script.Parent.Parent.PlaceID.Text) then
		if script.Parent.Parent.PlaceID.Text == nil then
			script.Parent.Text = "This goes to: Nil With description: None"
			return
		end
		task.wait(0.5)
		print(script.Parent.Parent.PlaceID.Text)
		print(game:GetService("MarketplaceService"):GetProductInfo(tonumber(script.Parent.Parent.PlaceID.Text),Enum.InfoType.))
		local PlaceInfo = game:GetService("MarketplaceService"):GetProductInfo(tonumber(script.Parent.Parent.PlaceID.Text))
		script.Parent.Text = "This goes to: ".. PlaceInfo.Name.. " With description: ".. PlaceInfo.Description
	else
		print("fake")
		print(PropertyChanged)
		print(tonumber(PropertyChanged))
	end
end)

I just really kinda want to know how MarketplaceService:GetProductInfo() works

Check if you are getting any data returned, and if you are, check if AssetTypeId = 9, which signifies that its a place according to the Enum.AssetType list.

If you want to learn more about whatever if returns, look into their documentation about it.
And if you want more efficient results, you should probably use HttpService for that, in which there are a few proxies you can use for that.

1 Like
        local success, PlaceInfo = pcall(function()
            return marketplaceService:GetProductInfo(tonumber(id), Enum.InfoType.Asset)
        end)

        if success and PlaceInfo and PlaceInfo.AssetTypeId == Enum.AssetType.Place.Value then
            script.Parent.Text = "This goes to: " .. PlaceInfo.Name .. " With description: " .. PlaceInfo.Description
        else
            script.Parent.Text = "Invalid Place ID or Asset is not a Place"
        end
    else
        script.Parent.Text = "Invalid ID"
    end

something like this probably, then again, i dont work with marketplace much. It could be wrong

That wouldn’t work because roblox blocks requests to its own IP. Unelss you wanna use a proxy, but GetProductInfo would be a lot easier.

I recommend checking their official docs though

Thats what I said.

Edit: I probably made the change AFTER.

1 Like

Me when I edit:

Either way OP just wants to check if an ID is a place before teleporting to said place, so HttpService wouldn’t provide many benefits

1 Like

I’m kinda new here so don’t trust me much :sweat_smile:, i just joined (ability to reply) like 7 minutes ago