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)