Misal kita punya lebih dari satu map dalam game Roblox kita, caranya agar player bisa berpindah place, buat trigger yang berisi script ini:
local TeleportService = game:GetService("TeleportService")
local placeId = 123123123 -- ganti dengan PlaceId tujuan
local part = script.Parent
part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local character = player.Character
if character then
-- Bekukan player
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
end
-- Pindahkan player jauh ke bawah map (aman dari musuh)
local hrp = character:FindFirstChild("HumanoidRootPart")
if hrp then
hrp.CFrame = CFrame.new(0, -5000, 0) -- koordinat jauh di bawah
end
end
-- Tambah overlay hitam di layar player
local gui = Instance.new("ScreenGui")
gui.IgnoreGuiInset = true
gui.ResetOnSpawn = false
gui.Name = "TeleportBlackout"
local frame = Instance.new("Frame")
frame.Size = UDim2.new(1, 0, 1, 0)
frame.BackgroundColor3 = Color3.new(0, 0, 0)
frame.BorderSizePixel = 0
frame.Parent = gui
gui.Parent = player:WaitForChild("PlayerGui")
-- Lanjut teleport
TeleportService:Teleport(placeId, player)
end
end)