Engine Class
PVInstance
*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่
สรุป
คุณสมบัติ
เอกสารอ้างอิงเกี่ยวกับ API
คุณสมบัติ
วิธีการ
GetPivot
ส่งค่ากลับ
ตัวอย่างโค้ด
การโทรตัวละครอย่างง่าย
-- โค้ดนี้ควรอยู่ใน LocalScript ภายใต้ StarterPlayerScripts
local Players = game:GetService("Players")
local ContextActionService = game:GetService("ContextActionService")
local player = Players.LocalPlayer
local function doTeleport(_actionName, inputState, _inputObject)
local character = player.Character
if character and character.Parent and inputState == Enum.UserInputState.Begin then
-- ย้ายตัวละครไปข้างหน้า 10 สตัดในทิศทางที่พวกเขากำลังเผชิญ
local currentPivot = character:GetPivot()
character:PivotTo(currentPivot * CFrame.new(0, 0, -10))
end
end
ContextActionService:BindAction("Teleport", doTeleport, true, Enum.KeyCode.F)PivotTo
พารามิเตอร์
ส่งค่ากลับ
()
ตัวอย่างโค้ด
การโทรตัวละครอย่างง่าย
-- โค้ดนี้ควรอยู่ใน LocalScript ภายใต้ StarterPlayerScripts
local Players = game:GetService("Players")
local ContextActionService = game:GetService("ContextActionService")
local player = Players.LocalPlayer
local function doTeleport(_actionName, inputState, _inputObject)
local character = player.Character
if character and character.Parent and inputState == Enum.UserInputState.Begin then
-- ย้ายตัวละครไปข้างหน้า 10 สตัดในทิศทางที่พวกเขากำลังเผชิญ
local currentPivot = character:GetPivot()
character:PivotTo(currentPivot * CFrame.new(0, 0, -10))
end
end
ContextActionService:BindAction("Teleport", doTeleport, true, Enum.KeyCode.F)