Teleport data not working

I’m trying to make a customizable lobby queue system, but the script I have between places are not working, and is not correctly sending or gathering the teleport data.

This is my first script, inside server storage on the main place.

local TeleportService = game:GetService("TeleportService")

local placeid = 76907332352013

game.Players.PlayerAdded:Connect(function(player)
	local teleportOptions = Instance.new("TeleportOptions")
	teleportOptions.ShouldReserveServer = true
	
	local teleportData = {
		Difficulty = 1,
		Map = 3,
		PlayerCount = 4,
	}
	
	teleportOptions:SetTeleportData(teleportData)
	
	
	TeleportService:TeleportAsync(placeid, {player}, teleportOptions)
end)

And my second script, also in server storage in the second place, where the data should be getting sent to.

game.Players.PlayerAdded:Connect(function(player)
	local joinData = player:GetJoinData()
	local teleportData = joinData.Teleportdata

	--[[script.Difficulty.Value = teleportData.Difficulty
	script.Map.Value = teleportData.Map
	script.Players.Value = teleportData.PlayerCount]]
	
	local difficulty = teleportData.Difficulty
	local Map = teleportData.Map
	local PlayerCount = teleportData.PlayerCount

	print(difficulty)
	print(Map)
	print(PlayerCount)
end)

4 Likes

On the third line in the second script you didn’t capitalize data

1 Like

To add onto this, exploiters can “hijack” teleportdata just to keep in mind

what would be the alternative to this?

Most likely MemoryStoreService, but don’t count me on that, I’ve not exactly messed with MSS / TeleportData for a while

For sensitive data, you should use DataStoreService or MemoryStoreService. However in this case, the values don’t seem to hold any currency or progression so it’s ok.

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