Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Plrs = game:GetService("Players")
- local MyPlr = Plrs.LocalPlayer
- function FindPlayer(Str, Hint)
- local Plr = { }
- for _, v in pairs(Plrs:GetPlayers()) do
- if string.lower(string.sub(v.Name, 1, string.len(Str))) == string.lower(Str) then
- table.insert(Plr, v)
- end
- end
- if #Plr == 1 then
- return Plr[1]
- else
- Hint.Text = "PLAYER NOT FOUND. CHECK YOUR SPELLING YOU IDIOT."
- wait(5)
- Hint:Destroy()
- error("lalalalalalalalalalaalalalaalalallalalalallalalallalalalallalalalall")
- end
- end
- function FindHouse(Plr)
- local Properties = { }
- for _, v in next, workspace:GetChildren() do
- if v:IsA("Model") and v.Name == "Property" then
- table.insert(Properties, v:GetChildren())
- end
- end
- for _, v in next, Properties do
- local Find = v[1]:FindFirstChild("Owner")
- if Find then
- if Find.Value == Plr.Name then
- return v[1]
- end
- end
- end
- return nil
- end
- function FlipLightSwitches(House)
- local StaticAssets = House.StaticAssets
- for _, v in next, StaticAssets:GetDescendants() do
- if v.Name == "SwitchV2" then
- workspace.CommunicationRelays.Interaction.LightInteractV2:FireServer(v)
- end
- end
- end
- function BuildHouse(Str)
- local Building = true
- local Hint = Instance.new("Hint", game:GetService("CoreGui"))
- Hint.Text = "Stealing house... (This could take a while... and you might lag...)"
- local Plr = FindPlayer(Str, Hint)
- 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)
- local GetHouse = FindHouse(Plr)
- if GetHouse == nil then
- Hint.Text = "That player doesn't have a house!"
- wait(7)
- Hint:Destroy()
- return
- end
- MyPlr.Character.HumanoidRootPart.CFrame = CFrame.new(GetHouse.PrimaryPart.Position + Vector3.new(0, 5, 0))
- repeat wait() until GetHouse.StaticAssets:FindFirstChild("Furniture")
- local GetFurniture = GetHouse.StaticAssets:FindFirstChild("Furniture")
- local TempFurniture = Instance.new("Folder", MyPlr)
- TempFurniture.Name = "TempFurniture"
- local GetColors = GetHouse.AestheticChanger.UpdateRequested
- local Table = { }
- Table["HouseType"] = GetHouse.Name
- Table["Furniture"] = { }
- Table["Variables"] = { }
- for i, v in next, GetFurniture:GetChildren() do
- local Clo = v:clone()
- Clo.Parent = TempFurniture
- end
- for i, v in next, GetColors:GetChildren() do
- Table["Variables"][v.Name] = v.Value
- end
- workspace.CommunicationRelays.House.ResetProperty:FireServer(GetHouse)
- workspace.CommunicationRelays.HomePurchase.House:InvokeServer(GetHouse.Parent, Table)
- GetHouse = FindHouse(MyPlr)
- for i, v in next, TempFurniture:GetChildren() do
- Hint.Text = "Stealing house... placing furniture " .. i .. "/" .. #TempFurniture:GetChildren()
- local Item = v:FindFirstChild("Item")
- local Color = v:FindFirstChild("Color")
- if Item and Color then
- local test = workspace.CommunicationRelays.House.PlaceFurniture:InvokeServer(v.Name, v.PrimaryPart.CFrame, GetHouse, Item.Value, Color.Value)
- if v.Name == "SS_Wooden Sign" then
- workspace.CommunicationRelays.Interaction.EditSign:FireServer(test, v.Plaque.SurfaceGui.TextLabel.Text)
- end
- else
- local Color1 = v:FindFirstChild("Color1")
- local Color2 = v:FindFirstChild("Color2")
- local Display = v:FindFirstChild("Display")
- if Color1 and Color2 and Display then
- workspace.CommunicationRelays.House.PlaceFurniture:InvokeServer(v.Name, v.PrimaryPart.CFrame, GetHouse, Item.Value, {["Display"] = Display.Value, ["Color1"] = Color1.Value, ["Color2"] = Color2.Value})
- end
- end
- game:GetService("RunService").RenderStepped:wait()
- end
- TempFurniture:Destroy()
- MyPlr.PlayerGui.Main.MyHouse.Value = GetHouse
- FlipLightSwitches(GetHouse)
- Building = false
- Hint.Text = "House copied, and spawned. Place some furniture to save it to server."
- wait(10)
- Hint:Destroy()
- return Table
- end
- BuildHouse(Target)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement