Hello! I was wondering if anyone knows how I could possibly make a random number generator input Id’s of a Roblox experience in a game to basically go to any random game possible on Roblox. This is for a game I am making which is essentially just a waiting room to get teleported to any random game on Roblox. Thank you!
This is a good concept!
The ID of Roblox games are randomly generated so if it’s possible, I think it’ll be hard.
I was thinking maybe a 2nd system could be in place that checks if the place exists and if it doesn’t then it will restart and randomly choose another number.
Wow wow wow, I don’t understand anything of what you just said xD
I’m very bad at scripting so don’t ask me for the solution!
My friend who is a scripter said I’d have to use API Requests for this project and I got no clue where to start since I do not script.
Here, this can be used to validate an experience ID. As for the random number generator, math.random should suffice.
Thanks. If I figure this all out and if it works I’ll let you know.
Sure, if you need anything let me know.
I assume in the post I replace local ID = [Number] with local ID = math.random. The only issue now is how do I have more than just a small number if you understand since id’s could be long. I was thinking a random generator that could mix between 1-10 on about 7 or 8 digits [Or however long a common ID is]
Sorry if this makes no sense since I am not a scripter and I kinda suck at explaining
I’m not as good in lua as I am in python, but “math.random(1000000, 99999999)” is how it should work.
Ill see if it works in lua with a simple script
If it doesn’t work Ill try math.random(1, 100) [Some random thing I found online
They work the same, if you want to simply test the generation first then use this code:
local generator = math.random(1000000, 99999999)
print(generator)
or
while true do
task.wait(.5)
local generator = math.random(1000000, 99999999)
print(generator)
end
Do I just put this as a script in workspace and run and look in output?
Interesting
Yes, this should work. I never fact checked the post link I sent you but I’m just going off brain memory for now.
Is this how the script would be formatted. [I kinda frankensteined it]
local MPS = game:GetService(“MarketplaceService”)
local ID = task.wait(.5)
local ID = math.random(1000000, 99999999)
end
local PlaceCheck
local success, whoops = pcall(function()
PlaceCheck = MPS:GetProductInfo(ID)
end)
if success and PlaceCheck and PlaceCheck.AssetTypeId == 9 then
print(“The player has entered a valid place ID”)
else
warn("The player has entered a incorrect valid place ID: ", whoops)
end
wait no i messed it up gimme a sec
local MPS = game:GetService(“MarketplaceService”)
local ID = math.random(1000000, 99999999)
local PlaceCheck
local success, whoops = pcall(function()
PlaceCheck = MPS:GetProductInfo(ID)
end)
if success and PlaceCheck and PlaceCheck.AssetTypeId == 9 then
print(“The player has entered a valid place ID”)
else
warn("The player has entered a incorrect valid place ID: ", whoops)
end