Teleport between places broken or smth :I

You can write your topic however you want, but you need to answer these questions:

  1. I want to make teleport between places in my game and it just doesn’t work

  2. the issue video =))

  3. This is the simplest example i could try and it still failed to work, im trying to make this work for another game

2 Likes

In the anonymous function, add player as an argument and then replace playToTeleport with player, as when a RemoteEvent gets fired it returns the Player who fired it and then the data sent if there is.

Or if you want all players to be teleported you can do a:

for _, Player in game:GetService("Players"):GetPlayers() do
teleport:TeleportAsync(PlaceID, Player)
end

Also please post your script in text next time.

1 Like


x

local Players = game:GetService(“Players”)
local teleport = game:GetService(“TeleportService”)
local playerToTeleport = Players:GetPlayers()[1]

game.ReplicatedStorage.Teleport.OnServerEvent:Connect(function(player)
teleport:TeleportAsync(14168382483, player)
end)

Teleport to other places won’t work in Studio. You need to test it in a live server.

1 Like

still doesn’t work

help pls
.I can’t get it to work.
(This place is a test place btw it’s for another game in that i quite not get the teleportAsync to work)

It’s good practice to wrap network methods like this in a pcall. This can help you diagnose issues. Have you checked to make sure the server is receiving your event in the first place?

-- server script
local TeleportService = game:GetService("TeleportService")
local MyEvent = game:GetService("ReplicatedStorage"):WaitForChild("Teleport")

MyEvent.OnServerEvent:Connect(function(player)
    print(player.Name, "wants to teleport!") -- simple debug print to make sure
    -- we get the event call in the first place!

    local result, msgOrTpResult = pcall(function()
        return TeleportService:TeleportAsync(place_id, { player })
    end)

    if not result then
        warn("TelportAsync failed:", msgOrTpResult)
    end
end)

Look out for a warning that will state why your teleport failed, if your issue persists and you get a warning, please share it here. If you do not get teleported and no warnings are printed, ensure the event is getting fired by making sure you see a “[name] wants to teleport!” in the output.

If the place you are attempting to teleport to is not part of the same experience and not owned by the same person, you will need to enable third-party teleports. I know this was already mentioned, but you cannot teleport in studio!

1 Like

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