Im making an "Place Roullete" and I want to know the name the player is gonna teleport to. Why? Becouse most of the games are player name 's place games. We can just not teleport the player if its that kind of a place. Script:
function onTouched(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then local gametp = math.random(3900000000,4000000000) game:GetService("TeleportService"):Teleport(gametp, player) end end script.Parent.Touched:connect(onTouched)
Sorry for my bad English.
To get the name of a place with a given ID we can use the MarketplaceService
's function known as GetProductInfo
, like this:
game:GetService("MarketplaceService"):GetProductInfo(GameId).Name --Substitute GameId with the ID
For example if we wanted to print the name of Adopt Me
, we'd do this:
print(game:GetService("MarketplaceService"):GetProductInfo(920587237).Name)
Hope this helped and if it did be sure to mark the answer as answered. Have a nice day!