You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I am trying to teleport players to a random place when they step on a part I want players to see what game they are going to beforehand.
-
What is the issue? Most of the time the game I’m trying to teleport the player to is restricted and a error pops up
-
What solutions have you tried so far? I’ve looked at other posts but all of the solutions don’t really work for what I’m trying to do,
I can’t try to teleport them to another place when they step on the part because I want them to see what game they are going to before entering it.
local MarketplaceService = game:GetService("MarketplaceService")
local gameName = script.Parent.GameName
local gameID = script.Parent.GameID
local gameCreator = script.Parent.Creator
local gameCreation = script.Parent.Creation
local function findGame()
gameName.Value = "Loading..." -- sets values
gameID.Value = "0"
gameCreator.Value = "Roblox"
gameCreation.Value = "0"
script.Parent.Parent.Parent.DecalPart.Decal.Texture = 0
local ID = math.random(1, 2147483647)
local success, data = pcall(function()
return MarketplaceService:GetProductInfo(ID)
end)
if success then
if data then
if data.AssetTypeId == 9 then
local placeName = data.Name
if placeName:find("Place") or placeName:find("#") then
findGame()
else
findGame()
local printtable = {
Name = data.Name,
ID = ID,
Creator = data.Creator.Name,
DateCreated = data.Created
}
print(printtable)
gameName.Value = data.Name -- sets values
gameID.Value = ID
gameCreator.Value = data.Creator.Name
gameCreation.Value = data.Created
local thumbnailUrl = "https://www.roblox.com/asset-thumbnail/image?assetId=".. ID .."&width=768&height=432&format=png"
script.Parent.Parent.Parent.DecalPart.Decal.Texture = thumbnailUrl
end
else
findGame()
end
end
else
warn(data)
findGame()
end
end
script.Parent.MouseClick:Connect(function()
findGame()
end)