#need help modifying one place roulette type script

1 messages · Page 1 of 1 (latest)

lofty crystal
#

-- 📂 ServerScriptService > Script

local MPS = game:GetService("MarketplaceService")

local function RetrieveRandomGame()
local digits = {}
for i = 1, 10 do
table.insert(digits, math.random(0, 9))
end

local PlaceId = tonumber(table.concat(digits))
if PlaceId then
    local success, Place = pcall(function()
        return MPS:GetProductInfo(PlaceId)
    end)
    if success then
        local isAGame = Place["AssetTypeId"] == 9
        local isNotPlaceNamed = not string.find(string.lower(Place.Name), "place")
        if Place and Place ~= {} and isAGame and isNotPlaceNamed then
            return Place
        end
    end
end
return RetrieveRandomGame()

end

local randomGame = RetrieveRandomGame()
print("Selected Game:", randomGame)

game:SetAttribute("RandomPlaceId", randomGame.AssetId)

thats the script i ripped off the devforum and changed, i just need someway to filter out unavailable games as idk how to do that. heres the studs teleport script incase your modification dosent work with it: -- Workspace > TeleportPart > Script

local TeleportService = game:GetService("TeleportService")

script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local placeId = game:GetAttribute("RandomPlaceId")
if placeId then
print("Teleporting", player.Name, "to", placeId)
TeleportService:Teleport(placeId, player)
else
warn("No PlaceId found. Maybe wait or rejoin.")
end
end
end)

undone ridge
#

what do you need modified