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

Why isn't my TeleportService:GetPlayerInstance() script working correctly?

Asked by
katclap 24
4 years ago
Edited by DeceptiveCaster 4 years ago

I am making a friends list for players to join their friends because my game, Project Auction Reborn, involves a multiplayer aspect but uses a different start place, upon entering the game there is a list of online friends, clicking join on one of them fires an event to the server with the parameters: player and user Id of the friend. The server is then supposed to forward the player to his/her friend. Upon activating this i receive no error but nothing happens. please help!

https://gyazo.com/aed392fcb32a258bf054ff398e0ce2f4

Below is the server code

function tele (player, userId)
local TeleportService = game:GetService("TeleportService")  
        local success, errorMessage, placeId, jobId = pcall(function()
            return TeleportService:GetPlayerPlaceInstanceAsync(userId)
        end)
        if success then
            -- Teleport player
            TeleportService:TeleportToPlaceInstance(placeId, jobId, player)
        end
end



game.ReplicatedStorage.TeleportFriend.OnServerEvent:Connect(tele) 

Answer this question