What does TeleportService do? and how do you use it?

I am trying to make a player teleport to a different game once they reach the required level. I tried to make a script that would do that but I don’t know what type of script to use for it or how TeleportService works.

My script:

local TeleportService = game:GetService("TeleportService")
local Player = game:GetService("Players")
local Teleport = workspace.TeleporterHolder.AbyssTeleporter

local PlaceID = 6364259010

script.Parent.Touched:Connect(function(hit)
        if hit then
            local leaderstats = Player:WaitForChild("leaderstats")
            local Level = leaderstats:WaitForChild("Level")
            if Player.Level.Value <= 1 then
                TeleportService:Teleport(false)
                print("Player Level did not met Level Requirment")
                if Player.Level.Value >= 1 then
                    print("Teleport Starting")
                    TeleportService:Teleport(PlaceID)
                end
            end
        end
    end
1 Like

Devwiki saves the day