Skip to content
This repository was archived by the owner on Aug 20, 2024. It is now read-only.

Commit 179ccd9

Browse files
committed
Add new ChangeHistoryService API to SignsFree
Signed-off-by: RyanLua <[email protected]>
1 parent 4ba1d8f commit 179ccd9

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/SignsFree/PluginGui/GuiObjectPart.lua

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ function GuiObjectPart.new(
2424
local self = {}
2525
setmetatable(self, GuiObjectPart)
2626

27+
local recording = ChangeHistoryService:TryBeginRecording("NewSignPart", "Create a new SignPart")
28+
29+
if not recording then
30+
error("Could not begin recording data model changes")
31+
end
32+
2733
local camera = workspace.CurrentCamera or Instance.new("Camera")
2834

2935
local partSizeX = label.AbsoluteSize.X / 50
@@ -44,6 +50,7 @@ function GuiObjectPart.new(
4450
surfaceGui.LightInfluence = lightInfluence or 0
4551
surfaceGui.AlwaysOnTop = alwaysOnTop or false
4652
surfaceGui.AutoLocalize = autoLocalize or true
53+
surfaceGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
4754
surfaceGui.Parent = part
4855

4956
local guiObject = label:Clone()
@@ -53,15 +60,22 @@ function GuiObjectPart.new(
5360
guiObject.UIStroke:Destroy()
5461
end
5562
end
63+
if guiObject.Rotation % 90 ~= 0 then
64+
local canvas = Instance.new("CanvasGroup")
65+
canvas.BackgroundTransparency = 1
66+
canvas.Size = UDim2.new(1, 0, 1, 0)
67+
canvas.Parent = surfaceGui
68+
guiObject.Parent = canvas
69+
end
5670

5771
Selection:Set({ part })
5872

59-
ChangeHistoryService:SetWaypoint("Insert new SignPart")
60-
6173
self._part = part
6274
self._surfaceGui = surfaceGui
6375
self._guiObject = guiObject
6476

77+
ChangeHistoryService:FinishRecording(recording, Enum.FinishRecordingOperation.Commit)
78+
6579
return self
6680
end
6781

0 commit comments

Comments
 (0)