-
What do you want to achieve?
Teleport a player and data from a game to another using TeleportService. -
What is the issue?
Everytime i try to teleport a player and data in the same time the data does not come along with the player. -
What solutions have you tried so far?
Until now i have tried to use Teleport() and TeleportAsync() as well as SetTeleportSetting()
Here is some part of the different things i tried
-- Using Teleport()
local FinalTable = {}
local Data = {
{1, true},
{2, 'Test'}
} -- this is just a test Table
table.sort(tbl, function(a, b) return a[1] < b[1] end)
for _,v in ipairs(tbl) do
table.insert(FinalTable,v[2])
end -- Dont mind this, it's just to maintain the right order.. (mind the 'FinalTable' tho)
local TeleportService = game:GetService('TeleportService')
TeleportService:Teleport(PlaceId,Player,FinalTable)
-- On the other game here is the code to receive the Teleported data (LocalScript)
local TeleportedData = game:GetService('TeleportService'):GetLocalPlayerTeleportData()
if TeleportedData [1] == true then
Print(TeleportedData[2]) -- this should print 'Test'
end
-- Using TeleportAsync()
-- Well same code but we remplaced 'TeleportService:Teleport(PlaceId,Player,FinalTable)' with 'TeleportService:TeleportAsync(PlaceId,{Player},FinalTable)'
-- Using SetTeleportSetting()
local Data = {
BooleanValue = true,
ToPrintValue = 'Test'
} -- this is just a test Table
local TeleportService = game:GetService('TeleportService')
TeleportService:SetTeleportSetting('Boolean', Data.BooleanValue)
TeleportService:SetTeleportSetting('Print', Data.ToPrintValue)
wait(.1)
TeleportService:Teleport(PlaceId,Player) -- not 100% sure how TeleportSetting works idk if it requires a third argument here...
-- On the other game here is the code to receive the Teleported data (LocalScript)
local TeleportService = game:GetService('TeleportService')
if TeleportService:GetTeleportSetting('Boolean') == true then
Print(TeleportService:GetTeleportSetting('Print')) -- this should print 'Test'
end
I canāt get to know why it doesnāt work and even when iām using Pcall(), it return success as if nothing wrong was happening itās just ignoring the 3rd Argument of the Teleport which is the TeleportData and as for SetTeleportSetting()/GetTeleportSetting() same goes for it, itās like it was being ignoredā¦ (i may be blind and have done a big mistake that i didnāt notice . If it is the case please tell me )