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

How do I fix my Teleport system (MessagingService) not working?

Asked by 4 years ago
Edited 4 years ago

I'm trying to make a system where the player can teleport to any server by typing in the username.

This code that I have does not work

Here is the code (made by @OptimisticSide):

01local function GetServerData(UserId)
02    local placeId, jobId
03 
04    PlayerFoundConnection = MessagingService:SubscribeAsync("PlayerFound", function(givenId, givenPlaceId, givenJobId)
05        if UserId == givenId then
06            placeId = givenPlaceId
07            jobId = givenJobId
08            PlayerFoundConnection:Disconnect()
09        end
10    end)
11 
12    MessagingService:PublishAsync("GetPlayer", UserId)
13    repeat wait() until not PlayerFoundConnection.Connected
14    return placeId, jobId
15end
View all 35 lines...

Output:

UserId: 0x0434518381 -- The userId is a table instead of an integer value

Something is not working here. If anyone know's the answer please tell me. Thanks in advance.

Answer this question