เรียนรู้
Engine Class
ChangeHistoryService
ไม่สามารถสร้าง
บริการ

*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่


สรุป
วิธีการ
FinishRecording(identifier: string,operation: Enum.FinishRecordingOperation,finalOptions: Dictionary?):()
Redo():()
SetEnabled(state: boolean):()
TryBeginRecording(name: string,displayName: string?):string?
Undo():()
เหตุการณ์
OnRecordingFinished(name: string,displayName: string?,identifier: string?,operation: Enum.FinishRecordingOperation,finalOptions: Dictionary?):RBXScriptSignal
สมาชิกที่ได้รับทอด

เอกสารอ้างอิงเกี่ยวกับ API
วิธีการ
FinishRecording
การรักษาความปลอดภัยของปลั๊กอิน
ChangeHistoryService:FinishRecording(
identifier:string, operation:Enum.FinishRecordingOperation, finalOptions:Dictionary?
):()
พารามิเตอร์
identifier:string
finalOptions:Dictionary?
ส่งค่ากลับ
()
ตัวอย่างโค้ด
ChangeHistoryService:TryBeginRecording
local ChangeHistoryService = game:GetService("ChangeHistoryService")
local Selection = game:GetService("Selection")
local toolbar = plugin:CreateToolbar("ตัวอย่างปลั๊กอิน")
local button = toolbar:CreateButton("ทำให้เป็นนีออน", "", "")
button.Click:Connect(function()
local parts = {}
for _, part in pairs(Selection:Get()) do
if part:IsA("BasePart") then
parts[#parts + 1] = part
end
end
if #parts < 1 then
-- ไม่มีอะไรให้ทำ.
return
end
local recording = ChangeHistoryService:TryBeginRecording("ตั้งค่าการเลือกเป็นนีออน")
if not recording then
-- จัดการข้อผิดพลาดที่นี่ นี่แสดงว่ายูทิลิตี้ของคุณเริ่มการบันทึกก่อนหน้านี้
-- และไม่เคยเสร็จสิ้นมัน คุณสามารถมีการบันทึกเพียงรายการเดียว
-- ที่เปิดใช้งานต่อปลั๊กอินในคราวเดียว.
return
end
for _, part in pairs(parts) do
part.Material = Enum.Material.Neon
end
ChangeHistoryService:FinishRecording(recording, Enum.FinishRecordingOperation.Commit)
end)

GetCanRedo
การรักษาความปลอดภัยของปลั๊กอิน
ChangeHistoryService:GetCanRedo():Tuple
ส่งค่ากลับ

GetCanUndo
การรักษาความปลอดภัยของปลั๊กอิน
ChangeHistoryService:GetCanUndo():Tuple
ส่งค่ากลับ

IsRecordingInProgress
การรักษาความปลอดภัยของปลั๊กอิน
ChangeHistoryService:IsRecordingInProgress(identifier:string?):boolean
พารามิเตอร์
identifier:string?
ส่งค่ากลับ

Redo
การรักษาความปลอดภัยของปลั๊กอิน
ChangeHistoryService:Redo():()
ส่งค่ากลับ
()

ResetWaypoints
การรักษาความปลอดภัยของปลั๊กอิน
ChangeHistoryService:ResetWaypoints():()
ส่งค่ากลับ
()

SetEnabled
การรักษาความปลอดภัยของปลั๊กอิน
ChangeHistoryService:SetEnabled(state:boolean):()
พารามิเตอร์
state:boolean
ส่งค่ากลับ
()

SetWaypoint
การรักษาความปลอดภัยของปลั๊กอิน
ChangeHistoryService:SetWaypoint(name:string):()
พารามิเตอร์
name:string
ส่งค่ากลับ
()
ตัวอย่างโค้ด
ChangeHistoryService:SetWaypoint
local ChangeHistoryService = game:GetService("ChangeHistoryService")
local Selection = game:GetService("Selection")
local toolbar = plugin:CreateToolbar("Example Plugin")
local button = toolbar:CreateButton("Neon it up", "", "")
button.Click:Connect(function()
local parts = {}
for _, part in pairs(Selection:Get()) do
if part:IsA("BasePart") then
parts[#parts + 1] = part
end
end
if #parts > 0 then
-- การเรียก SetWaypoint ก่อนทำงานจะไม่ก่อให้เกิดปัญหา แต่
-- มันเกินความจำเป็น เพียงแค่การเรียกหลังจากทำงานเท่านั้นที่จำเป็น.
--ChangeHistoryService:SetWaypoint("Setting selection to neon")
for _, part in pairs(parts) do
part.Material = Enum.Material.Neon
end
-- เรียก SetWaypoint หลังจากทำงานเสร็จสิ้น
ChangeHistoryService:SetWaypoint("Set selection to neon")
else
-- ไม่มีอะไรต้องทำ คุณไม่ต้องเรียก SetWaypoint ในกรณีที่
-- การกระทำไม่ได้ทำการเปลี่ยนแปลงใดๆ ต่อประสบการณ์.
end
end)

TryBeginRecording
การรักษาความปลอดภัยของปลั๊กอิน
ChangeHistoryService:TryBeginRecording(
name:string, displayName:string?
พารามิเตอร์
name:string
displayName:string?
ส่งค่ากลับ
ตัวอย่างโค้ด
ChangeHistoryService:TryBeginRecording
local ChangeHistoryService = game:GetService("ChangeHistoryService")
local Selection = game:GetService("Selection")
local toolbar = plugin:CreateToolbar("ตัวอย่างปลั๊กอิน")
local button = toolbar:CreateButton("ทำให้เป็นนีออน", "", "")
button.Click:Connect(function()
local parts = {}
for _, part in pairs(Selection:Get()) do
if part:IsA("BasePart") then
parts[#parts + 1] = part
end
end
if #parts < 1 then
-- ไม่มีอะไรให้ทำ.
return
end
local recording = ChangeHistoryService:TryBeginRecording("ตั้งค่าการเลือกเป็นนีออน")
if not recording then
-- จัดการข้อผิดพลาดที่นี่ นี่แสดงว่ายูทิลิตี้ของคุณเริ่มการบันทึกก่อนหน้านี้
-- และไม่เคยเสร็จสิ้นมัน คุณสามารถมีการบันทึกเพียงรายการเดียว
-- ที่เปิดใช้งานต่อปลั๊กอินในคราวเดียว.
return
end
for _, part in pairs(parts) do
part.Material = Enum.Material.Neon
end
ChangeHistoryService:FinishRecording(recording, Enum.FinishRecordingOperation.Commit)
end)

Undo
การรักษาความปลอดภัยของปลั๊กอิน
ChangeHistoryService:Undo():()
ส่งค่ากลับ
()

เหตุการณ์
OnRecordingFinished
การรักษาความปลอดภัยของปลั๊กอิน
ChangeHistoryService.OnRecordingFinished(
name:string, displayName:string?, identifier:string?, operation:Enum.FinishRecordingOperation, finalOptions:Dictionary?
พารามิเตอร์
name:string
displayName:string?
identifier:string?
finalOptions:Dictionary?

OnRecordingStarted
การรักษาความปลอดภัยของปลั๊กอิน
ChangeHistoryService.OnRecordingStarted(
name:string, displayName:string?
พารามิเตอร์
name:string
displayName:string?

OnRedo
การรักษาความปลอดภัยของปลั๊กอิน
ChangeHistoryService.OnRedo(waypoint:string):RBXScriptSignal
พารามิเตอร์
waypoint:string

OnUndo
การรักษาความปลอดภัยของปลั๊กอิน
ChangeHistoryService.OnUndo(waypoint:string):RBXScriptSignal
พารามิเตอร์
waypoint:string

©2026 Roblox Corporation. Roblox, โลโก้ Roblox และ Powering Imagination เป็นส่วนหนึ่งของเครื่องหมายการค้าที่จดทะเบียน และไม่ได้จดทะเบียนของเราในสหรัฐฯ และประเทศอื่นๆ