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 ?
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.