#this wont send me to THE PLACE OMG

86 messages · Page 1 of 1 (latest)

rancid latchBOT
#

studio** You are now Level 4! **studio

gray temple
#

Make sure that's cleared up first. If you are aware of that, then are you getting any errors?

#

Wait wtf am I reading... lol

#

Are you trying to teleport a player's character to a block? Or a player to another place?

gray temple
#

I'm concerned... What do you see? lmao. Because given your goal, your code is in a completely different realm

misty chasm
gray temple
#

Are you trying it in Studio? It has to be in a real running game

misty chasm
#

real game

#

real stuff

gray temple
#

It's tough to debug as there's no output.... Hmm

misty chasm
gray temple
#

Don't call TeleportAsync directly on the player, use the TeleportService

misty chasm
#

like this?

#

button.MouseButton1Click:Connect(function()
    local gameId = 11390456132 -- Replace this with the ID of the game that you want to join
    local gameInfo = game:GetService("MarketplaceService"):GetProductInfo(gameId)

    if gameInfo then
        -- Join the game
        local success, errorMessage = game:GetService("TeleportService"):Teleport(gameInfo.GameId)

        if not success then
            print("Error teleporting to game: " .. errorMessage)
            game.StarterGui:SetCore("SendNotification", {
                Title = "Error Teleporting",
                Text = "An error occurred while trying to teleport to the game. Please try again later.",
                Duration = 5,
            })
        end
    else
        print("Game not found")
    end
end)
gray temple
#

Teleport has 4 parameters

misty chasm
gray temple
#

And it returns nothing

misty chasm
#

my pc crashed

#

so how should it look like

gray temple
misty chasm
#

oh

#

hmm

gray temple
#

Teleport:(placeId, the player to teleport) at least

#

There's two others but they're optional

#

TeleportAsync only works in server scripts, but Idk if that's true for Teleport

misty chasm
#

button.MouseButton1Click:Connect(function()
    local gameId = 11390456132 -- Replace this with the ID of the game that you want to join
    local gameInfo = game:GetService("MarketplaceService"):GetProductInfo(gameId)

    if gameInfo then
        -- Join the game
        local success, errorMessage = game:GetService("TeleportService"):Teleport(game.Players.LocalPlayer, gameInfo.GameId)

        if not success then
            print("Error teleporting to game: " .. errorMessage)
            game.StarterGui:SetCore("SendNotification", {
                Title = "Error Teleporting",
                Text = "An error occurred while trying to teleport to the game. Please try again later.",
                Duration = 5,
            })
        end
    else
        print("Game not found")
    end
end)
```?
gray temple
#

Swap them...

misty chasm
gray temple
#

gameId first then player

#

lmfao

misty chasm
#

i thought it was optional to unswap!!

gray temple
#

Nope order matters

#

It's how the compiler/interpreter knows which goes where

misty chasm
#

local button = game.StarterGui.AreaGui.DaveGUI.DaveGUI.Davez.Wilderness

button.MouseButton1Click:Connect(function()
local gameId = 11390456132 -- Replace this with the ID of the game that you want to join
local gameInfo = game:GetService("MarketplaceService"):GetProductInfo(gameId)

if gameInfo then
    -- Join the game
    local success, errorMessage = game:GetService("TeleportService"):Teleport(gameinfo.Gameid, game.Players.LocalPlayer)

    if not success then
        print("Error teleporting to game: " .. errorMessage)
        game.StarterGui:SetCore("SendNotification", {
            Title = "Error Teleporting",
            Text = "An error occurred while trying to teleport to the game. Please try again later.",
            Duration = 5,
        })
    end
else
    print("Game not found")
end

end)

gray temple
#

isn't is GameId?

misty chasm
#

man!

#

scripting while using discords chat does not help u!!

#

local button = game.StarterGui.AreaGui.DaveGUI.DaveGUI.Davez.Wilderness

button.MouseButton1Click:Connect(function()
local gameId = 11390456132 -- Replace this with the ID of the game that you want to join
local gameInfo = game:GetService("MarketplaceService"):GetProductInfo(gameId)

if gameInfo then
    -- Join the game
    local success, errorMessage = game:GetService("TeleportService"):Teleport(gameinfo.gameid, game.Players.LocalPlayer)

    if not success then
        print("Error teleporting to game: " .. errorMessage)
        game.StarterGui:SetCore("SendNotification", {
            Title = "Error Teleporting",
            Text = "An error occurred while trying to teleport to the game. Please try again later.",
            Duration = 5,
        })
    end
else
    print("Game not found")
end

end)

#

i fixed the captial I on gameinfo too

#

i swear if this doesn't work im blaming my game

gray temple
#

Hmm

misty chasm
#

BRO

#

💀

#

it does not work

gray temple
#
button.MouseButton1Click:Connect(function()
    local gameId = 11390456132 -- Replace this with the ID of the game that you want to join
    local gameInfo = game:GetService("MarketplaceService"):GetProductInfo(gameId)

    if gameInfo then
        -- Join the game
        local success, errorMessage = game:GetService("TeleportService"):Teleport(gameId, game.Players.LocalPlayer)

        if not success then
            print("Error teleporting to game: " .. errorMessage)
            game.StarterGui:SetCore("SendNotification", {
                Title = "Error Teleporting",
                Text = "An error occurred while trying to teleport to the game. Please try again later.",
                Duration = 5,
            })
        end
    else
        print("Game not found")
    end
end)
misty chasm
#

killing myself rn

gray temple
#

You need to chill 😐

misty chasm
#

I love debugging even more

misty chasm
#

Like

#

this script is retiring

gray temple
#

Open your palce, Press F9

#

And do the stuff to trigger the teleport

misty chasm
#

huh

gray temple
#

Place is restricted for me

rancid latchBOT
#

studio** You are now Level 5! **studio

gray temple
#

Also drop the success, error thing. This method returns nothing

misty chasm
misty chasm
#

LOL

#

oopsie forgor the variable for the button

#

😝 😝 😝 😝 IM SO GOOFY AND SILLY😝 😝 😝

gray temple
#

Your script will break if it's not successful though, errorMessage will return nil when a teleport fails

misty chasm
gray temple
#

The Teleport:() method returns void, so you're setting nothing to success and errorMessage. The string concatenation a few lines below will error out

#

That it statement will always run too because not nil is truthy

#

Anyway, I gotta run. Hopefully you can figure this out lol

misty chasm
gray temple
#

Also, calm the heck down. It's not that serious

misty chasm
#

bye

misty chasm
#

its so silly!!