Advertisement
Guest User

Lumber Tycoon 2 Item Spawner

a guest
May 23rd, 2019
28,971
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.24 KB | None | 0 0
  1. -- Converted to lua with Syntax's Converter
  2. -- Masterpiece created by checkraisefold
  3. -- Spawn script by TehDino
  4.  
  5. -- GUI CREATION
  6. local function CreateInstance(cls,props)
  7. local inst = Instance.new(cls)
  8. for i,v in pairs(props) do
  9. inst[i] = v
  10. end
  11. return inst
  12. end
  13.  
  14. local spawnermemes = CreateInstance('ScreenGui',{DisplayOrder=0,Enabled=true,ResetOnSpawn=true,Name='spawnermemes', Parent=game.CoreGui})
  15. local ToggleButton = CreateInstance('ImageButton',{Image='rbxassetid://2790390993',ImageColor3=Color3.new(0.290196, 0.290196, 0.290196),ImageRectOffset=Vector2.new(0, 0),ImageRectSize=Vector2.new(0, 0),ImageTransparency=0,ScaleType=Enum.ScaleType.Slice,SliceCenter=Rect.new(16, 16, 240, 240),AutoButtonColor=true,Modal=false,Selected=false,Style=Enum.ButtonStyle.Custom,Active=true,AnchorPoint=Vector2.new(0, 0),BackgroundColor3=Color3.new(0.290196, 0.290196, 0.290196),BackgroundTransparency=1,BorderColor3=Color3.new(0.105882, 0.164706, 0.207843),BorderSizePixel=0,ClipsDescendants=false,Draggable=false,Position=UDim2.new(0.0117044626, 0, 0.46198836, 0),Rotation=0,Selectable=true,Size=UDim2.new(0.0738844201, 0, 0.073099412, 0),SizeConstraint=Enum.SizeConstraint.RelativeXY,Visible=true,ZIndex=2,Name='ToggleButton',Parent = spawnermemes})
  16. local ToggleText = CreateInstance('TextLabel',{Font=Enum.Font.Gotham,FontSize=Enum.FontSize.Size18,Text='Toggle',TextColor3=Color3.new(1, 1, 1),TextScaled=false,TextSize=16,TextStrokeColor3=Color3.new(0, 0, 0),TextStrokeTransparency=1,TextTransparency=0,TextWrapped=false,TextXAlignment=Enum.TextXAlignment.Center,TextYAlignment=Enum.TextYAlignment.Center,Active=false,AnchorPoint=Vector2.new(0.5, 0.5),BackgroundColor3=Color3.new(0.639216, 0.635294, 0.647059),BackgroundTransparency=1,BorderColor3=Color3.new(0.105882, 0.164706, 0.207843),BorderSizePixel=1,ClipsDescendants=false,Draggable=false,Position=UDim2.new(0.5, 0, 0.5, 0),Rotation=0,Selectable=false,Size=UDim2.new(1, 0, 0.899999976, 0),SizeConstraint=Enum.SizeConstraint.RelativeXY,Visible=true,ZIndex=2,Name='ToggleText',Parent = ToggleButton})
  17. local main = CreateInstance('Frame',{Style=Enum.FrameStyle.Custom,Active=false,AnchorPoint=Vector2.new(0, 0),BackgroundColor3=Color3.new(0.231373, 0.231373, 0.231373),BackgroundTransparency=0,BorderColor3=Color3.new(0.105882, 0.164706, 0.207843),BorderSizePixel=0,ClipsDescendants=false,Draggable=false,Position=UDim2.new(0.30713743, 0, 0.269005865, 0),Rotation=0,Selectable=false,Size=UDim2.new(0.385725141, 0, 0.46198827, 0),SizeConstraint=Enum.SizeConstraint.RelativeXY,Visible=false,ZIndex=1,Name = 'main',Parent = spawnermemes})
  18. local meme = CreateInstance('ImageLabel',{Image='rbxassetid://107783370',ImageColor3=Color3.new(1, 1, 1),ImageRectOffset=Vector2.new(0, 0),ImageRectSize=Vector2.new(0, 0),ImageTransparency=0,ScaleType=Enum.ScaleType.Stretch,SliceCenter=Rect.new(0, 0, 0, 0),Active=false,AnchorPoint=Vector2.new(0, 0),BackgroundColor3=Color3.new(1, 1, 1),BackgroundTransparency=1,BorderColor3=Color3.new(0.105882, 0.164706, 0.207843),BorderSizePixel=0,ClipsDescendants=false,Draggable=false,Position=UDim2.new(0, 0, 0.887341738, 0),Rotation=0,Selectable=false,Size=UDim2.new(0.0644811019, 0, 0.110759504, 0),SizeConstraint=Enum.SizeConstraint.RelativeXY,Visible=true,ZIndex=1,Name='meme',Parent = main})
  19. local topbar = CreateInstance('Frame',{Style=Enum.FrameStyle.Custom,Active=false,AnchorPoint=Vector2.new(0, 0),BackgroundColor3=Color3.new(0.105882, 0.105882, 0.105882),BackgroundTransparency=0,BorderColor3=Color3.new(0.105882, 0.164706, 0.207843),BorderSizePixel=0,ClipsDescendants=false,Draggable=false,Position=UDim2.new(0, 0, 0, 0),Rotation=0,Selectable=false,Size=UDim2.new(1, 0, 0.0890000015, 0),SizeConstraint=Enum.SizeConstraint.RelativeXY,Visible=true,ZIndex=1,Name = 'topbar',Parent = main})
  20. local TopbarText = CreateInstance('TextLabel',{Font=Enum.Font.Gotham,FontSize=Enum.FontSize.Size18,Text='CHECK\'S MEME MACHINE - V1.1',TextColor3=Color3.new(1, 1, 1),TextScaled=false,TextSize=20,TextStrokeColor3=Color3.new(0, 0, 0),TextStrokeTransparency=1,TextTransparency=0,TextWrapped=false,TextXAlignment=Enum.TextXAlignment.Left,TextYAlignment=Enum.TextYAlignment.Center,Active=false,AnchorPoint=Vector2.new(0, 0),BackgroundColor3=Color3.new(1, 1, 1),BackgroundTransparency=1,BorderColor3=Color3.new(0.105882, 0.164706, 0.207843),BorderSizePixel=0,ClipsDescendants=false,Draggable=false,Position=UDim2.new(0.0199999996, 0, 0, 0),Rotation=0,Selectable=false,Size=UDim2.new(.5, 0, 1, 0),SizeConstraint=Enum.SizeConstraint.RelativeXY,Visible=true,ZIndex=1,Name='TopbarText',Parent = topbar})
  21. local TopbarText2 = CreateInstance('TextLabel',{Font=Enum.Font.Gotham,FontSize=Enum.FontSize.Size12,Text='checkraisefold#1910',TextColor3=Color3.new(1, 1, 1),TextScaled=false,TextSize=12,TextStrokeColor3=Color3.new(0, 0, 0),TextStrokeTransparency=1,TextTransparency=0,TextWrapped=false,TextXAlignment=Enum.TextXAlignment.Center,TextYAlignment=Enum.TextYAlignment.Center,Active=false,AnchorPoint=Vector2.new(0, 0),BackgroundColor3=Color3.new(1, 1, 1),BackgroundTransparency=1,BorderColor3=Color3.new(0.105882, 0.164706, 0.207843),BorderSizePixel=0,ClipsDescendants=false,Draggable=false,Position=UDim2.new(0.742567658, 0, 0, 0),Rotation=0,Selectable=false,Size=UDim2.new(0.257247478, 0, 1.00000012, 0),SizeConstraint=Enum.SizeConstraint.RelativeXY,Visible=true,ZIndex=1,Name='TopbarText2',Parent = topbar})
  22. local QuantityToSpawn = CreateInstance('ImageLabel',{Image='rbxassetid://2790390993',ImageColor3=Color3.new(0.290196, 0.290196, 0.290196),ImageRectOffset=Vector2.new(0, 0),ImageRectSize=Vector2.new(0, 0),ImageTransparency=0,ScaleType=Enum.ScaleType.Slice,SliceCenter=Rect.new(16, 16, 240, 240),Active=false,AnchorPoint=Vector2.new(0, 0),BackgroundColor3=Color3.new(0.290196, 0.290196, 0.290196),BackgroundTransparency=1,BorderColor3=Color3.new(0.105882, 0.164706, 0.207843),BorderSizePixel=1,ClipsDescendants=false,Draggable=false,Position=UDim2.new(0.730000019, 0, 0.88499999, 0),Rotation=0,Selectable=false,Size=UDim2.new(0.128962323, 0, 0.0917721614, 0),SizeConstraint=Enum.SizeConstraint.RelativeXY,Visible=true,ZIndex=1,Name='QuantityToSpawn',Parent = main})
  23. local QuantitySpawnText = CreateInstance('TextBox',{ClearTextOnFocus=true,Font=Enum.Font.Gotham,FontSize=Enum.FontSize.Size14,MultiLine=false,Text='Qnty',TextColor3=Color3.new(1, 1, 1), PlaceholderText='', PlaceholderColor3=Color3.new(0.7, 0.7, 0.7),TextScaled=false,TextSize=13,TextStrokeColor3=Color3.new(0, 0, 0),TextStrokeTransparency=1,TextTransparency=0,TextWrapped=false,TextXAlignment=Enum.TextXAlignment.Center,TextYAlignment=Enum.TextYAlignment.Center,Active=true,AnchorPoint=Vector2.new(0.5, 0.5),BackgroundColor3=Color3.new(0.639216, 0.635294, 0.647059),BackgroundTransparency=1,BorderColor3=Color3.new(0.105882, 0.164706, 0.207843),BorderSizePixel=1,ClipsDescendants=false,Draggable=false,Position=UDim2.new(0.5, 0, 0.5, 0),Rotation=0,Selectable=true,Size=UDim2.new(1, 0, 0.899999976, 0),SizeConstraint=Enum.SizeConstraint.RelativeXY,Visible=true,ZIndex=1,Name='QuantitySpawnText',Parent = QuantityToSpawn})
  24. local SpawnButton = CreateInstance('ImageButton',{Image='rbxassetid://2790390993',ImageColor3=Color3.new(0, 0.823529, 0),ImageRectOffset=Vector2.new(0, 0),ImageRectSize=Vector2.new(0, 0),ImageTransparency=0,ScaleType=Enum.ScaleType.Slice,SliceCenter=Rect.new(16, 16, 240, 240),AutoButtonColor=true,Modal=false,Selected=false,Style=Enum.ButtonStyle.Custom,Active=true,AnchorPoint=Vector2.new(0, 0),BackgroundColor3=Color3.new(0, 0.823529, 0),BackgroundTransparency=1,BorderColor3=Color3.new(0.105882, 0.164706, 0.207843),BorderSizePixel=1,ClipsDescendants=false,Draggable=false,Position=UDim2.new(0.13275522, 0, 0.224683568, 0),Rotation=0,Selectable=true,Size=UDim2.new(0.379300624, 0, 0.158227861, 0),SizeConstraint=Enum.SizeConstraint.RelativeXY,Visible=true,ZIndex=1,Name='SpawnButton',Parent = main})
  25. local TextLabel = CreateInstance('TextLabel',{Font=Enum.Font.Gotham,FontSize=Enum.FontSize.Size18,Text='Spawn',TextColor3=Color3.new(1, 1, 1),TextScaled=false,TextSize=16,TextStrokeColor3=Color3.new(0, 0, 0),TextStrokeTransparency=1,TextTransparency=0,TextWrapped=false,TextXAlignment=Enum.TextXAlignment.Center,TextYAlignment=Enum.TextYAlignment.Center,Active=false,AnchorPoint=Vector2.new(0.5, 0.5),BackgroundColor3=Color3.new(0.639216, 0.635294, 0.647059),BackgroundTransparency=1,BorderColor3=Color3.new(0.105882, 0.164706, 0.207843),BorderSizePixel=1,ClipsDescendants=false,Draggable=false,Position=UDim2.new(0.5, 0, 0.5, 0),Rotation=0,Selectable=false,Size=UDim2.new(1, 0, 0.899999976, 0),SizeConstraint=Enum.SizeConstraint.RelativeXY,Visible=true,ZIndex=1,Name='TextLabel',Parent = SpawnButton})
  26. local ItemToSpawn = CreateInstance('ImageLabel',{Image='rbxassetid://2790390993',ImageColor3=Color3.new(0.290196, 0.290196, 0.290196),ImageRectOffset=Vector2.new(0, 0),ImageRectSize=Vector2.new(0, 0),ImageTransparency=0,ScaleType=Enum.ScaleType.Slice,SliceCenter=Rect.new(16, 16, 240, 240),Active=false,AnchorPoint=Vector2.new(0, 0),BackgroundColor3=Color3.new(0.290196, 0.290196, 0.290196),BackgroundTransparency=1,BorderColor3=Color3.new(0.105882, 0.164706, 0.207843),BorderSizePixel=1,ClipsDescendants=false,Draggable=false,Position=UDim2.new(0.133,0,0.595,0),Rotation=0,Selectable=false,Size=UDim2.new(0.379300624, 0, 0.158227861, 0),SizeConstraint=Enum.SizeConstraint.RelativeXY,Visible=true,ZIndex=1,Name='ItemToSpawn',Parent = main})
  27. local ItemSpawnText = CreateInstance('TextBox',{ClearTextOnFocus=true,Font=Enum.Font.Gotham,FontSize=Enum.FontSize.Size18,MultiLine=false,Text='Item',TextColor3=Color3.new(1, 1, 1), PlaceholderText='', PlaceholderColor3=Color3.new(0.7, 0.7, 0.7),TextScaled=false,TextSize=16,TextStrokeColor3=Color3.new(0, 0, 0),TextStrokeTransparency=1,TextTransparency=0,TextWrapped=false,TextXAlignment=Enum.TextXAlignment.Center,TextYAlignment=Enum.TextYAlignment.Center,Active=true,AnchorPoint=Vector2.new(0.5, 0.5),BackgroundColor3=Color3.new(0.639216, 0.635294, 0.647059),BackgroundTransparency=1,BorderColor3=Color3.new(0.105882, 0.164706, 0.207843),BorderSizePixel=1,ClipsDescendants=false,Draggable=false,Position=UDim2.new(0.5, 0, 0.5, 0),Rotation=0,Selectable=true,Size=UDim2.new(1, 0, 0.899999976, 0),SizeConstraint=Enum.SizeConstraint.RelativeXY,Visible=true,ZIndex=1,Name='ItemSpawnText',Parent = ItemToSpawn})
  28. local ViewportFrame = CreateInstance('ViewportFrame', {BackgroundColor3=Color3.fromRGB(74, 74, 74), BorderSizePixel=0, Position=UDim2.new(0.626,0,0.127,0), Size=UDim2.new(0.339, 0,0.744, 0), Parent=main})
  29. local ViewportCamera = CreateInstance('Camera', {Parent=ViewportFrame})
  30. ViewportFrame.CurrentCamera = ViewportCamera
  31.  
  32. -- MAIN VARIABLES
  33. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  34. local translations = {
  35. [ReplicatedStorage.Purchasables.Other.Eye1] = "OstrichEye"
  36. }
  37. local objects = {}
  38. local item
  39. local quantityofitems
  40. local Land
  41.  
  42. -- MAIN SCRIPT
  43.  
  44. -- creds to tehdino for this part
  45.  
  46.  
  47.  
  48. function Spawn(Item)
  49. local Info = {}
  50. Info.Name = Item.Name
  51. Info.Type = game.ReplicatedStorage.Purchasables.Structures.HardStructures.Sawmill2.Type
  52. Info.OtherInfo = game.ReplicatedStorage.Purchasables.WireObjects.Wire.OtherInfo
  53. local Points = {Land.OriginSquare.Position + Vector3.new(0,5,0), Land.OriginSquare.Position + Vector3.new(0,5,0)}
  54. game.ReplicatedStorage.PlaceStructure.ClientPlacedWire:FireServer(Info, Points)
  55. end
  56.  
  57. -- connections and gui functionality
  58.  
  59. for i,v in pairs(ReplicatedStorage.Purchasables:GetDescendants()) do
  60. if v:IsA("Folder") and not (translations[v]) and not (v.Parent.Name == "Vehicles") and v:FindFirstChild("ItemName") then
  61. table.insert(objects, v) -- this if statement is ugly lol
  62. end
  63. end
  64.  
  65. ToggleButton.MouseButton1Click:connect(function()
  66. main.Visible = not main.Visible
  67. end)
  68.  
  69. ItemSpawnText.FocusLost:connect(function()
  70. for i,v in pairs(objects) do
  71. if string.find(v.Name:lower(), ItemSpawnText.Text:lower()) then
  72. item = v
  73. ItemSpawnText.Text = v.Name
  74. end
  75. end
  76. for i,v in pairs(translations) do
  77. if string.find(v:lower(), ItemSpawnText.Text:lower()) then
  78. item = i
  79. ItemSpawnText.Text = v
  80. end
  81. end
  82. if item then
  83. if item:FindFirstChild("Model") then
  84. for i,v in pairs(ViewportFrame:GetChildren()) do if v:IsA("Model") then v:Destroy() end end
  85. ViewportCamera.CoordinateFrame = item.Model.Main.CFrame + Vector3.new(0,0,10)
  86. local modelclonermemer = item.Model:Clone()
  87. modelclonermemer.Parent = ViewportFrame
  88. end
  89. end
  90. end)
  91.  
  92. QuantitySpawnText.FocusLost:connect(function()
  93. quantityofitems = tonumber(QuantitySpawnText.Text)
  94. end)
  95.  
  96. SpawnButton.MouseButton1Click:connect(function()
  97. if item and quantityofitems and Land then
  98. for i=1, quantityofitems do
  99. Spawn(item)
  100. end
  101. end
  102. end)
  103.  
  104. spawn(function()
  105. while wait() do
  106. for i,v in pairs(ViewportFrame:GetChildren()) do
  107. if v:IsA("Model") then
  108. v.Main.CFrame = v.Main.CFrame * CFrame.Angles(0, math.rad(3), 0)
  109. end
  110. end
  111. end
  112. end)
  113.  
  114. spawn(function()
  115. while wait() do
  116. while Land == nil do
  117. wait()
  118. for i,v in pairs(game.Workspace.Properties:GetChildren()) do
  119. if v.Owner.Value == game.Players.LocalPlayer then
  120. Land = v
  121. break
  122. end
  123. end
  124. if not Land then
  125. for i,v in pairs(game.Workspace.Properties:GetChildren()) do
  126. if v.Owner.Value == game.Players.LocalPlayer or v.Owner.Value == nil then
  127. Land = v
  128. game.ReplicatedStorage.Interaction.ClientIsDragging:FireServer(v)
  129. break
  130. end
  131. end
  132. end
  133. end
  134. end
  135. end)
  136.  
  137. spawn(function()
  138. for i = 1, math.huge do
  139. wait()
  140. local color = Color3.fromHSV((tick() * 80 % 360)/360, 1, 1)
  141. TopbarText.TextColor3 = color
  142. end
  143. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement