2025-09-17 21:37:53 +02:00
|
|
|
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");
|
2025-09-20 19:41:32 +02:00
|
|
|
|
|
|
|
|
Selection.Set([]);
|
|
|
|
|
Selection.Set([room]);
|
2025-09-17 21:37:53 +02:00
|
|
|
});
|
|
|
|
|
}
|