--!strict local ReplicatedStorage = game:GetService("ReplicatedStorage") local TeleportService: TeleportService = game:GetService("TeleportService") local DataHandler = require(ReplicatedStorage:WaitForChild("DataHandler", nil)) local protocols = ReplicatedStorage:WaitForChild("Protocols", nil) local templates = ReplicatedStorage:WaitForChild("Templates", nil) local function grabUserData(player: Player) -- put code here return {} -- placeholder end local TeleportHandler = {} function TeleportHandler.teleportEvent(player: Player, placeId: number, placeName: string, teleportType: string): () local userData = grabUserData(player) if userData then local teleportData = userData["PlayerData"] if teleportType == "play" then TeleportService:Teleport(placeId , player, teleportData, templates.Guis.LoadingGui) local returnPlace = protocols:FindFirstChild("ReturnPlace", false) if returnPlace and returnPlace:IsA("RemoteEvent") then returnPlace:FireClient(player, tostring(placeName)) end elseif teleportType == "solo" then local reservedServerAccessCode, privateServerId = TeleportService:ReserveServer(placeId) TeleportService:TeleportToPrivateServer(placeId, reservedServerAccessCode, {player}, nil, teleportData) local returnPlace = protocols:FindFirstChild("ReturnPlace", false) if returnPlace and returnPlace:IsA("RemoteEvent") then returnPlace:FireClient(player, tostring(placeName)) end end end end return TeleportHandler