yes
This commit is contained in:
35
src/Toolbar/Buttons.ts
Normal file
35
src/Toolbar/Buttons.ts
Normal 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");
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user