This commit is contained in:
2025-09-17 21:37:53 +02:00
parent 1003e84648
commit 1c6cd065db
11 changed files with 92 additions and 25 deletions

35
src/Toolbar/Buttons.ts Normal file
View File

@@ -0,0 +1,35 @@
const Selection = game.GetService("Selection");
const ChangeHistoryService = game.GetService("ChangeHistoryService");
export function createNewRoomButton(toolbar: PluginToolbar) {
const newRoomButton = toolbar.CreateButton("New Room", "New Room", "rbxassetid://14978048121");
newRoomButton.Click.Connect(function () {
const selectedObjects = Selection.Get();
if (selectedObjects.isEmpty()) return;
const room = selectedObjects[0];
if (!room.IsA("Model")) return;
const config = new Instance("Configuration");
config.Name = "RoomConfig";
config.Parent = room;
const origin = new Instance("Vector3Value");
origin.Name = "Origin";
origin.Parent = config;
origin.Value = room.GetPivot().Position;
const endvalue = new Instance("Vector3Value");
endvalue.Name = "End";
endvalue.Parent = config;
endvalue.Value = room.GetPivot().Position;
const roomtype = new Instance("StringValue");
roomtype.Name = "RoomType";
roomtype.Parent = config;
const roomId = new Instance("IntValue");
roomId.Name = "RoomId";
roomId.Parent = config;
ChangeHistoryService.SetWaypoint("Added new room config");
});
}