Teleporting Broken?

Hey, so I’m trying to teleport the player using the teleport guide on the Wiki, however it doesn’t work at all. Is it broken? The code is exactly that on the Wiki.

Same here. Must be broken.

No “teleport” isn’t broken.
Have you used it client side?

Otherwise build your own teleport function.
You only need you destination Location :slight_smile:

For example this should you teleport to another player: (UNTESTED BUT SHOULD WORK)

Serverside build a command:

function CommandHandler(fullcommand)
    command = stringsplit(fullcommand, " ")

    if(command[1] == "/tp") then -- Captures the command
		if (command[2]) then
			TriggerClientEvent("teleport_Player", source, command[2]) --use in your Chat /tp TARGET_PLAYER
AddEventHandler('chatCommandEntered', CommandHandler)



function TeleportMeToPlayer(player)
        local destPed = GetPlayerPed(player) 
        local localPed = GetPlayerPed(-1)

        if destPed and destPed ~= -1 then --check if your target exists
                local coords = GetEntityCoords(destPed, true)
                SetEntityCoords(localPed, coords, true, false, false, true)
AddEventHandler("teleport_Player", TeleportMeToPlayer)

I got it working. It turns out it was the tiniest error in the lib.lua I created. lmao

@Yashiku how do i set a map tp. like /tp akina?

@iago You would most likely have it take the player name and get the coords for that player name then teleport to those coords…so right above your comment.

@iago I can probably help, what do you mean by a “map tp”?

@dacheezypuffs like the player types ‘/tp akina’ and it teleports them to the map akina

@iago yeah I can’t help with that, sorry. :confused:

Of course it is possible too.
All you need is in case of the player to handle the destination in your case Akina
What you need are the coords of Akina.

SetEntityCoords(localPed, Akina_Coord_X, Akina_Coord_Y, Akina_Coord_Z, …)

You can create yourself a command like I also do to gather coords. :wink: