Guest User

Untitled

a guest
May 22nd, 2015
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.12 KB | None | 0 0
  1. { "PluginData":{ "Intersect":"local toolbar = plugin:CreateToolbar(\"CSG intersect\")
  2. local button = toolbar:CreateButton(
  3. \"Intersect\",
  4. \"intersect\",
  5. \"rbxassetid://242640007\"
  6. )
  7.  
  8. local forceButton = toolbar:CreateButton(
  9. \"Force CSG\",
  10. \"ForceCSG\",
  11. \"rbxassetid://245978714\"
  12. )
  13.  
  14. local storage = {}
  15.  
  16. -- Returns the intersection between a and b. Will return false if any
  17. -- Solid modeling function errors.
  18. function intersect(a, b)
  19. local parent = a.Parent
  20.  
  21. local aplus = a:Clone()
  22. aplus.Parent = parent
  23. table.insert(storage, aplus)
  24.  
  25. local amin = a:Clone()
  26. amin.Parent = parent
  27. amin = plugin:Negate({amin})[1]
  28. table.insert(storage, amin)
  29.  
  30. local bplus = b:Clone()
  31. bplus.Parent = parent
  32. table.insert(storage, bplus)
  33.  
  34. local bmin = b:Clone()
  35. bmin.Parent = parent
  36. bmin = plugin:Negate({bmin})[1]
  37. table.insert(storage, bmin)
  38.  
  39. local diffab = plugin:Union({aplus, bmin})
  40. if not diffab then return false end
  41. diffab = plugin:Negate({diffab})[1]
  42. table.insert(storage, diffab)
  43.  
  44. local diffba = plugin:Union({bplus, amin})
  45. if not diffba then return false end
  46. diffba = plugin:Negate({diffba})[1]
  47. table.insert(storage, diffba)
  48.  
  49. local plusab = plugin:Union({a,b})
  50. if not plusab then return false end
  51. table.insert(storage, plusab)
  52.  
  53. return plugin:Union({plusab, diffab, diffba})
  54. end
  55.  
  56. function copyTable(t)
  57. local copy
  58. if type(t) == \"table\" then
  59. copy = {}
  60. for i,v in next,t do
  61. copy[copyTable(i)] = copyTable(v)
  62. end
  63. setmetatable(copy, copyTable(getmetatable(t)))
  64. else
  65. copy = t
  66. end
  67. return copy
  68. end
  69.  
  70.  
  71. function forceFuckingCSG(objects)
  72. local length = #objects
  73. for i=1,length do
  74. for v=1,length do
  75. local objects = copyTable(objects)
  76. local removed = table.remove(objects, i)
  77. table.insert(objects, v, removed)
  78.  
  79. --local success = pcall(function()
  80. print(\"Trying\")
  81. coroutine.resume(coroutine.create(function() plugin:Union(objects) end))
  82. --end)
  83. game:service(\"RunService\").RenderStepped:wait()
  84. if #game.Selection:Get() == 0 then
  85. return true
  86. end
  87. end
  88. end
  89. end
  90.  
  91. button.Click:connect(function()
  92. local objects = game.Selection:Get()
  93.  
  94. -- Create a table to hold a copy of the original objects. If any solid modeling function fails
  95. -- we want to use this table to restore the parts to their original state.
  96.  
  97. local copy = {}
  98. for _, thing in pairs(objects) do
  99. local copy0 = thing:Clone()
  100. copy0.Parent = thing.Parent
  101. table.insert(copy, copy0)
  102.  
  103. -- Also using this loop to start keeping a reference of all new solid modeling parts. If a
  104. -- function fails we will want to delete all of these parts to keep the workspace clean
  105. table.insert(storage, thing)
  106. end
  107.  
  108. -- Get the first object in the selection and then try to intersect that with every other object in
  109. -- the selection one at a time.
  110. local first = objects[1]
  111. for i = 2, #objects do
  112. -- If intersect function fails then clear all of the newly created objects to keep the workspace
  113. -- clean
  114. if not intersect( first, objects[i] ) then
  115. for _, thing in pairs(storage) do
  116. if thing then thing:Destroy() end
  117. end
  118. storage = nil
  119. error(\"Error creating intersection of the selected parts.\")
  120. return
  121. end
  122. end
  123.  
  124. -- If we got to this point then all of the intersection operations succeded. Set an undo waypoint so
  125. -- user can undo the operation.
  126. game:GetService(\"ChangeHistoryService\"):SetWaypoint(\"intersection\")
  127.  
  128. -- Since the operation succeeded then we do not need the original parts. Clear these out.
  129. for _, thing in pairs(copy) do
  130. if thing then thing:Destroy() end
  131. end
  132. end)
  133.  
  134. forceButton.Click:connect(function()
  135. local success = forceFuckingCSG(game.Selection:Get())
  136. if not success then
  137. warn(\"Could not union selection :(\")
  138. end
  139. end)", "StarterGearRemover":"game.Players.PlayerAdded:connect(function(player)
  140. local childAdded; childAdded = player:WaitForChild(\"StarterGear\").ChildAdded:connect(function(child)
  141. local gearAdded; gearAdded = player.Character.ChildAdded:connect(function(gear)
  142. if gear.ClassName == child.ClassName and gear.Name == child.Name then
  143. spawn(function() gear:Destroy() end)
  144. gearAdded:disconnect()
  145. end
  146. end)
  147. delay(1, function()
  148. gearAdded:disconnect()
  149. end)
  150. childAdded:disconnect()
  151. end)
  152. delay(1, function()
  153. childAdded:disconnect()
  154. end)
  155. end)", "StickyNotes":"local notes
  156. local noteGui = Instance.new(\"ScreenGui\", game.CoreGui)
  157. repeat wait(10) until false
  158. noteGui.Name = \"StickyNoteGui\"
  159. local inputService = game:GetService(\"UserInputService\")
  160. local mousePosition
  161.  
  162. local noteCreation do
  163. local note = Instance.new(\"Frame\", script)
  164. note.Name = \"Note\"
  165. note.BackgroundColor3 = Color3.new(253/255, 252/255, 191/255)
  166. note.Size = UDim2.new(0,200,0,200)
  167.  
  168. local content = Instance.new(\"ScrollingFrame\", note)
  169. content.Name = \"Content\"
  170. content.BackgroundTransparency = 1
  171. content.Position = UDim2.new(0,5,0,25)
  172. content.Size = UDim2.new(1,-10,1,-30)
  173.  
  174. local text = Instance.new(\"TextBox\", content)
  175. text.Name = \"Text\"
  176. text.Font = \"SourceSans\"
  177. text.BackgroundTransparency = 1
  178. text.Size = UDim2.new(1,0,0,9999)
  179. text.FontSize = \"Size24\"
  180. text.Text = \"\"
  181. text.TextXAlignment = \"Left\"
  182. text.TextYAlignment = \"Top\"
  183. text.TextWrapped = true
  184. text.ClearTextOnFocus = false
  185.  
  186. local header = Instance.new(\"TextButton\", note)
  187. header.ZIndex = 2
  188. header.Name = \"Header\"
  189. header.Text = \"\"
  190. header.BackgroundColor3 = Color3.new(0,0,0)
  191. header.BackgroundTransparency = 0.9
  192. header.Size = UDim2.new(0,200,0,20)
  193. header.Draggable = true
  194.  
  195. local x = Instance.new(\"TextButton\", header)
  196. x.ZIndex = 2
  197. x.Name = \"Exit\"
  198. x.BackgroundColor3 = Color3.new(0,0,0)
  199. x.BackgroundTransparency = 0.9
  200. x.Position = UDim2.new(1,-20,0,0)
  201. x.Size = UDim2.new(0,20,0,20)
  202. x.Font = \"Legacy\"
  203. x.FontSize = \"Size11\"
  204. x.Text = \"X\"
  205.  
  206. local color = Instance.new(\"ImageButton\", header)
  207. color.ZIndex = 2
  208. color.Name = \"Color\"
  209. color.Image = \"rbxassetid://188940761\"
  210. color.BackgroundTransparency = 1
  211. color.Position = UDim2.new(0,2,0,2)
  212. color.Size = UDim2.new(0,16,0,16)
  213.  
  214. local colorPicker = Instance.new(\"Frame\", header)
  215. colorPicker.Name = \"ColorPicker\"
  216. colorPicker.Visible = false
  217. colorPicker.BackgroundColor3 = Color3.new(0,0,0)
  218. colorPicker.BackgroundTransparency = 0.3
  219. colorPicker.Size = UDim2.new(0,20,0,128)
  220. colorPicker.Position = UDim2.new(0,0,0,20)
  221. colorPicker.ZIndex = 2
  222.  
  223. local function newButton(color)
  224. local button = Instance.new(\"TextButton\", colorPicker)
  225. button.Text = \"\"
  226. button.BackgroundColor3 = color
  227. button.Size = UDim2.new(0,16,0,16)
  228. button.Position = UDim2.new(0,2,0,2 + (#colorPicker:GetChildren()-1)*18)
  229. button.ZIndex = 2
  230. end
  231.  
  232. newButton(Color3.new(253/255, 252/255, 191/255))
  233. newButton(Color3.new(200/255, 230/255, 247/255))
  234. newButton(Color3.new(196/255, 245/255, 191/255))
  235. newButton(Color3.new(245/255, 245/255, 245/255))
  236. newButton(Color3.new(240/255, 192/255, 240/255))
  237. newButton(Color3.new(207/255, 196/255, 254/255))
  238. end
  239.  
  240. function newSticky(v)
  241. local note = script.Note:clone()
  242. local header = note.Header
  243. header.Parent = noteGui
  244. local v = v or Instance.new(\"StringValue\", notes)
  245. local color = v:FindFirstChild(\"Color\") and v.Color.Value or Color3.new(253/255, 252/255, 191/255)
  246. local position = v:FindFirstChild(\"Position\") and UDim2.new(0,v.Position.Value.X, 0,v.Position.Value.Y) or UDim2.new(0,0,0,0)
  247. note.BackgroundColor3 = color
  248. note.Position = position
  249. note.Content.Text.Text = v.Value
  250. note.Content.CanvasSize = UDim2.new(0,0,0,note.Content.Text.TextBounds.Y)
  251.  
  252. note.Content.Text.Text = v.Value
  253. note.BackgroundColor3 = color
  254. note.Position = position
  255. header.Position = position
  256.  
  257. header.Exit.MouseButton1Click:connect(function()
  258. v:Destroy()
  259. header:Destroy()
  260. note:Destroy()
  261. end)
  262.  
  263. header.Color.MouseButton1Click:connect(function()
  264. header.ColorPicker.Visible = not header.ColorPicker.Visible
  265. end)
  266.  
  267. for _,button in pairs(header.ColorPicker:GetChildren()) do
  268. button.MouseButton1Click:connect(function()
  269. note.BackgroundColor3 = button.BackgroundColor3
  270. local colorValue = v:FindFirstChild(\"Color\") or Instance.new(\"Color3Value\", v)
  271. colorValue.Name = \"Color\"
  272. colorValue.Value = button.BackgroundColor3
  273. header.ColorPicker.Visible = false
  274. end)
  275. end
  276.  
  277. header.Changed:connect(function(property)
  278. if property == \"AbsolutePosition\" then
  279. local position = v:FindFirstChild(\"Position\") or Instance.new(\"Vector3Value\", v)
  280. position.Name = \"Position\"
  281. position.Value = Vector3.new(header.AbsolutePosition.X, header.AbsolutePosition.Y,0)
  282. if note.Position ~= UDim2.new(0,position.Value.X,0,position.Value.Y) then
  283. note.Position = UDim2.new(0,position.Value.X,0,position.Value.Y)
  284. end
  285. end
  286. end)
  287.  
  288. note.Content.Text.FocusLost:connect(function()
  289. v.Value = note.Content.Text.Text
  290. end)
  291.  
  292. note.Parent = noteGui
  293.  
  294. if mousePosition then
  295. header.Position = UDim2.new(0,mousePosition.X, 0,mousePosition.Y)
  296. end
  297. end
  298.  
  299. function loadStickies()
  300. noteGui:ClearAllChildren()
  301. for _,v in pairs(notes:GetChildren()) do
  302. if v:IsA(\"StringValue\") then
  303. newSticky(v)
  304. end
  305. end
  306. end
  307.  
  308. if not game:FindFirstChild(\"StickyNotes\") then
  309. notes = Instance.new(\"Glue\", game)
  310. notes.Name = \"StickyNotes\"
  311. Instance.new(\"BoolValue\", notes).Name = \"Hidden\"
  312. notes.Hidden.Value = true
  313. game.ChildAdded:connect(function(child)
  314. if child.Name == \"StickyNotes\" then
  315. notes:Destroy()
  316. notes = child
  317. noteGui.Parent = (notes.Hidden.Value) and script or game.CoreGui
  318. loadStickies()
  319. end
  320. end)
  321. notes.Parent = game
  322. noteGui.Parent = script
  323. else
  324. notes = game.StickyNotes
  325. if notes.Hidden.Value then
  326. noteGui.Parent = script
  327. else
  328. noteGui.Parent = game.CoreGui
  329. end
  330. end
  331.  
  332. loadStickies()
  333. if notes.Hidden.Value and #noteGui:GetChildren() > 0 then
  334. print(notes.Hidden.Value)
  335. print(#noteGui:GetChildren()/2 .. \" Sticky Notes Exist\")
  336. end
  337.  
  338. game.Players.PlayerAdded:connect(function()
  339. noteGui:Destroy()
  340. loadStickies = function() end
  341. newSticky = function() end
  342. end)
  343.  
  344. local altDown
  345. local rightClickDown
  346.  
  347. inputService.InputBegan:connect(function(input)
  348. if input.UserInputType.Name == \"MouseButton2\" then
  349. rightClickDown = true
  350. if altDown and rightClickDown and not notes.Hidden.Value then
  351. newSticky()
  352. end
  353. elseif input.KeyCode and input.KeyCode.Name == \"LeftAlt\" then
  354. altDown = true
  355. elseif input.KeyCode.Name == \"Backquote\" then
  356. notes.Hidden.Value = not notes.Hidden.Value
  357. if notes.Hidden.Value then
  358. noteGui.Parent = script
  359. else
  360. noteGui.Parent = game.CoreGui
  361. end
  362. end
  363.  
  364. end)
  365.  
  366. inputService.InputEnded:connect(function(input)
  367. if input.UserInputType.Name == \"MouseButton2\" then
  368. rightClickDown = false
  369. elseif input.KeyCode and input.KeyCode.Name == \"LeftAlt\" then
  370. altDown = false
  371. end
  372. end)
  373.  
  374. inputService.InputChanged:connect(function(input)
  375. if input.UserInputType.Name == \"MouseMovement\" then
  376. mousePosition = Vector2.new(input.Position.X, input.Position.Y)
  377. end
  378. end)
  379.  
  380. ", "PartCount":"_G.PartCount = function()
  381. local partCount = 0
  382. local selection = game.Selection:Get()
  383.  
  384. local function recurse(root,callback)
  385. for i,v in pairs(root:GetChildren()) do
  386. callback(i,v)
  387.  
  388. if #v:GetChildren() > 0 then
  389. recurse(v,callback)
  390. end
  391. end
  392. end
  393.  
  394. for _,selectionItem in next,selection do
  395. recurse(selectionItem, function(_,v)
  396. if v:IsA(\"BasePart\") then
  397. partCount = partCount + 1
  398. end
  399. end)
  400. if selectionItem:IsA(\"BasePart\") then
  401. partCount = partCount + 1
  402. end
  403. end
  404.  
  405. print(\"Total of\", partCount, \"parts in selection.\")
  406. end
  407.  
  408. function recurse(root,callback)
  409. for i,v in pairs(root:GetChildren()) do
  410. callback(i,v)
  411.  
  412. if #v:GetChildren() > 0 then
  413. recurse(v,callback)
  414. end
  415. end
  416. end
  417.  
  418. _G.recurse = recurse
  419.  
  420. local function reflectOne(part, mirror, mod)
  421.  
  422. local x,y,z,r00,r01,r02,r10,r11,r12,r20,r21,r22 = mirror.CFrame:toObjectSpace(part.CFrame):components()
  423.  
  424. local mpart = part:Clone()
  425.  
  426. mpart.CFrame = mirror.CFrame:toWorldSpace(CFrame.new(-x,y,z,r00,-r01,-r02,-r10,r11,r12,-r20,r21,r22))
  427.  
  428. -- CornerWedgeParts are not symmetric so we rotate 90 degrees about
  429. -- the y axis and exchange the x and z sizes. (Currently only works
  430. -- right with integer sized parts since we cannot script other resolutions.)
  431. if part.className == \"CornerWedgePart\" then
  432.  
  433. mpart.Size = Vector3.new(mpart.Size.z, mpart.Size.y, mpart.Size.x)
  434. mpart.CFrame = mpart.CFrame * CFrame.Angles(0,math.rad(90),0)
  435. end
  436.  
  437. mpart.Parent = mod
  438. end
  439.  
  440. ------------------------------------------------------------
  441. -- Clone and reflect all Parts and WedgeParts in everything in this
  442. -- model and recursively all contained models.
  443.  
  444. local function reflectAll( srcModel, mirror, tgtModel )
  445.  
  446. for k,v in pairs(srcModel:GetChildren()) do
  447.  
  448. if v.className == \"Model\" then
  449. local m2 = Instance.new(\"Model\", tgtModel)
  450. m2.Name = v.Name
  451.  
  452. reflectAll(v, mirror, m2)
  453.  
  454. elseif v:IsA(\"BasePart\") then
  455.  
  456. reflectOne(v, mirror, tgtModel)
  457.  
  458. else
  459. local np = v:Clone()
  460. np.Parent = tgtModel
  461. end
  462. end
  463. end
  464.  
  465.  
  466. ------------------------------------------------------------
  467. function _G.reflect()
  468.  
  469. local list = game.Selection:Get()
  470. if (not list) or (#list ~= 2) then
  471. error \"Select both the model to be reflected and the mirror part\"
  472. end
  473.  
  474. local model = list[1]
  475. local mirror = list[2]
  476.  
  477. if model.className ~= \"Model\" then
  478. model,mirror = mirror,model
  479. end
  480.  
  481. if (model.className ~= \"Model\") or (not mirror:IsA(\"BasePart\")) then
  482. error \"Select both the model to be reflected and the mirror part\"
  483. end
  484.  
  485. local mmodel = Instance.new(\"Model\", model.Parent)
  486. mmodel.Name = model.Name..\"-M\"
  487.  
  488. reflectAll(model, mirror, mmodel)
  489. end
  490.  
  491. _G.drawCircle = function (CenterCFrame,Radius,Sides, height)--Outer radius.
  492. local Model=Instance.new(\"Model\",game.Workspace)
  493. local LastPoint=Vector3.new(Radius,0,0)
  494. for i=1,Sides do
  495. local Angle=i*2*math.pi/Sides
  496. local CurrentPoint=Radius*Vector3.new(math.cos(Angle),0,math.sin(Angle))
  497. local Part=Instance.new(\"Part\",Model)
  498. Part.Anchored=true
  499. Part.FormFactor=\"Custom\"
  500. local Dist=(CurrentPoint-LastPoint).magnitude
  501. Part.Size=Vector3.new(1,height,Dist)
  502. Part.CFrame=CenterCFrame*CFrame.new(LastPoint,CurrentPoint)*CFrame.new(0.5,0,-Dist/2)
  503. LastPoint=CurrentPoint
  504. end
  505. return Model
  506. end
  507.  
  508. _G.convertToBlocks = function (cylinder, numSides)
  509. _G.drawCircle(cylinder.CFrame,cylinder.Size.X/2,numSides,cylinder.Size.Y)
  510. cylinder:Destroy()
  511. end
  512.  
  513. _G.drawEllipse = function (CenterCFrame,xRadius,yRadius,Sides)--Outer radius.
  514. local Model=Instance.new(\"Model\",game.Workspace)
  515. local LastPoint=Vector3.new(xRadius,0,0)
  516. for i=1,Sides do
  517. local Angle=i*2*math.pi/Sides
  518. local CurrentPoint=Vector3.new(xRadius*math.cos(Angle),0,yRadius*math.sin(Angle))
  519. local Part=Instance.new(\"Part\",Model)
  520. Part.Anchored=true
  521. Part.FormFactor=\"Custom\"
  522. local Dist=(CurrentPoint-LastPoint).magnitude
  523. Part.Size=Vector3.new(1,1,Dist)
  524. Part.CFrame=CenterCFrame*CFrame.new(LastPoint,CurrentPoint)*CFrame.new(0.5,0,-Dist/2)
  525. LastPoint=CurrentPoint
  526. end
  527. return Model
  528. end
  529.  
  530.  
  531. ", "SpawnAtCam":"Instance.new('Part',Game.ChangeHistoryService)
  532. game.ChangeHistoryService:SetWaypoint('yolo')
  533. local camera = workspace.CurrentCamera
  534.  
  535. if game.ChangeHistoryService:GetCanUndo() then
  536. local studioCam = game.Geometry:FindFirstChild(\"StudioCam\") or Instance.new(\"CFrameValue\", game.Geometry)
  537. studioCam.Name = \"StudioCam\"
  538. camera.Changed:connect(function()
  539. studioCam.Value = camera.CoordinateFrame
  540. end)
  541. else
  542. game.Players.PlayerAdded:connect(function(player)
  543. player.CharacterAdded:wait()
  544. wait(0.1)
  545. local studioCam = game.Geometry:WaitForChild(\"StudioCam\")
  546. player.Character.Torso.CFrame = CFrame.new(studioCam.Value.p)
  547. end)
  548. end", "PipeCreator":"local toolbar = plugin:CreateToolbar(\"Pipe Creator\")
  549. local create = toolbar:CreateButton(
  550. \"CreatePipe\",
  551. \"Create Pipe\",
  552. \"rbxassetid://245926521\"
  553. )
  554. local newSegment = toolbar:CreateButton(
  555. \"CreatePipeSegment\",
  556. \"Create Pipe Segment\",
  557. \"rbxassetid://245926554\"
  558. )
  559.  
  560.  
  561. local pipes = {}
  562. local ignoreSizeChange
  563.  
  564. function updatePipe(pipe, point1, point2)
  565. if ignoreSizeChange then return end
  566. local targetCFrame = CFrame.new(point2.Position, point1.Position) * CFrame.new(0, 0, -(point2.Position-point1.Position).magnitude/2) * CFrame.Angles(math.pi/2,0,0)
  567. local targetSize = Vector3.new(point1.Size.X, (point2.Position-point1.Position).magnitude, point1.Size.Z)
  568. ignoreSizeChange = true
  569. if (pipe.Size-targetSize).magnitude > 0.001 then
  570. pipe.Size = targetSize
  571. end
  572. if (targetCFrame.p-pipe.CFrame.p).magnitude > 0.001 then
  573. pipe.CFrame = targetCFrame
  574. end
  575. ignoreSizeChange = false
  576. end
  577.  
  578. function createPipe(point1, point2)
  579. local objects = {point1, point2}
  580. local pipe = objects[1]:clone()
  581. pipe.Shape = \"Block\"
  582. pipe.FormFactor = \"Custom\"
  583. pipe:ClearAllChildren()
  584. Instance.new(\"CylinderMesh\", pipe)
  585. pipe.CFrame = CFrame.new(objects[2].Position, objects[1].Position) * CFrame.new(0, 0, -(objects[2].Position-objects[1].Position).magnitude/2) * CFrame.Angles(math.pi/2,0,0)
  586. pipe.Size = Vector3.new(objects[1].Size.X, (objects[2].Position-objects[1].Position).magnitude, objects[1].Size.Z)
  587. pipe.Name = \"Pipe\"
  588. objects[1].Name = \"Obj1\"
  589. objects[2].Name = \"Obj2\"
  590. pipe.Parent = workspace
  591.  
  592. pipes[pipe] = {objects[1], objects[2]}
  593.  
  594. local changedEvents = {}
  595. local function disconnect()
  596. pcall(function()
  597. for i,event in next,changedEvents do
  598. event:disconnect()
  599. changedEvents[i] = nil
  600. end
  601. end)
  602. end
  603.  
  604. local function sync(changedObject, changedProperty)
  605. changedProperty = changedProperty == \"size\" and \"DraggingV1\" or changedProperty
  606. if changedProperty ~= \"CFrame\" and changedProperty ~= \"Rotation\" and changedProperty ~= \"Position\" and changedProperty ~= \"DraggingV1\" then
  607. local items = {[objects[1]] = true, [objects[2]] = true, [pipe] = true}
  608. items[changedObject] = nil
  609.  
  610. for item in next,items do
  611. if changedProperty == \"Size\" then
  612. if changedObject == pipe then
  613. if math.abs(item.Size.magnitude - Vector3.new(pipe.Size.X, pipe.Size.X, pipe.Size.Z).magnitude) > 0.01 then
  614. local cf1 = item.CFrame
  615. item.Size = Vector3.new(pipe.Size.X, item.Size.Y, pipe.Size.Z)
  616. item.CFrame = cf1
  617. end
  618. else
  619. if item == pipe then
  620. local targetSize = Vector3.new(changedObject.Size.X, pipe.Size.Y, changedObject.Size.Z)
  621. if pipe.Size ~= targetSize then
  622. local cf1 = pipe.CFrame
  623. pipe.Size = targetSize
  624. pipe.CFrame = cf1
  625. end
  626. else
  627. if item.Size ~= changedObject.Size then
  628. local cf1 = item.CFrame
  629. item.Size = changedObject.Size
  630. item.CFrame = cf1
  631. end
  632. end
  633. end
  634. else
  635. if item[changedProperty] ~= changedObject[changedProperty] then
  636. item[changedProperty] = changedObject[changedProperty]
  637. end
  638. end
  639. end
  640. end
  641. end
  642.  
  643. local items = {[objects[1]] = true, [objects[2]] = true, [pipe] = true}
  644. for item in next,items do
  645. changedEvents[item] = item.Changed:connect(function(property)
  646. if not (pipe:IsDescendantOf(game) and objects[1]:IsDescendantOf(game) and objects[2]:IsDescendantOf(game)) then
  647. disconnect()
  648. return
  649. end
  650.  
  651. if not ignoreSizeChange then
  652. sync(item, property)
  653. spawn(function() updatePipe(pipe, objects[1], objects[2]) end)
  654. end
  655. end)
  656. end
  657. end
  658.  
  659. create.Click:connect(function()
  660. local objects = game.Selection:Get()
  661. if #objects > 1 and objects[1]:IsA(\"BasePart\") and objects[2]:IsA(\"BasePart\") then
  662. createPipe(objects[1], objects[2])
  663. end
  664. end)
  665.  
  666. newSegment.Click:connect(function()
  667. local pipe = game.Selection:Get()[1]
  668. if pipe and pipe:IsA(\"BasePart\") then
  669. local objects = {pipes[pipe][1], pipes[pipe][2]}
  670.  
  671. objects[3] = objects[1]:clone()
  672. objects[3].Name = \"Obj3\"
  673. objects[3].CFrame = CFrame.new(objects[2].Position, objects[1].Position) * CFrame.new(0,0, -(objects[2].Position-objects[1].Position).magnitude/2)
  674. objects[3].Parent = workspace
  675.  
  676. pipe:Destroy()
  677.  
  678. createPipe(objects[1], objects[3])
  679. createPipe(objects[3], objects[2])
  680. game.Selection:Set({objects[3]})
  681. end
  682. end)", "AnchorableSeats":"local patchCode = [[local seat = script.Parent
  683.  
  684. seat.ChildAdded:connect(function(seatWeld)
  685. if seatWeld.Name == \"SeatWeld\" and seatWeld:IsA(\"Weld\") then
  686. local rootPart = seatWeld.Part1
  687. local torso = rootPart.Parent:FindFirstChild(\"Torso\")
  688. local humanoid = rootPart.Parent:FindFirstChild(\"Humanoid\")
  689.  
  690. if rootPart and torso and humanoid and game.Players:GetPlayerFromCharacter(rootPart.Parent) then
  691. rootPart.CFrame = seat.CFrame * CFrame.new(0,seat.Size.Y/2 + 1.5,0)
  692. humanoid.Sit = true
  693. if torso:FindFirstChild(\"Left Hip\") then
  694. torso[\"Left Hip\"].DesiredAngle = -1.57
  695. end
  696. if torso:FindFirstChild(\"Left Shoulder\") then
  697. torso[\"Left Shoulder\"].DesiredAngle = -1.57
  698. end
  699. if torso:FindFirstChild(\"Right Hip\") then
  700. torso[\"Right Hip\"].DesiredAngle = 1.57
  701. end
  702. if torso:FindFirstChild(\"Right Shoulder\") then
  703. torso[\"Right Shoulder\"].DesiredAngle = 1.57
  704. end
  705. else
  706. spawn(function() seatWeld:Destroy() end)
  707. end
  708. end
  709. end)]]
  710.  
  711. function patch(seat)
  712. local isPatched
  713. for _,script in pairs(seat:GetChildren()) do
  714. if script:IsA(\"Script\") and script.Source == patchCode then
  715. isPatched = true
  716. break
  717. end
  718. end
  719.  
  720. if not isPatched then
  721. local patch = Instance.new(\"Script\")
  722. patch.Source = patchCode
  723. patch.Name = \"SeatPatch\"
  724. patch.Parent = seat
  725. end
  726. end
  727.  
  728. game.DescendantAdded:connect(function(seat)
  729. pcall(function()
  730. if seat:IsA(\"Seat\") then
  731. patch(seat)
  732. end
  733. end)
  734. end)", "ReplicatedFirstPlaySolo":"function cloneReplicatedFirst(playergui)
  735. for _,item in pairs(game.ReplicatedFirst:GetChildren()) do
  736. item:clone().Parent = playergui
  737. end
  738. end
  739.  
  740. game.Players.PlayerAdded:connect(function(player)
  741. if game.Players.LocalPlayer then
  742. cloneReplicatedFirst(game.Players.LocalPlayer:WaitForChild(\"PlayerGui\"))
  743. end
  744. end)" }}
Add Comment
Please, Sign In to add comment