Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to detect the name of the place the player is gonna teleport to?

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.

3 comments

0

Can u be more specific maybe google translate ur origin language to English or something

0

Yeah, you can even reformulate the question. Bc I don't undertand pretty much.

0

Sorry, i have bad english ????

1 answer

✓ Accepted answer

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!

1 comment

0

Thx!

This discussion is preserved as it was. New answers, comments, and votes are closed.