Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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.

0
Can u be more specific maybe google translate ur origin language to English or something St_vnC 330 — 4y
0
Yeah, you can even reformulate the question. Bc I don't undertand pretty much. Foxy_Developer 111 — 4y
0
Sorry, i have bad english ???? hasanchik 49 — 4y

1 answer

Log in to vote
1
Answered by
vexound 170
4 years ago

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!

0
Thx! hasanchik 49 — 4y
Ad

Answer this question