Advertisement
Richbadniss

Building System HANDLER

Oct 20th, 2021
1,378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.63 KB | None | 0 0
  1. --Made By DexxterDax
  2. -- 1/21/2021
  3. local Player = game.Players.LocalPlayer
  4. local Mouse = Player:GetMouse()
  5. local Functions = require(game:GetService('ReplicatedStorage').Modules.TycoonFunctions)
  6. local Cam = workspace.CurrentCamera
  7. local UIS = game:GetService('UserInputService')
  8. local RunService = game:GetService('RunService')
  9. local Event = game:GetService('ReplicatedStorage').Event
  10.  
  11. local Editing = false
  12. local EditCam = false
  13. local PlacingItem = false
  14. local Button2Down = false
  15. local OldMousePos
  16. local EditingWalls
  17. local CamRegion3
  18. local CurrentlyPlacing
  19. local PlotRegion3
  20.  
  21. local WDown = false
  22. local ADown = false
  23. local SDown = false
  24. local DDown = false
  25. local QDown = false
  26. local EDown = false
  27.  
  28. local RegionPoint1
  29. local RegionPoint2
  30.  
  31. local Tycoons = workspace.TycoonHolder
  32. local Tycoon
  33.  
  34. spawn(function()
  35.     repeat wait() until Functions.PlayerHasTycoon(Player)
  36.     Tycoon = Functions.GetTycoonFromPlayer(Player)
  37. end)
  38.  
  39. function CreateRegion3FromLocAndSize(Position, Size)
  40.     local SizeOffset = Size/2
  41.     RegionPoint1 = Position - SizeOffset
  42.     RegionPoint2 = Position + SizeOffset
  43.     return Region3.new(RegionPoint1, RegionPoint2)
  44. end
  45.  
  46. function CheckIfCamIsInRegion3(Region3)
  47.     local CheckPart = Instance.new('Part', workspace)
  48.     CheckPart.Anchored = true
  49.     CheckPart.Transparency = 1
  50.     CheckPart.CanCollide = false
  51.     CheckPart.Size = Vector3.new(0.05,0.05,0.05)
  52.     CheckPart.CFrame = Cam.CFrame
  53.     for _,Part in pairs(game.Workspace:FindPartsInRegion3(CamRegion3,nil,math.huge)) do
  54.         if Part == CheckPart then
  55.             CheckPart:Destroy()
  56.             return true
  57.         end
  58.     end
  59.     CheckPart:Destroy()
  60.     return false
  61. end
  62.  
  63. function IsInTable(t,v)
  64.     if t and v then
  65.         for _,c in pairs(t) do
  66.             if c == v then
  67.                 return true
  68.             end
  69.         end
  70.         return false
  71.     end
  72. end
  73.  
  74. function CheckIfPartIsInRegion3(Part, Region3)
  75.     if Part:IsA('BasePart') then
  76.         for _,v in pairs(game.Workspace:FindPartsInRegion3(Region3,nil,math.huge)) do
  77.             if Part == v then
  78.                 return true
  79.             end
  80.         end
  81.     elseif Part:IsA('Model') then
  82.         local Parts = {}
  83.         local Real = {}
  84.         for _,v in pairs(Part:GetDescendants()) do
  85.             if v:IsA('BasePart') then
  86.                 table.insert(Real, v)
  87.             end
  88.         end
  89.         local PartsInRegion3 = game.Workspace:FindPartsInRegion3(Region3,nil,math.huge)
  90.         for _,v in pairs(PartsInRegion3) do
  91.             if v:IsDescendantOf(Part) then
  92.                 table.insert(Parts,v)
  93.             end
  94.         end
  95.         for _,v in pairs(Real) do
  96.             if not IsInTable(Parts, v) then
  97.                 return false
  98.             end
  99.         end
  100.         return true
  101.     end
  102. end
  103.  
  104. Mouse.Button2Down:connect(function() Button2Down = true end)
  105. Mouse.Button2Up:connect(function() Button2Down = false end)
  106.  
  107. UIS.InputBegan:connect(function(Input, GPE)
  108.     if not GPE then
  109.         if Input then
  110.             if Editing then
  111.                 if EditCam == true and CamRegion3 then
  112.                     if Input.KeyCode == Enum.KeyCode.W then WDown = true end
  113.                     if Input.KeyCode == Enum.KeyCode.A then ADown = true end
  114.                     if Input.KeyCode == Enum.KeyCode.S then SDown = true end
  115.                     if Input.KeyCode == Enum.KeyCode.D then DDown = true end
  116.                     if Input.KeyCode == Enum.KeyCode.Q then QDown = true end
  117.                     if Input.KeyCode == Enum.KeyCode.E then EDown = true end
  118.                 end
  119.             end
  120.         end
  121.     end
  122. end)
  123.  
  124. UIS.InputEnded:connect(function(Input, GPE)
  125.     if not GPE then
  126.         if Input then
  127.             if Editing then
  128.                 if EditCam == true and PlotRegion3 then
  129.                     if Input.KeyCode == Enum.KeyCode.W then WDown = false end
  130.                     if Input.KeyCode == Enum.KeyCode.A then ADown = false end
  131.                     if Input.KeyCode == Enum.KeyCode.S then SDown = false end
  132.                     if Input.KeyCode == Enum.KeyCode.D then DDown = false end
  133.                     if Input.KeyCode == Enum.KeyCode.Q then QDown = false end
  134.                     if Input.KeyCode == Enum.KeyCode.E then EDown = false end
  135.                 end
  136.             end
  137.         end
  138.     end
  139. end)
  140.  
  141. RunService.RenderStepped:connect(function()
  142.     if EditCam then
  143.         if Editing then
  144.             if PlotRegion3 then
  145.                 local Speed = 0.15
  146.                 if UIS:IsKeyDown(Enum.KeyCode.LeftShift) then
  147.                     Speed = 0.05
  148.                 elseif UIS:IsKeyDown(Enum.KeyCode.RightShift) then
  149.                     Speed = 0.25
  150.                 end
  151.                 if WDown then
  152.                     Cam.CFrame = Cam.CFrame + Cam.CFrame.lookVector * Speed
  153.                 end
  154.                 if ADown then
  155.                     Cam.CFrame = Cam.CFrame + Cam.CFrame.rightVector * -Speed
  156.                 end
  157.                 if SDown then
  158.                     Cam.CFrame = Cam.CFrame + Cam.CFrame.lookVector * -Speed
  159.                 end
  160.                 if DDown then
  161.                     Cam.CFrame = Cam.CFrame + Cam.CFrame.rightVector * Speed
  162.                 end
  163.                 if EDown then
  164.                     Cam.CFrame = Cam.CFrame + Cam.CFrame.upVector * Speed
  165.                 end
  166.                 if QDown then
  167.                     Cam.CFrame = Cam.CFrame + Cam.CFrame.upVector * -Speed
  168.                 end
  169.                 local minCorner = RegionPoint1
  170.                 local maxCorner = RegionPoint2
  171.                 local camPos = Cam.CFrame.p
  172.                 Cam.CFrame = CFrame.new(Vector3.new(), Cam.CFrame.lookVector) + Vector3.new(
  173.                     math.clamp(camPos.X, minCorner.X, maxCorner.X),
  174.                     math.clamp(camPos.Y, minCorner.Y, maxCorner.Y),
  175.                     math.clamp(camPos.Z, minCorner.Z, maxCorner.Z)
  176.                 )
  177.             end
  178.         end
  179.     end
  180. end)
  181.  
  182. UIS.InputChanged:connect(function(inputObject)
  183.     if inputObject.UserInputType == Enum.UserInputType.MouseMovement then
  184.         if EditCam then
  185.         if Editing then
  186.             if PlotRegion3 then
  187.                 if Button2Down then
  188.                     UIS.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
  189.                     --[[pcall(function()
  190.                         if inputObject.Delta.X < OldMousePos.X then
  191.                             Cam.CFrame = Cam.CFrame*CFrame.Angles(0, 0.05, 0)
  192.                         else
  193.                             Cam.CFrame = Cam.CFrame*CFrame.Angles(0, -0.05, 0)
  194.                         end
  195.                     end)]]
  196.                     Cam.CFrame = Cam.CFrame * CFrame.Angles(math.rad(-inputObject.Delta.y/25), math.rad(-inputObject.Delta.x/25),0)
  197.                     OldMousePos = Vector2.new(inputObject.Delta.x, inputObject.Delta.Y)
  198.                 else
  199.                     UIS.MouseBehavior = Enum.MouseBehavior.Default
  200.                 end
  201.             end
  202.         end
  203.     end
  204.     end
  205. end)
  206.  
  207. UIS.InputChanged:connect(function(inputObject)
  208.     if inputObject.UserInputType == Enum.UserInputType.MouseWheel then
  209.         if EditCam then
  210.             if Editing then
  211.                 if PlotRegion3 then
  212.                     if inputObject.Position.z == 1 then
  213.                         Cam.CFrame = Cam.CFrame + Cam.CFrame.lookVector * 5
  214.                     elseif inputObject.Position.z == -1 then
  215.                         Cam.CFrame = Cam.CFrame + Cam.CFrame.lookVector * -5
  216.                     end
  217.                 end
  218.             end
  219.         end
  220.     end
  221. end)
  222.  
  223. function EnterEditMode()
  224.     if not Editing then
  225.         if Tycoon and Tycoon.Parent == workspace.TycoonHolder then
  226.             if Player.Character and Player.Character:FindFirstChild('HumanoidRootPart') and Player.Character:FindFirstChild('Humanoid').Health > 0 then
  227.                 Editing = true
  228.                 Mouse.TargetFilter = Tycoon.Purchases
  229.                 script.Parent.EditorOptions.Visible = true
  230.                 EditingWalls = Tycoon.EditingWalls
  231.                 PlotRegion3 = CreateRegion3FromLocAndSize(Tycoon.Base.Position+Vector3.new(0,40.7,0), Tycoon.Base.Size+Vector3.new(0,100,0)):ExpandToGrid(4)
  232.                 CamRegion3 = CreateRegion3FromLocAndSize(Tycoon.Base.Position+Vector3.new(0,50,0), Tycoon.Base.Size+Vector3.new(25,100,25)):ExpandToGrid(4)
  233.                
  234.                 Event:FireServer('sdgfhfgjsdhgdflkbdgdfhfghghorsih4go4sdhgfhdafgidghdidfhigdfighdfuigushdhfisdiggibsgufdnbdifughsuidfidfdgfgfghfdgg')
  235.                 Tycoon.EditingWalls.Parent = nil
  236.                 Functions.CreateGrid(Tycoon.Base)
  237.                 Cam.CameraType = Enum.CameraType.Scriptable
  238.                 Cam:Interpolate(Tycoon.EditCamPart.CFrame,(Tycoon.EditCamPart.CFrame*CFrame.Angles(0,math.rad(90),0)+Vector3.new(-5,-5,0)), 3)
  239.                 Player.Character.HumanoidRootPart.CFrame = (Tycoon.EditPlayerTele.CFrame*CFrame.Angles(0,math.rad(90),0))
  240.                 Player.Character.LowerTorso.Anchored = true
  241.                 Player.Character.Humanoid.JumpPower = 0
  242.                 Player.Character.Humanoid.WalkSpeed = 0
  243.                 wait(3)
  244.                 EditCam = true
  245.             end
  246.         end
  247.     else
  248.         warn('You are already editing!')
  249.     end
  250. end
  251.  
  252. function RoundVector(vector, unit)
  253.     return vector - Vector3.new(vector.X%unit, 0, vector.Z%unit)
  254. end
  255.  
  256. function CancelPlacement(Place)
  257.     if CurrentlyPlacing then
  258.         if Place then
  259.             local Clone = CurrentlyPlacing:Clone()
  260.             if Clone:FindFirstChild('EditorSelectionBox') then
  261.                 Clone.EditorSelectionBox:Destroy()
  262.             end
  263.             Clone.Parent = Tycoon.Purchases
  264.         end
  265.         CurrentlyPlacing:Destroy()
  266.         PlacingItem = false
  267.     end
  268. end
  269.  
  270. function StartPlacingItem(Item)
  271.     if Item then
  272.         if Editing and not PlacingItem then
  273.             if CurrentlyPlacing == nil then
  274.                 PlacingItem = true
  275.                 CurrentlyPlacing = Item
  276.                 local SB = Instance.new('SelectionBox', Item)
  277.                 SB.Name = 'EditorSelectionBox'
  278.                 SB.Adornee = Item
  279.                 SB.Color3 =  Color3.new(25,172,0)
  280.                 SB.LineThickness = 0.025
  281.                 Mouse.TargetFilter = Item
  282.                 local RenderStepped
  283.                 RenderStepped = RunService.RenderStepped:connect(function()
  284.                     if Item and Item.PrimaryPart then
  285.                         local MouseP = Mouse.Hit.p
  286.                         Item:SetPrimaryPartCFrame(CFrame.new(RoundVector(MouseP,1)+Vector3.new(0,(Item.PrimaryPart.Size.Y/2),0)))
  287.                     else
  288.                         RenderStepped:Disconnect()
  289.                     end
  290.                 end)
  291.                 local Click
  292.                 Click = Mouse.Button1Down:connect(function()
  293.                     print(CheckIfPartIsInRegion3(Item, PlotRegion3))
  294.                     print(Mouse.Target)
  295.                     if CheckIfPartIsInRegion3(Item, PlotRegion3) == true and Mouse.Target == Tycoon.Base or Mouse.Target == Tycoon.CurrentFloor then
  296.                         Click:disconnect()
  297.                         RenderStepped:Disconnect()
  298.                         CancelPlacement(false)
  299.                         Event:FireServer('fgdfhguiUHOHFOHDHOIHOHioobndofigiodhtodfoidfbhhiosngodfihIGHIHFIHTdfgdfhfbfdIIlllIIIddfsIIll434DSOIJGJIBILLllII', CurrentlyPlacing)
  300.                         PlacingItem = false
  301.                         CurrentlyPlacing = nil
  302.                         Mouse.TargetFilter = Tycoon.Purchases
  303.                     end
  304.                 end)
  305.             end
  306.         end
  307.     end
  308. end
  309.  
  310. function StartPlacingPath()
  311.     if Editing and not PlacingItem then
  312.         PlacingItem = true
  313.         local StartedToPlacePath = false
  314.         local RenderStepped
  315.         local Model = Instance.new('Model', Tycoon.Purchases.Walls)
  316.         Model.Name = 'Wall'
  317.         local PathPart1 = Instance.new('Part', Model)
  318.         PathPart1.Name = 'Pole1'
  319.         PathPart1.Anchored = true
  320.         PathPart1.Transparency = 0.2
  321.         PathPart1.Material = Enum.Material.SmoothPlastic
  322.         PathPart1.Shape = 'Cylinder'
  323.         PathPart1.Size = Vector3.new(0.2, 3, 3)
  324.         local PathPart2
  325.         local PathPart
  326.         local Click
  327.         local nope
  328.         local GeneratePath
  329.         local RenderStepped = RunService.RenderStepped:connect(function()
  330.             if not StartedToPlacePath then
  331.                 local MouseP = Mouse.Hit.p
  332.                 PathPart1.CFrame = CFrame.new(RoundVector(MouseP+Vector3.new(0,PathPart1.Size.X/2,0), 2)+Vector3.new(0.2,0,0.5))*CFrame.Angles(0,0,math.rad(90))
  333.             else
  334.                 RenderStepped:disconnect()
  335.             end
  336.         end)
  337.         Click = Mouse.Button1Down:connect(function()
  338.             RenderStepped:disconnect()
  339.             PathPart2 = Instance.new('Part', Model)
  340.             PathPart2.Name = 'Pole2'
  341.             PathPart2.Anchored = true
  342.             PathPart2.Transparency = 0.2
  343.             PathPart2.Material = Enum.Material.SmoothPlastic
  344.             PathPart2.Shape = 'Cylinder'
  345.             PathPart2.Size = Vector3.new(0.2, 3, 3)
  346.             local RenderStepped = RunService.RenderStepped:connect(function()
  347.                 local MouseP = Mouse.Hit.p
  348.                 PathPart2.CFrame = CFrame.new(RoundVector(MouseP+Vector3.new(0,PathPart2.Size.X/2,0), 2)+Vector3.new(0.2,0,0.5))*CFrame.Angles(0,0,math.rad(90))
  349.             end)
  350.             nope = Mouse.Button1Up:connect(function()
  351.                 if not Editing and not EditCam and not PlacingItem then return end
  352.                 RenderStepped:disconnect()
  353.                 GeneratePath:disconnect()
  354.                 nope:disconnect()
  355.                 PlacingItem = false
  356.                 PathPart1.Transparency = 0
  357.                 PathPart2.Transparency = 0
  358.                 PathPart.Transparency = 0
  359.                 if Click then
  360.                     Click:disconnect()
  361.                 end
  362.                 --PathPart1:Destroy()
  363.                 --PathPart2:Destroy()
  364.                 PathPart.Name = 'Hitbox'
  365.                 PathPart.Parent = Model
  366.                 PathPart.Transparency = 0
  367.                 Model.PrimaryPart = PathPart
  368.                 Event:FireServer('fgdfhguiUHOHFOHDHOIHOHioobndofigiodhtodfoidfbhhiosngodfihIGHIHFIHTdfgdfhfbfdIIlllIIIddfsIIll434DSOIJGJIBILLllII', 'Path', PathPart1.CFrame, PathPart2.CFrame)
  369.                 Model:Destroy()
  370.             end)
  371.         end)
  372.         PathPart = Instance.new('Part', Model)
  373.         PathPart.Anchored = true
  374.         PathPart.Transparency = 0.2
  375.         PathPart.Material = Enum.Material.SmoothPlastic
  376.         PathPart.Name = 'PathPart'
  377.         PathPart.Orientation = Vector3.new(0,0,math.rad(90))
  378.         PathPart.Size = Vector3.new(0.2, 3, 3)
  379.         GeneratePath = RunService.RenderStepped:connect(function()
  380.             if PathPart1 and PathPart2 then
  381.                 PathPart.Size = Vector3.new((PathPart1.Position - PathPart2.Position).Magnitude,0.2,3)
  382.                 PathPart.CFrame = CFrame.new(
  383.                     PathPart1.Position + 0.5*(PathPart2.Position - PathPart1.Position),
  384.                     PathPart1.Position + 0.5*(PathPart2.Position - PathPart1.Position) + (PathPart1.Position - PathPart2.Position).Unit:Cross(Vector3.new(0,1,0))
  385.                 )
  386.             end
  387.         end)
  388.     end
  389. end
  390.  
  391. function CheckForCollison(Thing, Tycoon)
  392.     local Region
  393.     if Thing and Tycoon then
  394.         if Thing:IsA('Model') then
  395.             if Thing.PrimaryPart then
  396.                 Region = CreateRegion3FromLocAndSize(Thing.PrimaryPart.Position, Thing.PrimaryPart.Size)
  397.             else
  398.                 warn(Thing.Name..' has no PrimaryPart.')
  399.             end
  400.         elseif Thing:IsA('BasePart') then
  401.             Region = CreateRegion3FromLocAndSize(Thing.Position, Thing.Size)
  402.         else
  403.             warn(Thing.Name..' is not Supported.')
  404.         end
  405.         if Region then
  406.             for _,Part in pairs(game.Workspace:FindPartsInRegion3(Region,nil,math.huge)) do
  407.                 if Part:IsA('BasePart') then
  408.                     if Part:IsDescendantOf(Tycoon.Purchases) and not Part:IsDescendantOf(Thing) then
  409.                         return true
  410.                     end
  411.                 end
  412.             end
  413.             return false
  414.         end
  415.     end
  416. end
  417.  
  418. function StartPlacingWall()
  419.     if Editing and not PlacingItem then
  420.         PlacingItem = true
  421.         local StartedToPlaceWall = false
  422.         local RenderStepped
  423.         local Model = Instance.new('Model', Tycoon.Purchases.Walls)
  424.         Model.Name = 'Wall'
  425.         local WallPart1 = Instance.new('Part', Model)
  426.         WallPart1.Name = 'Pole1'
  427.         WallPart1.Anchored = true
  428.         WallPart1.Transparency = 0.2
  429.         WallPart1.Material = Enum.Material.SmoothPlastic
  430.         WallPart1.Shape = 'Cylinder'
  431.         WallPart1.Size = Vector3.new(9, 0.4, 0.4)
  432.         local WallPart2
  433.         local WallPart
  434.         local Click
  435.         local nope
  436.         local GenerateWall
  437.         local RenderStepped = RunService.RenderStepped:connect(function()
  438.             if not StartedToPlaceWall then
  439.                 local MouseP = Mouse.Hit.p
  440.                 WallPart1.CFrame = CFrame.new(RoundVector(MouseP+Vector3.new(0,WallPart1.Size.X/2,0), 2)+Vector3.new(0.2,0,0.5))*CFrame.Angles(0,0,math.rad(90))
  441.             else
  442.                 RenderStepped:disconnect()
  443.             end
  444.         end)
  445.         Click = Mouse.Button1Down:connect(function()
  446.             RenderStepped:disconnect()
  447.             WallPart2 = Instance.new('Part', Model)
  448.             WallPart2.Name = 'Pole2'
  449.             WallPart2.Anchored = true
  450.             WallPart2.Transparency = 0.2
  451.             WallPart2.Material = Enum.Material.SmoothPlastic
  452.             WallPart2.Shape = 'Cylinder'
  453.             WallPart2.Size = Vector3.new(9, 0.4, 0.4)
  454.             local RenderStepped = RunService.RenderStepped:connect(function()
  455.                 local MouseP = Mouse.Hit.p
  456.                 WallPart2.CFrame = CFrame.new(RoundVector(MouseP+Vector3.new(0,WallPart2.Size.X/2,0), 2)+Vector3.new(0.2,0,0.5))*CFrame.Angles(0,0,math.rad(90))
  457.             end)
  458.             nope = Mouse.Button1Up:connect(function()
  459.                 if not Editing and not EditCam and not PlacingItem then return end
  460.                 RenderStepped:disconnect()
  461.                 GenerateWall:disconnect()
  462.                 nope:disconnect()
  463.                 PlacingItem = false
  464.                 WallPart1.Transparency = 0
  465.                 WallPart2.Transparency = 0
  466.                 WallPart.Transparency = 0
  467.                 if Click then
  468.                     Click:disconnect()
  469.                 end
  470.                 WallPart1:Destroy()
  471.                 WallPart2:Destroy()
  472.                 WallPart.Name = 'Hitbox'
  473.                 WallPart.Parent = Model
  474.                 WallPart.Transparency = 0
  475.                 Model.PrimaryPart = WallPart
  476.                 Event:FireServer('fgdfhguiUHOHFOHDHOIHOHioobndofigiodhtodfoidfbhhiosngodfihIGHIHFIHTdfgdfhfbfdIIlllIIIddfsIIll434DSOIJGJIBILLllII', 'Wall', WallPart1.CFrame, WallPart2.CFrame)
  477.                 Model:Destroy()
  478.             end)
  479.         end)
  480.         WallPart = Instance.new('Part', Model)
  481.         WallPart.Anchored = true
  482.         WallPart.Transparency = 0.2
  483.         WallPart.Material = Enum.Material.SmoothPlastic
  484.         WallPart.Name = 'WallPart'
  485.         WallPart.Orientation = Vector3.new(0,0,math.rad(90))
  486.         WallPart.Size = Vector3.new(9, 12, 0.4)
  487.         GenerateWall = RunService.RenderStepped:connect(function()
  488.             if WallPart1 and WallPart2 then
  489.                 WallPart.Size = Vector3.new((WallPart1.Position - WallPart2.Position).Magnitude,9,0.4)
  490.                 WallPart.CFrame = CFrame.new(
  491.                     WallPart1.Position + 0.5*(WallPart2.Position - WallPart1.Position),
  492.                     WallPart1.Position + 0.5*(WallPart2.Position - WallPart1.Position) + (WallPart1.Position - WallPart2.Position).Unit:Cross(Vector3.new(0,1,0))
  493.                 )
  494.             end
  495.         end)
  496.     end
  497. end
  498.  
  499. script.Parent.Back.Edit.MouseButton1Click:connect(function()
  500.     if Functions.PlayerHasTycoon(Player) then
  501.         EnterEditMode()
  502.     else
  503.         warn('You do not have a tycoon!')
  504.     end
  505. end)
  506.  
  507. script.Parent.Back.Save.MouseButton1Click:connect(function()
  508.     Functions.SaveTycoon(Player)
  509. end)
  510.  
  511.  
  512.  
  513.  
  514. script.Parent.EditorOptions.ExitEditor.MouseButton1Click:connect(function()
  515.     if Editing then
  516.         CancelPlacement(false)
  517.         Editing = false
  518.         PlacingItem = false
  519.         for _,v in pairs(EditingWalls:GetDescendants()) do
  520.             if v:IsA('Decal') then
  521.                 v.Transparency = 1
  522.             elseif v:IsA('BasePart') then
  523.                 v.CanCollide = false
  524.             end
  525.         end
  526.         Tycoon.Base.EditorLines:Destroy()
  527.         EditingWalls.Parent = Tycoon
  528.         Player.Character.HumanoidRootPart.CFrame = (Tycoon.FinishPlayerTele.CFrame*CFrame.Angles(0,math.rad(90),0))
  529.         Player.Character.LowerTorso.Anchored = false
  530.         Player.Character.Humanoid.JumpPower = 50
  531.         Player.Character.Humanoid.WalkSpeed = 16
  532.         Cam.CameraSubject = Player.Character.Humanoid
  533.         Cam.CameraType = Enum.CameraType.Custom
  534.         EditCam = false
  535.         script.Parent.EditorOptions.Visible = false
  536.     end
  537. end)
  538.  
  539. script.Parent.EditorOptions.PlaceItem.MouseButton1Click:connect(function()
  540.     if not PlacingItem then
  541.         local c = workspace.ModernFridge2:Clone()
  542.         c.Parent = workspace
  543.         StartPlacingItem(c)
  544.     end
  545. end)
  546.  
  547. script.Parent.EditorOptions.PlaceWall.MouseButton1Click:connect(function()
  548.     if not PlacingItem then
  549.         StartPlacingWall()
  550.     end
  551. end)
  552.  
  553. script.Parent.EditorOptions.PlacePath.MouseButton1Click:connect(function()
  554.     if not PlacingItem then
  555.         StartPlacingPath()
  556.     end
  557. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement