Advertisement
pheed

Untitled

Jan 4th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.88 KB | None | 0 0
  1. local Plrs = game:GetService("Players")
  2. local MyPlr = Plrs.LocalPlayer
  3.  
  4. function FindPlayer(Str, Hint)
  5. local Plr = { }
  6. for _, v in pairs(Plrs:GetPlayers()) do
  7. if string.lower(string.sub(v.Name, 1, string.len(Str))) == string.lower(Str) then
  8. table.insert(Plr, v)
  9. end
  10. end
  11. if #Plr == 1 then
  12. return Plr[1]
  13. else
  14. Hint.Text = "PLAYER NOT FOUND. CHECK YOUR SPELLING YOU IDIOT."
  15. wait(5)
  16. Hint:Destroy()
  17. error("lalalalalalalalalalaalalalaalalallalalalallalalallalalalallalalalall")
  18. end
  19. end
  20.  
  21. function FindHouse(Plr)
  22. local Properties = { }
  23. for _, v in next, workspace:GetChildren() do
  24. if v:IsA("Model") and v.Name == "Property" then
  25. table.insert(Properties, v:GetChildren())
  26. end
  27. end
  28. for _, v in next, Properties do
  29. local Find = v[1]:FindFirstChild("Owner")
  30. if Find then
  31. if Find.Value == Plr.Name then
  32. return v[1]
  33. end
  34. end
  35. end
  36.  
  37. return nil
  38. end
  39.  
  40. function FlipLightSwitches(House)
  41. local StaticAssets = House.StaticAssets
  42. for _, v in next, StaticAssets:GetDescendants() do
  43. if v.Name == "SwitchV2" then
  44. workspace.CommunicationRelays.Interaction.LightInteractV2:FireServer(v)
  45. end
  46. end
  47. end
  48.  
  49. function BuildHouse(Str)
  50. local Building = true
  51. local Hint = Instance.new("Hint", game:GetService("CoreGui"))
  52. Hint.Text = "Stealing house... (This could take a while... and you might lag...)"
  53. local Plr = FindPlayer(Str, Hint)
  54. workspace.CommunicationRelays.Interclient.SendMessage:InvokeServer("I stole your house. To get it back: reset character, and spawn it in again. I'm Sowwy. :(", Plr.Name)
  55. local GetHouse = FindHouse(Plr)
  56. if GetHouse == nil then
  57. Hint.Text = "That player doesn't have a house!"
  58. wait(7)
  59. Hint:Destroy()
  60. return
  61. end
  62. MyPlr.Character.HumanoidRootPart.CFrame = CFrame.new(GetHouse.PrimaryPart.Position + Vector3.new(0, 5, 0))
  63. repeat wait() until GetHouse.StaticAssets:FindFirstChild("Furniture")
  64. local GetFurniture = GetHouse.StaticAssets:FindFirstChild("Furniture")
  65. local TempFurniture = Instance.new("Folder", MyPlr)
  66. TempFurniture.Name = "TempFurniture"
  67. local GetColors = GetHouse.AestheticChanger.UpdateRequested
  68. local Table = { }
  69. Table["HouseType"] = GetHouse.Name
  70. Table["Furniture"] = { }
  71. Table["Variables"] = { }
  72. for i, v in next, GetFurniture:GetChildren() do
  73. local Clo = v:clone()
  74. Clo.Parent = TempFurniture
  75. end
  76. for i, v in next, GetColors:GetChildren() do
  77. Table["Variables"][v.Name] = v.Value
  78. end
  79.  
  80. workspace.CommunicationRelays.House.ResetProperty:FireServer(GetHouse)
  81. workspace.CommunicationRelays.HomePurchase.House:InvokeServer(GetHouse.Parent, Table)
  82.  
  83. GetHouse = FindHouse(MyPlr)
  84. for i, v in next, TempFurniture:GetChildren() do
  85. Hint.Text = "Stealing house... placing furniture " .. i .. "/" .. #TempFurniture:GetChildren()
  86. local Item = v:FindFirstChild("Item")
  87. local Color = v:FindFirstChild("Color")
  88. if Item and Color then
  89. local test = workspace.CommunicationRelays.House.PlaceFurniture:InvokeServer(v.Name, v.PrimaryPart.CFrame, GetHouse, Item.Value, Color.Value)
  90. if v.Name == "SS_Wooden Sign" then
  91. workspace.CommunicationRelays.Interaction.EditSign:FireServer(test, v.Plaque.SurfaceGui.TextLabel.Text)
  92. end
  93. else
  94. local Color1 = v:FindFirstChild("Color1")
  95. local Color2 = v:FindFirstChild("Color2")
  96. local Display = v:FindFirstChild("Display")
  97. if Color1 and Color2 and Display then
  98. workspace.CommunicationRelays.House.PlaceFurniture:InvokeServer(v.Name, v.PrimaryPart.CFrame, GetHouse, Item.Value, {["Display"] = Display.Value, ["Color1"] = Color1.Value, ["Color2"] = Color2.Value})
  99. end
  100. end
  101. game:GetService("RunService").RenderStepped:wait()
  102. end
  103.  
  104. TempFurniture:Destroy()
  105.  
  106. MyPlr.PlayerGui.Main.MyHouse.Value = GetHouse
  107.  
  108. FlipLightSwitches(GetHouse)
  109. Building = false
  110.  
  111. Hint.Text = "House copied, and spawned. Place some furniture to save it to server."
  112. wait(10)
  113. Hint:Destroy()
  114.  
  115. return Table
  116. end
  117.  
  118. BuildHouse(Target)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement