Random Number Generator/Place ID teleport

while true do
	wait(45)
	local MPS = game:GetService("MarketplaceService")
	local TPS = game:GetService("TeleportService")

	local ID = math.random(1000000, 99999999)
	print(ID)
	
	local PlaceCheck

	local success, whoops = pcall(function()

		PlaceCheck = MPS:GetProductInfo(ID)

	end)

	if success and PlaceCheck and PlaceCheck.AssetTypeId == 9 then
		game:GetService("Players").PlayerAdded:Connect(function(plr)
			TPS:Teleport(ID,plr)
		end)
		
		print("The player has entered a valid place ID")

	else

		warn("The player has entered a incorrect valid place ID: ", whoops)

	end
end

Try using this code

1 Like

It doesn’t seem to be doing anything while I am testing it in game. However am I supposed to put the script somewhere else other than workspace. Because that could be one of the issues.

Is there an error when you run the script in-game? You can check this by clicking F9 or typing /console in chat

Oh wait holdon. It actually worked now. Lets go

It works now. thanks for the help

That’s great, goodluck on your game.

1 Like

By the way, it would be cool if you marked the code as your solution :smile:

Sorry. I thought it was the ontop button not the bottom.

Oh no problem, thanks so much.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.