Advertisement
XZTablets

Placement System

Jul 19th, 2019
614
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 33.24 KB | None | 0 0
  1. script.Parent.Visible = false
  2. game.Players.LocalPlayer:WaitForChild("BaseDataLoaded")
  3. script.Parent.Visible = true
  4. local MoneyLib = require(game.ReplicatedStorage.MoneyLib)
  5. wait() -- trust me on this one!
  6.  
  7. local Busy = false
  8.  
  9.  
  10. function getItemById(Id)
  11.     for i,v in pairs(game.ReplicatedStorage.Items:GetChildren()) do
  12.         if v.ItemId.Value == Id then
  13.             return v
  14.         end
  15.     end
  16.     return nil
  17. end
  18.  
  19. function setColor(gui, newColor)
  20.     -- no fancy animation. (Gui 9-slices)
  21.     local c = gui:GetChildren()
  22.     local oldColor = gui.Center.BackgroundColor3
  23.     for i = 1, #c do
  24.         if c[i]:FindFirstChild("ImageLabel") then
  25.             c[i].ImageLabel.ImageColor3 = newColor
  26.         end
  27.         c[i].BackgroundColor3 = newColor
  28.     end
  29. end
  30.  
  31. function changeColor(gui, newColor)
  32.     -- this should fade out the old color to the new one (for 9-slices)
  33.     local c = gui:GetChildren()
  34.     local oldColor = gui.Center.BackgroundColor3
  35.     for i = 1, 10 do
  36.         local color = Color3.new((oldColor.r/10)*(10-i) + (newColor.r/10)*i,(oldColor.g/10)*(10-i) + (newColor.g/10)*i,(oldColor.b/10)*(10-i) + (newColor.b/10)*i)
  37.         for i = 1, #c do
  38.             if c[i]:FindFirstChild("ImageLabel") then
  39.                 c[i].ImageLabel.ImageColor3 = color
  40.             end
  41.             c[i].BackgroundColor3 = color
  42.         end
  43.         game:GetService("RunService").Heartbeat:wait()
  44.     end
  45. end
  46.  
  47.  
  48. local function selectItem(ItemId)
  49.     local Item = getItemById(ItemId)
  50.     script.Parent.YYLeft.Inventory.Selected.ItemName.Text = Item.Name
  51.     script.Parent.YYLeft.Inventory.Selected.ItemNameDark.Text = Item.Name
  52.     local Tier = game.ReplicatedStorage.Tiers:FindFirstChild(Item.Tier.Value)
  53.     script.Parent.YYLeft.Inventory.Selected.Type.Text = Tier.TierName.Value
  54.     script.Parent.YYLeft.Inventory.Selected.TypeDark.Text = Tier.TierName.Value
  55.     script.Parent.YYLeft.Inventory.Selected.Tier.BackgroundColor3 = Tier.TierColor.Value
  56.     script.Parent.YYLeft.Inventory.Selected.Item.Icon.Image = "rbxassetid://"..Item.ThumbnailId.Value
  57.     script.Parent.YYLeft.Inventory.Selected.Desc.Text = Item.Description.Value
  58.     if Item.Tier.Value == 31 or Item.Tier.Value == 78 then
  59.         script.Parent.YYLeft.Inventory.Selected.Type.TextColor3 = Color3.new(0,0,0)
  60.    
  61.     else
  62.         script.Parent.YYLeft.Inventory.Selected.Type.TextColor3 = Color3.new(1,1,1)    
  63.     end    
  64.     if (Item.Tier.Value == 40 or Item.Tier.Value == 41 or Item.Tier.Value == 30 or Item.Tier.Value == 31 or Item.Tier.Value == 99 or Item.Tier.Value == 78) then
  65.         local c = Tier.TierBackground.Value
  66.         changeColor(script.Parent.YYLeft.Inventory.Selected.Blue, Color3.new(c.r/2,c.g/2,c.b/2))
  67.         script.Parent.YYLeft.Inventory.Selected.Rare.Value = true
  68.     else
  69.         script.Parent.YYLeft.Inventory.Selected.Rare.Value = false
  70.         changeColor(script.Parent.YYLeft.Inventory.Selected.Blue, Color3.new(50/255, 150/255, 200/255))
  71.     end
  72. end
  73.  
  74.  
  75. local Player = game.Players.LocalPlayer
  76. local Mouse = Player:GetMouse()
  77. local DefaultMouseIcon = Mouse.Icon
  78. Mouse.TargetFilter = nil
  79.  
  80. function GetTycoon()
  81.     local TycoonVal = game.Players.LocalPlayer:FindFirstChild("PlayerTycoon")
  82.     if TycoonVal then
  83.         if TycoonVal.Value then
  84.             return TycoonVal.Value
  85.         end
  86.     end
  87.     for i, Tycoon in pairs(game.Workspace.Tycoons:GetChildren()) do
  88.         if Tycoon.Name:sub(1, 7) == "Factory" and Tycoon:IsA("Model") then
  89.             if Tycoon.Owner.Value == game.Players.LocalPlayer.Name then
  90.                 return Tycoon
  91.             end
  92.         end
  93.     end
  94.     return nil
  95. end
  96.  
  97. function RoundByThree(Number)
  98.     if math.floor(Number) == Number then
  99.         if Number%3 == 0 then
  100.             return Number
  101.         elseif (Number - 1)%3 == 0 then
  102.             return Number - 1
  103.         elseif (Number + 1)%3 == 0 then
  104.             return Number + 1
  105.         end
  106.     end
  107.     return Number
  108. end
  109.  
  110. local Placing = false
  111. local GoodPlacement = false
  112. local Visual
  113. local Rotation = 0
  114.  
  115. local InputService = game:GetService("UserInputService")
  116. local Debounce = false
  117. local cDebounce = false
  118.  
  119. local LastItem
  120.  
  121. function Rotate()
  122.     if Rotation >= 360 then
  123.         Rotation = 0
  124.     end
  125.     Rotation = Rotation + 90
  126. end
  127.  
  128.  
  129.  
  130. local wDebounce = false
  131.  
  132. function undo()
  133.     if not Busy and game.Players.LocalPlayer:FindFirstChild("Rebirthing") == nil then
  134.         if not wDebounce and Placing then
  135.             wDebounce = true
  136.             if LastItem then
  137.                 script.Parent.Sounds.Withdraw.Pitch = 1 + (math.random(-100,100)/500)
  138.                 script.Parent.Sounds.Withdraw:Play()
  139.                 local success = game.ReplicatedStorage.DestroyItem:InvokeServer(LastItem)
  140.                 LastItem = nil
  141.             else
  142.                 script.Parent.Sounds.Error:Play()
  143.             end
  144.             wait(0.3)
  145.             wDebounce = false
  146.         end
  147.     end
  148. end
  149.  
  150.  
  151. local function off()
  152.     Placing = false
  153.     script.Parent.YYRight.Placement:TweenPosition(UDim2.new(0,0,0.6,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quart,0.5,true)
  154.    
  155.     game:GetService("ContextActionService"):UnbindAction("PlaceItem")  
  156.     if game:GetService("UserInputService").TouchEnabled then
  157.         game.Players.LocalPlayer.PlayerGui.TouchGui.TouchControlFrame.Visible = true
  158.     end
  159.    
  160.     if not InputService.GamepadEnabled then
  161.         Mouse.Icon = DefaultMouseIcon
  162.     end
  163.    
  164.     spawn(function()
  165.         if game.Players.LocalPlayer.MOTD.Value ~= game.ReplicatedStorage.MOTD.Value then
  166.             game.ReplicatedStorage.MOTDRead:InvokeServer()
  167.         end
  168.     end)
  169.     Mouse.TargetFilter = nil
  170.    
  171.     local y = 50
  172.     script.Parent.YYLeft.Inventory.Visible = false
  173.     script.Parent.YYRight.Shop.Visible = false
  174.    
  175.     script.Parent.YYCenter.BaseSettings.Visible = false
  176.     script.parent.YYCenter.BoxesMenu.Visible = false
  177.     script.Parent.YYCenter.Purchases.Visible = false
  178.     script.Parent.YYCenter.Gift.Visible = false
  179.     script.Parent.YYCenter.EventShop.Visible = false
  180.    
  181.     for i,Child in pairs(script.Parent.YYCenter:GetChildren()) do
  182.         Child.Visible = false
  183.     end
  184.     if Visual then
  185.         Visual.Parent = nil
  186.         Visual = nil
  187.     end
  188.     for i, TycoonItem in pairs(GetTycoon():GetChildren()) do
  189.         if game.ReplicatedStorage.Items:FindFirstChild(TycoonItem.Name) and TycoonItem:IsA("Model") then
  190.             local SelBox = TycoonItem:FindFirstChild("SelectionBox")
  191.             if SelBox then
  192.                 SelBox.Visible = false
  193.             end
  194.         end
  195.     end
  196. end
  197.  
  198. local function updatedetails()
  199.     local Item = script.Parent.Hovering.Hover.Object.Value
  200.     if Item and script.Parent.Hovering.Hover.Details.Value then
  201.         if Item.ItemType.Value == 6 or Item.ItemType.Value == 99 then
  202.             script.Parent.Hovering.Hover.Copy.Desc.Text = "Can't Copy"
  203.             script.Parent.Hovering.Hover.Sell.Desc.Text = "Can't Sell"
  204.         else
  205.             script.Parent.Hovering.Hover.Sell.Desc.Text = "Sell "..MoneyLib.HandleMoney(Item.Cost.Value * 0.3)
  206.             if Item.ItemType.Value == 7 and Item:FindFirstChild("Crystals") then
  207.                 script.Parent.Hovering.Hover.Copy.Desc.Text = "Copy "..MoneyLib.DealWithPoints(Item.Crystals.Value)
  208.             else
  209.                 script.Parent.Hovering.Hover.Copy.Desc.Text = "Copy "..MoneyLib.HandleMoney(Item.Cost.Value)
  210.             end
  211.         end
  212.     end
  213. end
  214.  
  215. script.Parent.Hovering.Hover.Details.Changed:connect(updatedetails)
  216.  
  217. local function withdrawselected()
  218.     if script.Parent.Hovering.Hover.MultiSelect.Value then
  219.         local Items = {}
  220.         for i,Child in pairs(GetTycoon():GetChildren()) do
  221.             if Child:FindFirstChild("Hitbox") and Child.Hitbox:FindFirstChild("MultiSelectBox") then
  222.                 table.insert(Items,Child)
  223.             end
  224.         end
  225.         if #Items > 0 and not Debounce then
  226.             Debounce = true
  227.             local Success = game.ReplicatedStorage.DestroySelected:InvokeServer(Items)
  228.  
  229.             if Success then
  230.                 script.Parent.Sounds.Withdraw:Play()
  231.                 script.Parent.Hovering.Hover.Close:Fire()
  232.                 wait(0.1)
  233.             else
  234.                 script.Parent.Sounds.Error:Play()
  235.                 wait(0.3)
  236.             end
  237.             Debounce = false           
  238.         end
  239.     else
  240.         local Item = script.Parent.Hovering.Hover.Object.Value
  241.         if Item and Item:IsDescendantOf(GetTycoon()) and not Debounce then
  242.             Debounce = true
  243.             local Success = game.ReplicatedStorage.DestroyItem:InvokeServer(Item)
  244.             if Success then
  245.                 script.Parent.Sounds.Withdraw:Play()
  246.                 script.Parent.Hovering.Hover.Close:Fire()
  247.                 wait(0.1)
  248.             else
  249.                 script.Parent.Sounds.Error:Play()
  250.                 wait(0.3)
  251.             end
  252.             Debounce = false
  253.         end    
  254.     end
  255. end
  256.  
  257. local function copyselected()
  258.     local Item = script.Parent.Hovering.Hover.Object.Value
  259.     if Item and Item:IsDescendantOf(GetTycoon()) and not Debounce then
  260.         Debounce = true
  261.         local Success = game.ReplicatedStorage.BuyItem:InvokeServer(Item.Name,1)
  262.         if Success then
  263.             script.Parent.Sounds.Purchase:Play()
  264.             wait(0.1)
  265.         else
  266.             script.Parent.Sounds.Error:Play()
  267.             wait(0.3)
  268.         end
  269.         Debounce = false
  270.     end
  271. end
  272.  
  273. local function sellselected()
  274.     local Item = script.Parent.Hovering.Hover.Object.Value
  275.     if Item and Item:IsDescendantOf(GetTycoon()) and not Debounce then
  276.         Debounce = true
  277.         local Success = game.ReplicatedStorage.SellItem:InvokeServer(Item)
  278.         if Success then
  279.             script.Parent.Sounds.Purchase:Play()
  280.             script.Parent.Hovering.Hover.Close:Fire()          
  281.             wait(0.1)
  282.         else
  283.             script.Parent.Sounds.Error:Play()
  284.             wait(0.3)
  285.         end
  286.         Debounce = false
  287.     end
  288. end
  289.  
  290.  
  291. script.Parent.Hovering.Hover.Copy.Button.MouseButton1Click:connect(function()
  292.     copyselected()
  293. end)
  294. script.Parent.Hovering.Hover.Sell.Button.MouseButton1Click:connect(function()
  295.     sellselected()
  296. end)
  297. script.Parent.Hovering.Hover.Withdraw.Button.MouseButton1Click:connect(function()
  298.     withdrawselected()
  299. end)
  300.  
  301. game:GetService("UserInputService").InputBegan:Connect(function(key)
  302.     if script.Parent.Hovering.Hover.Details.Value then
  303.         if key.KeyCode == Enum.KeyCode.Z then
  304.             withdrawselected()
  305.         elseif key.KeyCode == Enum.KeyCode.X then
  306.             sellselected()
  307.         elseif key.KeyCode == Enum.KeyCode.C then
  308.             copyselected()
  309.         end
  310.     elseif Placing then
  311.         if key.KeyCode == Enum.KeyCode.R then
  312.             Rotate()
  313.         elseif key.KeyCode == Enum.KeyCode.F then
  314.             undo()
  315.         elseif key.KeyCode == Enum.KeyCode.Q then
  316.             off()
  317.         end
  318.     end
  319. end)
  320.  
  321.  
  322.  
  323. local function Place()
  324.     if Placing then
  325.         local Tycoon = GetTycoon()
  326.         --Visual.Parent = Tycoon
  327.         if Visual and not Debounce then
  328.             if GoodPlacement then
  329.                 Debounce = true
  330.                 --PlaceItem:InvokeServer(Visual, Tycoon) --Yeah pretty sure Instances don't replicate so lets be safe, huh?
  331.                 local model = game.ReplicatedStorage.PlaceItem:InvokeServer(Visual.Name, Tycoon, CFrame.new(Visual.Hitbox.Position)*CFrame.Angles(0,(math.pi * (Rotation/180) ),0),Rotation)
  332.                 if model == nil then
  333.                     script.Parent.Sounds.Error:Play()
  334.                 else
  335.                     GoodPlacement = false
  336.                     LastItem = model
  337.                     script.Parent.Sounds.Placement.Pitch = 1 + (math.random(-100,100)/500)
  338.                     script.Parent.Sounds.Placement:Play()                  
  339.                 end
  340.             else
  341.                 script.Parent.Sounds.Error:Play()
  342.             end
  343.         end
  344.        
  345.         if Visual then
  346.             local Count = game.ReplicatedStorage.HasItem:InvokeServer(Visual.ItemId.Value)
  347.             if Count > -1 then
  348.         --      script.Parent.CurrentlyPlacing.Count.Text = "x"..Count
  349.                 script.Parent.YYRight.Placement.Amount.Text = "x"..Count
  350.                 script.Parent.YYRight.Placement.AmountDark.Text = "x"..Count
  351.             end
  352.             if Count <= 0 then
  353.                 off()
  354.             end
  355.         end
  356.        
  357.         wait(0.1)
  358.         Debounce = false
  359.     end
  360. end
  361.  
  362.  
  363. local function OpenEventShop()
  364.     off()
  365.     script.Parent.YYCenter.EventShop.Position = UDim2.new(-0.5,0,1,10)
  366.     script.Parent.YYCenter.EventShop.Visible = true
  367.     script.Parent.YYCenter.EventShop:TweenPosition(UDim2.new(-0.5,0,0.25,0),"InOut","Quart",0.25,true)
  368. end
  369.  
  370.  
  371. local cDebounce
  372. local function onClick()
  373.  
  374.     if InputService.MouseEnabled then
  375.         if Placing then
  376.             Place()
  377.         elseif Mouse.Target and Mouse.Target:FindFirstChild("ClickDetector") then
  378.             if not cDebounce then
  379.                 if Mouse.Target:IsDescendantOf(workspace.Market) then
  380.                     cDebounce = true
  381.                     script.Parent.Sounds.Click:Play()
  382.                     OpenEventShop()
  383.                     wait(0.3)
  384.                     cDebounce = false
  385.                 else
  386.                     cDebounce = true
  387.                     game.ReplicatedStorage.Click:FireServer(Mouse.Target)
  388.                     wait(0.1)
  389.                     cDebounce = false                  
  390.                 end
  391.  
  392.             end
  393.            
  394.             --[[
  395.         else
  396.             if Mouse.Target and UsingMouse and not InputService.GamepadEnabled then
  397.                 if Mouse.Target:IsDescendantOf(GetTycoon()) and Mouse.Target.Parent:IsA("Model") and Mouse.Target.Parent ~= GetTycoon() and Mouse.Target.Name == "Hitbox" then
  398.                     if not ItemMenu.Working.Visible and not ItemMenu.Error.Visible then
  399.                 --      ItemMenu.Visible = true
  400.                 --      ItemMenu.Position = UDim2.new(0, Mouse.X + 20, 0, Mouse.Y + 5 )
  401.                 --      ItemMenu.Object.Value = Mouse.Target.Parent
  402.                        
  403.                     end
  404.                 elseif Mouse.Target:FindFirstChild("ClickDetector") then
  405.                     if not cDebounce then
  406.                         cDebounce = true
  407.                 --      ItemMenu.Visible = false
  408.                         game.ReplicatedStorage.Click:FireServer(Mouse.Target)
  409.                         wait(0.05)
  410.                         cDebounce = false
  411.                     end
  412.                 else
  413.                     ItemMenu.Visible = false
  414.                 end
  415.             else
  416.             ItemMenu.Visible = false
  417.             end
  418.             ]] 
  419.         end if not InputService.GamepadEnabled then
  420.         Mouse.Icon = DefaultMouseIcon
  421.     end
  422.        
  423.     elseif InputService.GamepadEnabled then
  424.         if Placing then
  425.             Place()
  426.         end
  427.     end
  428. end
  429.  
  430. -- Final Placement
  431.  
  432. if InputService.TouchEnabled then
  433.     InputService.TouchTap:connect(onClick)
  434. end
  435. Mouse.Button1Down:connect(onClick)
  436.  
  437. local UsingMouse = true
  438.  
  439. function InitiatePlacing(ItemBtn)
  440.     if false then
  441. --      script.Parent.ItemSettings.Visible = false
  442.     else
  443.         if game.ReplicatedStorage.HasItem:InvokeServer(ItemBtn.ItemId.Value) > 0 and ItemBtn.ItemId.Value > 0 and not Placing and UsingMouse then
  444.     --      script.Parent.Cancel.Visible = true
  445.             Placing = true
  446.        
  447.             if script.Parent.Hovering.Hover.Details.Value then
  448.                 script.Parent.Hovering.Hover.Close:Fire()
  449.             end
  450.            
  451.             GoodPlacement = false
  452.             if not InputService.GamepadEnabled then
  453.                 Mouse.Icon = "rbxassetid://209048202"
  454.             end
  455.            
  456.             game.ContextActionService:BindAction("PlaceItem",Place,false,Enum.KeyCode.ButtonR2)
  457.                    
  458.             script.Parent.YYCenter.ObjectPlacement.Visible = true
  459.     --      script.Parent.Undo.Visible = true
  460.    
  461.     --      script.Parent.Place.Visible = (InputService.GamepadEnabled or (InputService.TouchEnabled and not InputService.MouseEnabled))           
  462.                    
  463.             if Mouse then
  464.                 Mouse.TargetFilter = workspace.Tycoons
  465.             end
  466.             script.Parent.YYLeft.Inventory.Visible = false
  467.            
  468.            
  469.             if game:GetService("UserInputService").TouchEnabled then
  470.                 game.Players.LocalPlayer.PlayerGui.TouchGui.TouchControlFrame.Visible = true
  471.             end        
  472.            
  473.             local toClone = getItemById(ItemBtn.ItemId.Value)
  474.             if toClone then
  475.                 Visual = toClone:clone()
  476.            
  477.                 local LocalItemTag = Instance.new("BoolValue")
  478.                 LocalItemTag.Name = "LocalItem"
  479.                 LocalItemTag.Parent = Visual           
  480.            
  481.                 Visual.Parent = GetTycoon()
  482.  
  483.                 if Visual then
  484.             --      script.Parent.CurrentlyPlacing.Thumbnail.Image = "rbxassetid://" .. Visual.ThumbnailId.Value
  485. --                  script.Parent.CurrentlyPlacing.Count.Text = "x" .. game.ReplicatedStorage.HasItem:InvokeServer(Visual.ItemId.Value)
  486.                     script.Parent.YYRight.Placement.Image.Image = "rbxassetid://" .. Visual.ThumbnailId.Value
  487.                     local Amount = "x" .. game.ReplicatedStorage.HasItem:InvokeServer(Visual.ItemId.Value)
  488.                     script.Parent.YYRight.Placement.Amount.Text = Amount
  489.                     script.Parent.YYRight.Placement.AmountDark.Text = Amount
  490.                     local EndPosition = UDim2.new(1,-300,0.6,0)
  491.                     if not game:GetService("UserInputService").TouchEnabled then
  492.             --          script.Parent.CurrentlyPlacing:TweenPosition(EndPosition,Enum.EasingDirection.InOut,Enum.EasingStyle.Quart,0.5)
  493.                         script.Parent.YYRight.Placement:TweenPosition(UDim2.new(-0.235,0,0.6,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quart,0.5, true)
  494.                     end
  495.                 end
  496.                        
  497.                 for i, TycoonItem in pairs(GetTycoon():GetChildren()) do
  498.                     if game.ReplicatedStorage.Items:FindFirstChild(TycoonItem.Name) and TycoonItem:IsA("Model") then
  499.                         local SelBox = TycoonItem:FindFirstChild("SelectionBox")
  500.                         if SelBox then
  501.                             SelBox.Visible = true
  502.                             SelBox.Transparency = 0.6
  503.                         end
  504.                     end
  505.                 end
  506.                        
  507.                                
  508.                        
  509.                 for i,v in pairs(workspace.Boxes:GetChildren()) do
  510.                     v.Visible = true
  511.                 end
  512.                        
  513.                 Visual.Hitbox.Transparency = 0.6
  514.                 Visual.Hitbox.Reflectance = 0.2
  515.                        
  516.                 local bMesh = Instance.new("BlockMesh",Visual.Hitbox)
  517.                 bMesh.Scale = Vector3.new(1,1000,1)
  518.                        
  519.                 if Visual:FindFirstChild("SelectionBox") then
  520.                     Visual.SelectionBox.Visible = true
  521.                     Visual.SelectionBox.Transparency = 0
  522.                 end                
  523.                        
  524.                 for ii,vv in pairs(Visual.Model:GetChildren()) do
  525.                     if vv:IsA("BasePart") then
  526.                         vv.CanCollide = false
  527.                         vv.Anchored = true
  528.                         if vv.Name == "Colored" then
  529.                             vv.BrickColor = game.Players.LocalPlayer.TeamColor
  530.                         end
  531.                     end
  532.                 end
  533.                        
  534.                 local TycoonBase = GetTycoon().Base
  535.                 local TycoonTopLeft = TycoonBase.CFrame * CFrame.new(Vector3.new(TycoonBase.Size.x/2, 0, TycoonBase.Size.z/2))
  536.                        
  537.                 local ModelItemId = Instance.new("IntValue", Visual)
  538.                 ModelItemId.Name = "ItemId"
  539.                 ModelItemId.Value = ItemBtn.ItemId.Value
  540.                        
  541.                 local Hitbox = getItemById(ItemBtn.ItemId.Value).Hitbox:clone()
  542.                 Hitbox.Parent = Visual
  543.                 Visual.PrimaryPart = Hitbox
  544.                        
  545.                 Visual:SetPrimaryPartCFrame(TycoonTopLeft * CFrame.new(Vector3.new(-Hitbox.Size.x/2, Hitbox.Size.y/2, -Hitbox.Size.z/2)))
  546.  
  547.  
  548.                 local TycoonBaseSizeX, TycoonBaseSizeZ
  549.                 local HitboxSizeX, HitboxSizeZ
  550.                 local Hitboxes
  551.                 local NewVector
  552.                
  553.                 local LastPosition = CFrame.new()
  554.                
  555.                 local function VerifyPos()
  556.                     local ModelColliding   
  557.                     local function Argue()
  558.                         for i, Hitbox in pairs(Hitboxes) do
  559.                             if Hitbox.Name == "Hitbox" and not Hitbox:IsDescendantOf(Visual) then
  560.                                 return false
  561.                             end
  562.                         end
  563.                         local CheckRay = Ray.new(Visual.Hitbox.Position, Vector3.new(0,-500,0))
  564.                         local Hit = workspace:FindPartOnRayWithIgnoreList(CheckRay,{GetTycoon()})
  565.                         if Hit and Hit:FindFirstChild("Base") and Hit.Name == GetTycoon().Name then
  566.                             return true
  567.                         end
  568.                         return false
  569.                     end
  570.                            
  571.                     local ModelColliding = not Argue()
  572.                                    
  573.                     GoodPlacement = not ModelColliding
  574.                     Visual:SetPrimaryPartCFrame(NewVector * CFrame.Angles(0, math.rad(Rotation), 0))
  575.                                    
  576.                     if GoodPlacement then
  577.                         LastPosition = NewVector * CFrame.Angles(0, math.rad(Rotation), 0)
  578.                         Visual.Hitbox.BrickColor = BrickColor.new("Bright blue")
  579.                         Visual.SelectionBox.Color3 = Color3.new(0.0509804, 0.411765, 0.67451)
  580.                     else
  581.                         Visual.Hitbox.BrickColor = BrickColor.new("Really red")
  582.                         Visual.SelectionBox.Color3 = Color3.new(1,0,0)
  583.                     end
  584.                 end
  585.                
  586.                 local function CheckPos(xdisp,zdisp,placepos) -- placepos is Mouse.Hit.p on pc
  587.                     xdisp = xdisp or 0
  588.                     zdisp = zdisp or 0
  589.                     if Rotation % 180 == 0 then
  590.                         TycoonBaseSizeX, TycoonBaseSizeZ = TycoonBase.Size.x, TycoonBase.Size.z
  591.                         HitboxSizeX, HitboxSizeZ = Hitbox.Size.x, Hitbox.Size.z
  592.                     else
  593.                         TycoonBaseSizeX, TycoonBaseSizeZ = TycoonBase.Size.x, TycoonBase.Size.z
  594.                         HitboxSizeX, HitboxSizeZ = Hitbox.Size.z, Hitbox.Size.x
  595.                     end
  596.                            
  597.                     local TycoonTopLeft = TycoonBase.CFrame * CFrame.new(Vector3.new(TycoonBase.Size.x/2, 0, TycoonBase.Size.z/2))
  598.                    
  599.                     local BaseAngleX, BaseAngleY, BaseAngleZ = CFrame.new(TycoonBase.Position, (TycoonBase.CFrame*Vector3.new(1, 0, 0))):toEulerAnglesXYZ()
  600.                     local VectorRotation = CFrame.Angles(BaseAngleX, BaseAngleY, BaseAngleZ)
  601.                    
  602.                     local RoundByThreeX = RoundByThree(math.floor(placepos.x) + xdisp - math.ceil(TycoonTopLeft.x))
  603.                     local RoundByThreeZ = RoundByThree(math.floor(placepos.z) + zdisp - math.ceil(TycoonTopLeft.z))
  604.                            
  605.                     if RoundByThreeX < -TycoonBaseSizeX + HitboxSizeX then
  606.                         RoundByThreeX = RoundByThreeX + HitboxSizeX
  607.                     end
  608.                                
  609.                     if RoundByThreeZ < -TycoonBaseSizeZ + HitboxSizeZ then
  610.                         RoundByThreeZ = RoundByThreeZ + HitboxSizeZ
  611.                     end
  612.                                
  613.                     local VectorComponent1 = CFrame.new(Vector3.new(TycoonTopLeft.x, TycoonBase.Position.y, TycoonTopLeft.z))
  614.                     local VectorComponent2 = CFrame.new(Vector3.new(RoundByThreeX, TycoonBase.Size.y/2, RoundByThreeZ)) --*VectorRotation
  615.                     local VectorComponent3 = CFrame.new(Vector3.new(-HitboxSizeX/2, Hitbox.Size.y/2, -HitboxSizeZ/2))
  616.                                
  617.                     NewVector = VectorComponent1*VectorComponent2*VectorComponent3
  618.                                
  619.                                
  620.                     local RegionVectorMin = NewVector * CFrame.new(Vector3.new(HitboxSizeX/2, -Hitbox.Size.y/2, HitboxSizeZ/2))
  621.                     local RegionVectorMax = NewVector * CFrame.new(-Vector3.new(HitboxSizeX/2, -Hitbox.Size.y/2, HitboxSizeZ/2))
  622.                                
  623.                     Hitboxes = game.Workspace:FindPartsInRegion3(
  624.                         Region3.new(
  625.                             Vector3.new(
  626.                                 math.min(RegionVectorMin.x, RegionVectorMax.x),
  627.                                 math.min(RegionVectorMin.y, RegionVectorMax.y),
  628.                                 math.min(RegionVectorMin.z, RegionVectorMax.z)
  629.                             ) + Vector3.new(0.1, 0, 0.1),
  630.                             Vector3.new(
  631.                                 math.max(RegionVectorMin.x, RegionVectorMax.x),
  632.                                 math.max(RegionVectorMin.y, RegionVectorMax.y),
  633.                                 math.max(RegionVectorMin.z, RegionVectorMax.z)
  634.                             ) - Vector3.new(0.1, 0, 0.1)
  635.                         ), game.Workspace.Map, 100
  636.                     )
  637.                     return true
  638.                 end
  639.            
  640.                 while Placing do
  641.                     GetTycoon().Base.Grid.Transparency = 0.5
  642.                     if TycoonBase ~= nil then
  643.                         local UIS = game:GetService("UserInputService")
  644.                         if UIS.GamepadEnabled or (UIS.TouchEnabled and not UIS.MouseEnabled) then
  645.                             local LookVector = workspace.CurrentCamera.CoordinateFrame.lookVector
  646.                             local xCo = 1
  647.                             local zCo = 1
  648.                             if LookVector.x > 0 then
  649.                                 xCo = 2
  650.                             end
  651.                             if LookVector.z > 0 then
  652.                                 zCo = 2
  653.                             end
  654.                             NewVector = Vector3.new(LookVector.x * xCo, LookVector.y, LookVector.z * zCo)
  655.                             local Pos = Player.Character.HumanoidRootPart.Position + (NewVector * 20)
  656.                 --          local Pos = Player.Character.Torso.Position + (NewVector * 20)
  657.                             CheckPos(0,0,Pos)
  658.                             VerifyPos()                        
  659.                            
  660.                         elseif Mouse ~= nil and Mouse.Target ~= nil and Mouse.Target.Name == GetTycoon().Name and Mouse.Target:FindFirstChild("Base") then
  661.  
  662.                             CheckPos(0,0,Mouse.Hit.p)
  663.                             VerifyPos()
  664.                             --TransformModel(Visual:GetChildren(), Visual.PrimaryPart.CFrame, CFrame.new(VectorComponent3.p, VectorComponent3*CFrame.new(1, 0, 0)) + CFrame.new(LastPosition.p), true)
  665.  
  666.                         end
  667.                     end
  668.                     game:GetService("RunService").Heartbeat:wait()
  669.                 end
  670.                 if Mouse then
  671.                     Mouse.TargetFilter = nil
  672.                 end
  673.                 --RemoveItem:InvokeServer(ItemBtn.ItemId.Value, 1)
  674.                 GetTycoon().Base.Grid.Transparency = 1
  675.                 --Mouse.Icon = ""
  676.                 --game:GetService("UserInputService").MouseIconEnabled = false
  677.             end
  678.         end
  679.     end
  680. end
  681.  
  682. for i = 1, 200 do
  683.     local t = script.Parent.Template:Clone()
  684.     t.Name = tostring(i)
  685.     t.Parent = script.Parent.YYLeft.Inventory.Items.Scroll
  686.     t.Visible = true
  687.     t.MouseEnter:Connect(function()
  688.         t.Icon.Amount.Visible = true
  689.         script.Parent.Sounds.Hover:Play()
  690.         t.Icon:TweenPosition(UDim2.new(0.05,0,0.08,0),"InOut","Quad",0.25,true)
  691.         t.White:TweenPosition(UDim2.new(0,0,0.03,0),"InOut","Quad",0.25,true)
  692.         t.Grey:TweenSizeAndPosition(UDim2.new(1,0,1,0),UDim2.new(0,0,0.03,0),"InOut","Quad",0.25,true)
  693.         if t.ItemId.Value > 0 then
  694.             selectItem(t.ItemId.Value)
  695.         end
  696.     end)   
  697.     t.MouseLeave:Connect(function()
  698.         t.Icon.Amount.Visible = false
  699.         t.Icon:TweenPosition(UDim2.new(0.05,0,0.05,0),"InOut","Quad",0.25,true)
  700.         t.White:TweenPosition(UDim2.new(0,0,0,0),"InOut","Quad",0.25,true)
  701.         t.Grey:TweenSizeAndPosition(UDim2.new(1,0,1.03,0),UDim2.new(0,0,0,0),"InOut","Quad",0.25,true)
  702.     end)
  703.     t.MouseButton1Click:connect(function()
  704.         InitiatePlacing(t)
  705.     end)
  706. end
  707.  
  708. local row = 4
  709. local sizey = 0
  710.  
  711. function adjustscrolls()
  712.     local rows = math.ceil(script.Parent.YYLeft.Inventory.Buttons.Value / row)
  713.     script.Parent.YYLeft.Inventory.Items.Scroll.CanvasSize = UDim2.new(0,0,0.1,rows * sizey)
  714.     rows = math.ceil(script.Parent.YYRight.Shop.Buttons.Value / row)
  715.     script.Parent.YYRight.Shop.Items.Scroll.CanvasSize = UDim2.new(0,0,0.1,rows * sizey)
  716. end
  717.  
  718. script.Parent.YYLeft.Inventory.Buttons.Changed:connect(adjustscrolls)
  719. script.Parent.YYRight.Shop.Buttons.Changed:connect(adjustscrolls)
  720.  
  721. function adjust()
  722.     local y = script.Parent.ScreenRes.AbsoluteSize.Y
  723.     local x = script.Parent.ScreenRes.AbsoluteSize.X
  724.     local yx = y/x
  725.    
  726.     if y < 400 then
  727.         script.Parent.YYLButtons.Size = UDim2.new(1.4,0,1.4,0)
  728.         script.Parent.YYLButtons.Position = UDim2.new(0,0,-0.2,0)
  729.         script.Parent.YYRButtons.Size = UDim2.new(1.4,0,1.4,0)
  730.         script.Parent.YYRButtons.Position = UDim2.new(1,0,-0.2,0)
  731.         script.Parent.YYBottom.Size = UDim2.new(1.4,0,1.4,0)
  732.         script.Parent.YYBottom.Position = UDim2.new(1,0,-0.4,0)
  733.         script.Parent.YYTop.Size = UDim2.new(1.4,0,1.4,0)
  734.         script.Parent.YYTop.Position = UDim2.new(0.5,0,0,0)
  735.     elseif y < 700 then
  736.         script.Parent.YYLButtons.Size = UDim2.new(1,0,1,0)
  737.         script.Parent.YYLButtons.Position = UDim2.new(0,0,0,0)
  738.         script.Parent.YYRButtons.Size = UDim2.new(1,0,1,0)
  739.         script.Parent.YYRButtons.Position = UDim2.new(1,0,0,0)
  740.         script.Parent.YYBottom.Size = UDim2.new(1,0,1,0)
  741.         script.Parent.YYBottom.Position = UDim2.new(1,0,0,0)
  742.         script.Parent.YYTop.Size = UDim2.new(1,0,1,0)
  743.         script.Parent.YYTop.Position = UDim2.new(.5,0,0,0)
  744.     else
  745.         script.Parent.YYLButtons.Size = UDim2.new(0,900,0,900)
  746.         script.Parent.YYLButtons.Position = UDim2.new(0,0,0.5,-450)
  747.         script.Parent.YYRButtons.Size = UDim2.new(0,900,0,900)
  748.         script.Parent.YYRButtons.Position = UDim2.new(1,0,1,-900)
  749.         script.Parent.YYBottom.Size = UDim2.new(0,900,0,900)
  750.         script.Parent.YYBottom.Position = UDim2.new(1,0,1,-900)
  751.         script.Parent.YYTop.Size = UDim2.new(0,900,0,900)
  752.         script.Parent.YYTop.Position = UDim2.new(0.5,0,0,0)
  753.     end
  754.    
  755.     if y < 1000 then
  756.         script.Parent.YYCenter.Size = UDim2.new(1,0,1,0)
  757.         script.Parent.YYCenter.Position = UDim2.new(0.5,0,0,0)
  758.     else
  759.         script.Parent.YYCenter.Size = UDim2.new(0,1000,0,1000)
  760.         script.Parent.YYCenter.Position = UDim2.new(0.5,0,0.5,-500)
  761.     end
  762.    
  763.    
  764.     if y < 600 then
  765.         row = 3
  766.     elseif y < 800 then
  767.         row = 4
  768.     else
  769.         row = 5
  770.     end
  771.     if yx > .55 and row == 5 then
  772.         row = 4
  773.     end
  774.    
  775.    
  776.     local num = #script.Parent.YYLeft.Inventory.Items.Scroll:GetChildren()
  777.    
  778.  
  779.    
  780.     local width = (.975 - .01 * row ) / row
  781.    
  782.    
  783.    
  784.     local len = nil
  785.     local i = 0
  786.     for a = 1, num do
  787.         i = i + 1
  788.         local gui = script.Parent.YYLeft.Inventory.Items.Scroll[i]
  789.         gui.Size = UDim2.new(width,0,width,0)
  790.         local e = i - 1
  791.         local rw = 0
  792.         if i > row then
  793.             e = ( i - 1 ) % row
  794.             rw = math.floor((i-1)/row)
  795.         end
  796.        
  797.         local height = gui.Difference.AbsoluteSize.X
  798.         sizey = height
  799.         gui.Position = UDim2.new(.01 + (width + .01) * e,0,0, height * rw)
  800.     end
  801.    
  802.    
  803.  
  804.    
  805.     local num = #script.Parent.YYRight.Shop.Items.Scroll:GetChildren()
  806.     local width = (.975 - .01 * row ) / row
  807.     local len = nil
  808.     local i = 0
  809.     for a = 1, num do
  810.         i = i + 1
  811.         local gui = script.Parent.YYRight.Shop.Items.Scroll[i]
  812.         gui.Size = UDim2.new(width,0,width,0)
  813.         local e = i - 1
  814.         local rw = 0
  815.         if i > row then
  816.             e = ( i - 1 ) % row
  817.             rw = math.floor((i-1)/row)
  818.         end
  819.        
  820.         local height = gui.Difference.AbsoluteSize.X
  821.         gui.Position = UDim2.new(.01 + (width + .01) * e,0,0, height * rw)
  822.     end
  823.    
  824.     adjustscrolls()
  825.    
  826.  
  827.    
  828.     if yx > .67 then
  829.         script.Parent.YYLeft.Position = UDim2.new(-0.05,0,0,0)
  830.         script.Parent.YYRight.Position = UDim2.new(1.05,0,0,0)
  831.        
  832.         script.Parent.YYLeft.Inventory.Items.Size = UDim2.new(0.49,0,1,0)
  833.         script.Parent.YYLeft.Inventory.Search.Position = UDim2.new(0.15,0,0.015,0)
  834.         script.Parent.YYLeft.Inventory.Select.Labels.Visible = false
  835.         script.Parent.YYLeft.Inventory.Select.Position = UDim2.new(-0.025,0,0.015,0)
  836.         script.Parent.YYLeft.Inventory.Selected.Position = UDim2.new(0.5,0,0,0)
  837.        
  838.         script.Parent.YYRight.Shop.Items.Size = UDim2.new(0.49,0,1,0)
  839.         script.Parent.YYRight.Shop.Items.Position = UDim2.new(0.51,0,0,0)
  840.         script.Parent.YYRight.Shop.Top.Size = UDim2.new(0.55,0,0.1,0)
  841.         script.Parent.YYRight.Shop.Top.Position = UDim2.new(0.51,0,0.025,0)
  842.         script.Parent.YYRight.Shop.Selected.Position = UDim2.new(0.2,0,0,0)
  843.     elseif yx  > .6 then
  844.         script.Parent.YYLeft.Position = UDim2.new(0,0,0,0)
  845.         script.Parent.YYRight.Position = UDim2.new(1,0,0,0)
  846.        
  847.         script.Parent.YYLeft.Inventory.Items.Size = UDim2.new(0.49,0,1,0)
  848.         script.Parent.YYLeft.Inventory.Search.Position = UDim2.new(0.15,0,0.015,0)
  849.         script.Parent.YYLeft.Inventory.Select.Labels.Visible = false
  850.         script.Parent.YYLeft.Inventory.Select.Position = UDim2.new(-0.025,0,0.015,0)
  851.         script.Parent.YYLeft.Inventory.Selected.Position = UDim2.new(0.5,0,0,0)
  852.        
  853.         script.Parent.YYRight.Shop.Items.Size = UDim2.new(0.49,0,1,0)
  854.         script.Parent.YYRight.Shop.Items.Position = UDim2.new(0.51,0,0,0)
  855.         script.Parent.YYRight.Shop.Top.Size = UDim2.new(0.55,0,0.1,0)
  856.         script.Parent.YYRight.Shop.Top.Position = UDim2.new(0.51,0,0.025,0)
  857.         script.Parent.YYRight.Shop.Selected.Position = UDim2.new(0.2,0,0,0)
  858.     elseif yx > .55 then
  859.         script.Parent.YYLeft.Position = UDim2.new(0,0,0,0)
  860.         script.Parent.YYRight.Position = UDim2.new(1,0,0,0)
  861.        
  862.         script.Parent.YYLeft.Inventory.Items.Size = UDim2.new(0.59,0,1,0)
  863.         script.Parent.YYLeft.Inventory.Search.Position = UDim2.new(0.25,0,0.015,0)
  864.         script.Parent.YYLeft.Inventory.Select.Labels.Visible = false
  865.         script.Parent.YYLeft.Inventory.Select.Position = UDim2.new(0.025,0,0.015,0)
  866.         script.Parent.YYLeft.Inventory.Selected.Position = UDim2.new(0.6,0,0,0)
  867.        
  868.         script.Parent.YYRight.Shop.Items.Size = UDim2.new(0.59,0,1,0)
  869.         script.Parent.YYRight.Shop.Items.Position = UDim2.new(0.41,0,0,0)
  870.         script.Parent.YYRight.Shop.Top.Size = UDim2.new(0.69,0,0.125,0)
  871.         script.Parent.YYRight.Shop.Top.Position = UDim2.new(0.41,0,0,0)
  872.         script.Parent.YYRight.Shop.Selected.Position = UDim2.new(0.1,0,0,0)
  873.     else
  874.         script.Parent.YYLeft.Position = UDim2.new(0,0,0,0)
  875.         script.Parent.YYRight.Position = UDim2.new(1,0,0,0)
  876.        
  877.         script.Parent.YYLeft.Inventory.Items.Size = UDim2.new(0.69,0,1,0)
  878.         script.Parent.YYLeft.Inventory.Search.Position = UDim2.new(0.325,0,0.015,0)
  879.         script.Parent.YYLeft.Inventory.Select.Labels.Visible = true
  880.         script.Parent.YYLeft.Inventory.Select.Position = UDim2.new(0.05,0,0.015,0)
  881.         script.Parent.YYLeft.Inventory.Selected.Position = UDim2.new(0.7,0,0,0)
  882.        
  883.         script.Parent.YYRight.Shop.Items.Size = UDim2.new(0.69,0,1,0)
  884.         script.Parent.YYRight.Shop.Items.Position = UDim2.new(0.31,0,0,0)
  885.         script.Parent.YYRight.Shop.Top.Size = UDim2.new(0.69,0,0.125,0)
  886.         script.Parent.YYRight.Shop.Top.Position = UDim2.new(0.31,0,0,0)
  887.         script.Parent.YYRight.Shop.Selected.Position = UDim2.new(0,0,0,0)
  888.     end
  889. end
  890.  
  891. adjust()
  892. spawn(function()
  893.     -- roblox doesn't seem to always get the resolution correctly for a very short period, but this should work around that:
  894.     -- (i may be wrong, and in that case, feel free to get rid of it)
  895.     wait (.5)
  896.     adjust()
  897.     wait (.5)
  898.     adjust()
  899. end)
  900.  
  901. script.Parent.ScreenRes.Changed:Connect(function()
  902.     game:GetService("RunService").Heartbeat:wait()
  903.     adjust()   
  904. end)
  905.  
  906.  
  907.  
  908. function SetButtonImage(Button)
  909.     if Button.ItemId.Value ~= -1 then
  910.         local Item = getItemById(Button.ItemId.Value)
  911.         if Item ~= nil then
  912.             Button.Icon.Image = "http://roblox.com/asset?id=" .. Item.ThumbnailId.Value
  913.             local Tier = game.ReplicatedStorage.Tiers:FindFirstChild(Item.Tier.Value)
  914.             if Tier ~= nil then
  915.                 if (Item.Tier.Value == 40 or Item.Tier.Value == 41 or Item.Tier.Value == 30 or Item.Tier.Value == 31 or Item.Tier.Value == 99 or Item.Tier.Value == 78) then
  916.                     setColor(Button.White, Tier.TierBackground.Value)
  917.                 else
  918.                     setColor(Button.White, Color3.new(225/255, 225/255, 225/255))
  919.                 end
  920.                 --[[
  921.                 Button.Tier.Visible = true
  922.                 Button.BackgroundColor3 = Tier.TierColor.Value
  923.                 Button.Tier.Text = string.sub(Tier.TierName.Value,1,1)
  924.                 Button.Tier.TextColor3 = Tier.TierColor.Value
  925.                 ]]
  926.             else
  927.             --  Button.Tier.Visible = false
  928.             end
  929.         end
  930.     else
  931.         Button.Icon.Image = ""
  932.     end
  933. end
  934.  
  935. function RefreshInventory()
  936.     local Index = 0
  937.     local Inventory = game.ReplicatedStorage.FetchInventory:InvokeServer()
  938.  
  939.     local Count = 0
  940.    
  941.     local Term
  942.     local Search = script.Parent.YYLeft.Inventory.Search.TextBox.Text
  943.     if string.len(Search) > 0 then
  944.         Term = string.lower(Search)
  945.        
  946.     end
  947.     if Term == "search..." or Term == "search.." or Term == "search." or Term == "search" or Term == " " or Term == "  " then
  948.         Term = nil
  949.     end
  950.    
  951.     local InclItems
  952.     if Term == nil then
  953.         InclItems = game.ReplicatedStorage.Items:GetChildren()
  954.         script.Parent.YYLeft.Inventory.Search.TextBox.Cancel.Visible = false
  955.     else
  956.         script.Parent.YYLeft.Inventory.Search.TextBox.Cancel.Visible = true
  957.         InclItems = {}
  958.         for i,Item in pairs(game.ReplicatedStorage.Items:GetChildren()) do
  959.             local Tier = game.ReplicatedStorage.Tiers:FindFirstChild(tostring(Item.Tier.Value))
  960.             if string.find(string.lower(Item.Name),Term) ~= nil or string.find(string.lower(Tier.TierName.Value),Term) ~= nil or (tonumber(Term) ~= nil and tonumber(Term) == Item.ItemType.Value) then
  961.                 InclItems[Item.ItemId.Value] = true
  962.             else
  963.                 InclItems[Item.ItemId.Value] = false
  964.             end
  965.         end
  966.     end
  967.  
  968.  
  969.     for i,v in pairs(script.Parent.YYLeft.Inventory.Items.Scroll:GetChildren()) do
  970.         repeat Index = Index + 1 until (Index > #game.ReplicatedStorage.Items:GetChildren()) or (Inventory[Index].Quantity and Inventory[Index].Quantity > -1 and InclItems[Index])
  971.         if not (Index > #game.ReplicatedStorage.Items:GetChildren()) then
  972.             v.ItemId.Value = Index
  973.    
  974.             v.Visible = true
  975.             v.Icon.Amount.Text = Inventory[Index].Quantity
  976.             SetButtonImage(v)
  977.             Count = Count + 1
  978.         else
  979.             v.ItemId.Value = -1
  980.    
  981.             v.Visible = false
  982.         end
  983.     end
  984.     script.Parent.YYLeft.Inventory.Buttons.Value = Count
  985. end
  986.  
  987. RefreshInventory()
  988. game.ReplicatedStorage.InventoryChanged.OnClientEvent:connect(RefreshInventory)
  989.  
  990. script.Parent.YYLeft.Inventory.Search.TextBox.Cancel.MouseButton1Click:connect(function()
  991.     script.Parent.YYLeft.Inventory.Search.TextBox.Text = "Search..."
  992. end)
  993.  
  994. script.Parent.YYLeft.Inventory.Search.TextBox.Changed:connect(function(Property)
  995.     if Property == "Text" then
  996.         RefreshInventory()
  997.  
  998.     end
  999. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement