StenHisDirt

Copy Base

Oct 21st, 2019
14,063
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local RunService = game:GetService("RunService")
  2. local TargetPlayer = PText.Text
  3. local SlowMode = true
  4. local WipeLocal = false
  5.  
  6. local CopyStructure = true
  7. local CopyWire = true
  8. local CopyItems = true
  9. local CopyFurniture = true
  10.  
  11. if WipeLocal then
  12. for i,v in pairs(game.Workspace.PlayerModels:GetChildren()) do
  13. if v:FindFirstChild("Owner") then
  14. if v.Owner.Value == game.Players.LocalPlayer then
  15. game.ReplicatedStorage.Interaction.DestroyStructure:FireServer(v)
  16. end
  17. end
  18. end
  19. wait(0.5)
  20. end
  21.  
  22. for i,v in pairs(game.Players:GetChildren()) do
  23. if v ~= game.Players.LocalPlayer then
  24. if v.Name:find(TargetPlayer) then
  25. TargetPlayer = v
  26. break
  27. end
  28. end
  29. end
  30.  
  31. local LocalLand, TargetLand
  32.  
  33. for i,v in pairs(game.Workspace.Properties:GetChildren()) do
  34. if v:FindFirstChild("Owner") then
  35. if v.Owner.Value == TargetPlayer then
  36. TargetLand = v
  37. elseif v.Owner.Value == game.Players.LocalPlayer then
  38. LocalLand = v
  39. end
  40. end
  41. end
  42.  
  43. local CollectedTargetStructures, CollectedLocalStructures, CollectedLocalFurnitures, CollectedTargetFurnitures, CollectedLocalItems, CollectedTargetItems = {}, {}, {}, {}, {}, {}
  44. local CollectedTargetItemsCopy, CollectedTargetFurnituresCopy = {}, {}
  45. local TotalCollectedBlueprints = 0
  46.  
  47. if CopyStructure then
  48. for i,v in pairs(game.Workspace.PlayerModels:GetChildren()) do
  49. if v:FindFirstChild("Owner") and v.Owner.Value == TargetPlayer then
  50. if v:FindFirstChild("BuildDependentWood") and (v.Type.Value == "Structure" or v.Type.Value == "Furniture") then
  51. local Data = {}
  52. Data.WoodClass = v:FindFirstChild("BlueprintWoodClass") and v.BlueprintWoodClass.Value
  53. Data.OffSet = (v:FindFirstChild("MainCFrame") and v.MainCFrame.Value or v.PrimaryPart.CFrame) - TargetLand.OriginSquare.Position
  54. Data.BlueprintType = v.ItemName.Value
  55. table.insert(CollectedTargetStructures,Data)
  56. end
  57. end
  58. end
  59.  
  60. for i, Data in pairs(CollectedTargetStructures) do
  61. game.ReplicatedStorage.PlaceStructure.ClientPlacedBlueprint:FireServer(Data.BlueprintType, LocalLand.OriginSquare.CFrame - Vector3.new(0,20,0), game.Players.LocalPlayer)
  62.  
  63. if SlowMode and (math.random(1,2) ~= 1) then
  64. RunService.RenderStepped:Wait()
  65. end
  66. end
  67. end
  68.  
  69. function blueprintHasBeenCollected(Model)
  70. if CollectedLocalStructures[Model.Name] then
  71. for i, BlueprintModel in pairs(CollectedLocalStructures[Model.Name]) do
  72. if BlueprintModel == Model then
  73. return true
  74. end
  75. end
  76. end
  77. return false
  78. end
  79.  
  80. repeat
  81. for i,v in pairs(game.Workspace.PlayerModels:GetChildren()) do
  82. if v:FindFirstChild("Owner") and v.Owner.Value == game.Players.LocalPlayer and v:FindFirstChild("Type") and v.Type.Value == "Blueprint" and not blueprintHasBeenCollected(v) then
  83. if not CollectedLocalStructures[v.Name] then
  84. CollectedLocalStructures[v.Name] = {}
  85. end
  86. table.insert(CollectedLocalStructures[v.Name], v)
  87. TotalCollectedBlueprints = TotalCollectedBlueprints + 1
  88. end
  89. end
  90. wait()
  91. until TotalCollectedBlueprints == #CollectedTargetStructures
  92.  
  93. function SpawnStructure(Data, Blueprint)
  94. local Position = Data.OffSet + LocalLand.OriginSquare.Position
  95. game.ReplicatedStorage.PlaceStructure.ClientPlacedStructure:FireServer(Blueprint.ItemName.Value, Position, game.Players.LocalPlayer, Data.WoodClass, Blueprint, not Data.WoodClass)
  96. end
  97.  
  98. for i, Data in pairs(CollectedTargetStructures) do
  99. local Blueprint = CollectedLocalStructures[Data.BlueprintType][1]
  100. table.remove(CollectedLocalStructures[Data.BlueprintType], 1)
  101.  
  102. SpawnStructure(Data, Blueprint)
  103.  
  104. if SlowMode and (math.random(1,2) ~= 1) then
  105. RunService.RenderStepped:Wait()
  106. end
  107. end
  108.  
  109. function CreateWire(WireType, Points)
  110. local Wire = game.ReplicatedStorage.Purchasables.WireObjects[WireType]
  111.  
  112. for i,v in pairs(Points) do
  113. Points[i] = v + LocalLand.OriginSquare.Position
  114. end
  115.  
  116. game.ReplicatedStorage.PlaceStructure.ClientPlacedWire:FireServer(Wire, Points)
  117. end
  118.  
  119. if CopyWire then
  120. for i,v in pairs(game.Workspace.PlayerModels:GetChildren()) do
  121. if v:FindFirstChild("Owner") and v.Owner.Value == TargetPlayer and v:FindFirstChild("Type") and v.Type.Value == "Wire" and v:FindFirstChild("End1") then
  122. local Points = {}
  123. local PointCount = 1
  124.  
  125. table.insert(Points, (v.End1.Position - TargetLand.OriginSquare.Position))
  126.  
  127. for i,w in pairs(v:GetChildren()) do
  128. if w.Name:find("Point") then
  129. PointCount = PointCount + 1
  130. end
  131. end
  132.  
  133. for i=2, PointCount do
  134. local Point = v:FindFirstChild("Point"..tostring(i))
  135. table.insert(Points, (Point.Position - TargetLand.OriginSquare.Position))
  136. end
  137.  
  138. table.insert(Points, (v.End2.Position - TargetLand.OriginSquare.Position))
  139. CreateWire(v.ItemName.Value, Points)
  140.  
  141. if SlowMode and (math.random(1,2) ~= 1)then
  142. RunService.RenderStepped:Wait()
  143. end
  144. end
  145. end
  146. end
  147.  
  148. function isValidFurniture(Model)
  149. if Model:FindFirstChild("Type") and (Model.Type.Value == "Structure" or Model.Type.Value == "Furniture" or Model.Type.Value == "Vehicle Spot") then
  150. if Model:FindFirstChild("BuildDependentWood") or Model:FindFirstChild("PurchasedBoxItemName") then
  151. return false
  152. end
  153. return true
  154. end
  155. return false
  156. end
  157.  
  158. function Spawn(ItemName, Position)
  159. local Info = {}
  160. Info.Name = ItemName.Value
  161. Info.Type = ItemName.Name == "PurchasedBoxItemName" and ItemName or game.ReplicatedStorage.Purchasables.Structures.HardStructures.Sawmill2.Type
  162. Info.OtherInfo = game.ReplicatedStorage.Purchasables.WireObjects.Wire.OtherInfo
  163. local Points = {Position.p, Position.p}
  164. game.ReplicatedStorage.PlaceStructure.ClientPlacedWire:FireServer(Info, Points)
  165. end
  166.  
  167. if CopyFurniture then
  168. for i, Model in pairs(game.Workspace.PlayerModels:GetChildren()) do
  169. if Model:FindFirstChild("Owner") and Model.Owner.Value == TargetPlayer and isValidFurniture(Model) then
  170. local ItemName = Model:FindFirstChild("ItemName") or Model:FindFirstChild("PurchasedBoxItemName")
  171. local Position = (Model:FindFirstChild("MainCFrame") and Model.MainCFrame.Value or Model.PrimaryPart.CFrame) - TargetLand.OriginSquare.Position
  172.  
  173. if ItemName.Name == "PurchasedBoxItemName" then
  174. Spawn(ItemName, Position + LocalLand.OriginSquare.Position)
  175. else
  176. Spawn(ItemName, LocalLand.OriginSquare.CFrame - Vector3.new(0,20,0))
  177. end
  178.  
  179. local Data = {}
  180. Data.ItemName = ItemName.Value
  181. Data.OffSet = Position
  182.  
  183. table.insert(CollectedTargetFurnitures, Data)
  184.  
  185. if SlowMode and (math.random(1,2) ~= 1)then
  186. RunService.RenderStepped:Wait()
  187. end
  188. end
  189. end
  190. end
  191.  
  192. for i, v in pairs(CollectedTargetFurnitures) do
  193. table.insert(CollectedTargetFurnituresCopy,v)
  194. end
  195.  
  196. function isValidFurnitureModel(Model)
  197. for i, Data in pairs(CollectedTargetFurnitures) do
  198. if Data.ItemName == Model.ItemName.Value then
  199. table.remove(CollectedTargetFurnitures, i)
  200. return true
  201. end
  202. end
  203. return false
  204. end
  205.  
  206. repeat
  207. for i, Model in pairs(game.Workspace.PlayerModels:GetChildren()) do
  208. if Model.Name == "Wire" and Model:FindFirstChild("Owner") and Model.Owner.Value == game.Players.LocalPlayer and Model.ItemName.Value ~= "Wire" and isValidFurnitureModel(Model) then
  209. table.insert(CollectedLocalFurnitures, Model)
  210. end
  211. end
  212. wait()
  213. until #CollectedTargetFurnitures == 0
  214.  
  215. function GrabModelFromCollectedFurnitures(ItemName)
  216. for i, Model in pairs(CollectedLocalFurnitures) do
  217. if Model.ItemName.Value == ItemName then
  218. table.remove(CollectedLocalFurnitures,i)
  219. return Model
  220. end
  221. end
  222. end
  223.  
  224. for i, Data in pairs(CollectedTargetFurnituresCopy) do
  225. local Model = GrabModelFromCollectedFurnitures(Data.ItemName)
  226. local ItemName = Data.ItemName
  227. local Position = Data.OffSet + LocalLand.OriginSquare.Position
  228. game.ReplicatedStorage.PlaceStructure.ClientPlacedStructure:FireServer(ItemName,Position,game.Players.LocalPlayer,false,Model,true)
  229.  
  230. if SlowMode and (math.random(1,2) ~= 1)then
  231. RunService.RenderStepped:Wait()
  232. end
  233. end
  234.  
  235. function isValidItem(Model)
  236. if Model:FindFirstChild("Type") and (Model.Type.Value == "Structure" or Model.Type.Value == "Loose Item" or Model.Type.Value == "Tool" or Model.Type.Value == "Wire" or Model.Type.Value == "Furniture" or Model.Type.Value == "Gift") then
  237. if (Model.Type.Value == "Structure" or Model.Type.Value == "Wire" or Model.Type.Value == "Furniture") and not Model:FindFirstChild("PurchasedBoxItemName") then
  238. return false
  239. end
  240.  
  241. return true
  242. elseif not Model:FindFirstChild("Type") then
  243. if Model:FindFirstChild("ItemName") then
  244. local ItemName = Model.ItemName.Value:lower()
  245.  
  246. if ItemName:find("bob") and (ItemName:find("wob") or ItemName:find("head"))then
  247. return true
  248. end
  249. end
  250. end
  251. return false
  252. end
  253. function itemIsOnLand(Position)
  254. if (math.abs(Position.X - TargetLand.OriginSquare.Position.X) > 101 or math.abs(Position.Z - TargetLand.OriginSquare.Position.Z) > 101) then
  255. return false
  256. end
  257. for i, Square in pairs(TargetLand:GetChildren()) do
  258. if Square.Name == "Square" then
  259. if (math.abs(Position.X - Square.Position.X) < 21 and math.abs(Position.Z - Square.Position.Z) < 21) then
  260. return true
  261. end
  262. end
  263. end
  264. return false
  265. end
  266.  
  267. if CopyItems then
  268. for i, Model in pairs(game.Workspace.PlayerModels:GetChildren()) do
  269. if Model:FindFirstChild("Owner") and Model.Owner.Value == TargetPlayer and isValidItem(Model) then
  270. local ItemName = Model:FindFirstChild("ItemName") or Model:FindFirstChild("PurchasedBoxItemName")
  271. local Position = (Model:FindFirstChild("MainCFrame") and Model.MainCFrame.Value or Model.PrimaryPart.CFrame) - TargetLand.OriginSquare.Position
  272.  
  273. if itemIsOnLand((Model:FindFirstChild("MainCFrame") and Model.MainCFrame.Value or Model.PrimaryPart.CFrame).p) then
  274. Spawn(ItemName, LocalLand.OriginSquare.CFrame - Vector3.new(0,20,0))
  275.  
  276. local Data = {}
  277. Data.ItemName = ItemName.Value
  278. Data.OffSet = Position
  279.  
  280. table.insert(CollectedTargetItems, Data)
  281.  
  282. if SlowMode and (math.random(1,2) ~= 1)then
  283. RunService.RenderStepped:Wait()
  284. end
  285. end
  286. end
  287. end
  288. end
  289.  
  290. for i, v in pairs(CollectedTargetItems) do
  291. table.insert(CollectedTargetItemsCopy,v)
  292. end
  293.  
  294. function isValidItemModel(Model)
  295. for i, Data in pairs(CollectedTargetItems) do
  296. if Data.ItemName == Model.ItemName.Value then
  297. table.remove(CollectedTargetItems, i)
  298. return true
  299. end
  300. end
  301. return false
  302. end
  303. function itemHasBeenCollected(Model)
  304. for i, Data in pairs(CollectedLocalItems) do
  305. if Data.ItemName == Model.ItemName.Value then
  306. return true
  307. end
  308. end
  309. return false
  310. end
  311.  
  312. repeat
  313. for i, Model in pairs(game.Workspace.PlayerModels:GetChildren()) do
  314. if Model.Name == "Wire" and Model:FindFirstChild("Owner") and Model.Owner.Value == game.Players.LocalPlayer and (Model.ItemName.Value ~= "Wire" or (Model:FindFirstChild("ItemName") and Model.ItemName.Value == "Wire" and Model:FindFirstChild("PurchasedBoxItemName"))) and isValidItemModel(Model) and not itemHasBeenCollected(Model) then
  315. table.insert(CollectedLocalItems, Model)
  316. end
  317. end
  318. wait()
  319. until #CollectedTargetItems == 0
  320.  
  321. function GrabModelFromCollectedItems(ItemName)
  322. for i, Model in pairs(CollectedLocalItems) do
  323. if Model.ItemName.Value == ItemName then
  324. table.remove(CollectedLocalItems,i)
  325. return Model
  326. end
  327. end
  328. end
  329.  
  330. for i, Data in pairs(CollectedTargetItemsCopy) do
  331. local Model = GrabModelFromCollectedItems(Data.ItemName)
  332. local ItemName = Data.ItemName
  333. local Position = Data.OffSet + LocalLand.OriginSquare.Position
  334.  
  335. if Model:FindFirstChild("PurchasedBoxItemName") then
  336. game.ReplicatedStorage.PlaceStructure.ClientPlacedStructure:FireServer(false, Position, false, false, Model)
  337. Model.Parent = nil
  338. else
  339. game.ReplicatedStorage.PlaceStructure.ClientPlacedStructure:FireServer(ItemName,Position,game.Players.LocalPlayer,false,Model,true)
  340. end
  341.  
  342. if SlowMode and (math.random(1,2) ~= 1)then
  343. RunService.RenderStepped:Wait()
  344. end
  345. end
  346.  
  347. print("Finished Copying!")
RAW Paste Data