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.
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