make a roblox script that i can paste into the command line that builds a small house with an interior, make sure theres a working door and the top of the door is covered up and everything no windows
Assistant
lua
-- Create a model to hold the house parts
local house = Instance.new("Model", workspace)
house.Name = "House"
-- Set the position for the house
local housePosition = Vector3.new(0, 0, 0)
-- Create the floor
local floor = Instance.new("Part")
floor.Size = Vector3.new(20, 1, 20)
floor.Position = housePosition + Vector3.new(0, 0.5, 0)
floor.Anchored = true
floor.BrickColor = BrickColor.new("Reddish brown")
floor.Parent = house
-- Create the walls
local wallThickness = 1
local wallHeight = 10
local wallLength = 20
-- Front Wall (with door)
local frontWallLeft = Instance.new("Part")
frontWallLeft.Size = Vector3.new((wallLength - 4)/2, wallHeight, wallThickness)
frontWallLeft.Position = housePosition + Vector3.new(-((wallLength/2) - (frontWallLeft.Size.X/2)), wallHeight/2 + 0.5, -wallLength/2 + wallThickness/2)
frontWallLeft.Anchored = true
frontWallLeft.BrickColor = BrickColor.new("Medium stone grey")
frontWallLeft.Parent = house
local frontWallRight = frontWallLeft:Clone()
frontWallRight.Position = housePosition + Vector3.new(((wallLength/2) - (frontWallRight.Size.X/2)), wallHeight/2 + 0.5, -wallLength/2 + wallThickness/2)
frontWallRight.Parent = house
local doorTop = Instance.new("Part")
doorTop.Size = Vector3.new(4, wallHeight - 6, wallThickness)
doorTop.Position = housePosition + Vector3.new(0, wallHeight - ((wallHeight - 6)/2) + 0.5, -wallLength/2 + wallThickness/2)
doorTop.Anchored = true
doorTop.BrickColor = BrickColor.new("Medium stone grey")
doorTop.Parent = house
-- Back Wall
local backWall = Instance.new("Part")
backWall.Size = Vector3.new(wallLength, wallHeight, wallThickness)
backWall.Position = housePosition + Vector3.new(0, wallHeight/2 + 0.5, wallLength/2 - wallThickness/2)
backWall.Anchored = true
backWall.BrickColor = BrickColor.new("Medium stone grey")
backWall.Parent = house
-- Left Wall
local leftWall = Instance.new("Part")
leftWall.Size = Vector3.new(wallThickness, wallHeight, wallLength)
leftWall.Position = housePosition + Vector3.new(-wallLength/2 + wallThickness/2, wallHeight/2 + 0.5, 0)
leftWall.Anchored = true
leftWall.BrickColor = BrickColor.new("Medium stone grey")
leftWall.Parent = house
-- Right Wall
local rightWall = leftWall:Clone()
rightWall.Position = housePosition + Vector3.new(wallLength/2 - wallThickness/2, wallHeight/2 + 0.5, 0)
rightWall.Parent = house
-- Create the roof
local roof = Instance.new("Part")
roof.Size = Vector3.new(wallLength + 2*wallThickness, 1, wallLength + 2*wallThickness)
roof.Position = housePosition + Vector3.new(0, wallHeight + 1, 0)
roof.Anchored = true
roof.BrickColor = BrickColor.new("Dark orange")
roof.Parent = house
-- Create the door
local door = Instance.new("Part")
door.Size = Vector3.new(4, 6, wallThickness/2)
door.Position = housePosition + Vector3.new(0, 3 + 0.5, -wallLength/2 + wallThickness/2)
door.Anchored = false
door.BrickColor = BrickColor.new("Brown")
door.Parent = house
-- Create door hinge (invisible part)
local hinge = Instance.new("Part")
hinge.Size = Vector3.new(0.2, 1, 0.2)
hinge.Position = door.Position + Vector3.new(-door.Size.X/2 + 0.1, 0, 0)
hinge.Anchored = true
hinge.Transparency = 1
hinge.Parent = house
-- Create hinge constraint
local hingeConstraint = Instance.new("HingeConstraint")
hingeConstraint.Parent = door
hingeConstraint.Attachment0 = Instance.new("Attachment", hinge)
hingeConstraint.Attachment1 = Instance.new("Attachment", door)
hingeConstraint.LimitsEnabled = true
hingeConstraint.LowerAngle = 0
hingeConstraint.UpperAngle = 90
hingeConstraint.MotorMaxTorque = 10000
hingeConstraint.MotorMaxAcceleration = math.huge
hingeConstraint.AngularVelocity = 1
-- Add ClickDetector to door to make it interactive
local clickDetector = Instance.new("ClickDetector", door)
-- Door open/close script
local doorScript = Instance.new("Script", door)
doorScript.Source = [[
local open = false
local door = script.Parent
local hingeConstraint = door:FindFirstChildOfClass("HingeConstraint")
script.Parent.ClickDetector.MouseClick:Connect(function()
if open then
hingeConstraint.TargetAngle = 0
open = false
else
hingeConstraint.TargetAngle = 90
open = true
end
end)
]]
Instructions:
Open Roblox Studio and load your place.
Press F9 or open the Command Bar at the bottom.
Copy and paste the entire script above into the Command Bar.
Press Enter to execute the script.
A small house will be created at the position (0, 0, 0) in your workspace. The house includes:
Four walls without windows.
A floor and a roof.
A working door on the front wall without any gaps above it.