Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

TeleportService Sending Data Will Not Do It?

Script In Game1

local rep = game:GetService("ReplicatedStorage")
local Chose = rep:WaitForChild("Chose")
local TeleportService = game:GetService("TeleportService")

Chose.OnServerEvent:Connect(function(Player,Game,Lvl)
	print(Lvl)
	wait(2)
	TeleportService:Teleport(Game,Player,Lvl)
end)

Local Script In Game1 -- Fires Event To Teleport

local Game = 2039763250
local Player = game.Players.LocalPlayer
local Levels = script.Parent:WaitForChild("Levels")
local LvlInfo = script.Parent:WaitForChild("LvlInfo")
local rep = game:GetService("ReplicatedStorage")
local Chose = rep:WaitForChild("Chose")

Levels.a.MouseButton1Click:Connect(function()
	local Desc = Levels.a.Desc
	local Name = Levels.a.Namee
	local Img = Levels.a.Img
	
	LvlInfo.Visible = true
	LvlInfo.LvlImg.Image = Img.Value
	LvlInfo.LvlName.Text = Name.Value
	LvlInfo.LvlDesc.Text = Desc.Value
end)

Levels.b.MouseButton1Click:Connect(function()
	local Desc = Levels.b.Desc
	local Name = Levels.b.Namee
	local Img = Levels.b.Img
	
	LvlInfo.Visible = true
	LvlInfo.LvlImg.Image = Img.Value
	LvlInfo.LvlName.Text = Name.Value
	LvlInfo.LvlDesc.Text = Desc.Value
end)

LvlInfo.Play.MouseButton1Click:Connect(function()
	Chose:FireServer(Game,tostring(LvlInfo.LvlName.Text))
end)

Script In Game2

local TeleData = game:GetService("TeleportService"):GetLocalPlayerTeleportData()

print(TeleData)

When I want it to print TeleData it prints nil ?

1 answer

✓ Accepted answer

Honestly haven't experimented with the TeleportService too much, but in Game2 instead of using GetLocalPlayerTeleportData you could try using the LocalPlayerArrivedFromTeleport event found at the bottom of this page wiki.roblox.com/index.php?title=API:Class/TeleportService. It takes a ScreenGui argument as well as the data you are sending over.

This discussion is preserved as it was. New answers, comments, and votes are closed.