How to make trim for your roblox game
A long time ago when I was making my first game, I wanted to add trim to a maze I was making (You know, the stuff that sticks out at the bottom of walls, probably in your own bedroom). However, I didn’t know that there was an easier way to do it than going through all of your walls and scaling them individually.
Here is an easy way that you can make trim for your game IN UNDER 5 MINUTES!!!
Setup:
If you haven’t already, create a folder for all of the walls you want to add trim to. This way we can loop through the folder and create trim for each wall via a script.
Scripting
Okay, now time to script. Create a script inside of the workspace and name it to something cool. I named mine “AddTrim”.
Then, use this code (I added comments so beginners can understand it better):
local Walls = game.Workspace.Walls -- Define the location of your folder containing all of the walls
local Script = game.Workspace.AddTrim -- Define the location of your script
local Folder = Instance.new("Folder", Walls) -- Create a folder inside of the Walls folder
Folder.Name = "Trim"
for i, v in pairs(Walls:GetChildren()) do -- loops through everything in your wall folder
if v:IsA("Part") then -- testing if it is a part, Note that your wall could also be a meshpart so you may have to change this line accordingly
local OriginalSize = v.Size -- The size of the wall creating trim for
local OriginalPosition = v.Position -- The position of the wall creating trim for
local Clone = v:Clone()
Clone.Name = "Trim" --Create a clone of the wall named "Trim"
Clone.Parent = Walls:FindFirstChild("Trim") -- We will parent the clone to the "Trim" folder
Clone.Size = Vector3.new(OriginalSize.X + 0.35, 1.5, OriginalSize.Z + 0.35) -- you can adjust these values to affect the width, length, and height of your trim
Clone.Position = Vector3.new(OriginalPosition.X, OriginalPosition.Y - OriginalSize.Y / 2, OriginalPosition.Z) -- Position the clone to the original wall's position and move it down to the bottom
Clone.Material = Enum.Material.Wood -- Set the material of the trim, "Plastic" or "Wood" recommended
Clone.Color = Color3.fromRGB(63, 39, 11) -- Set the RGB color of the trim
end
end
Putting the plan to action
Now that we have our script, we can copy all of this code and paste it into the command bar (Go to View → Command Bar), and press enter. If it doesn’t look the way you want, you can ctrl + z and tweak the script. Your final product should look something like this:
(I duplicated the trim and moved it up to cover the roof as well)
So if you made a whole map and want to add trim to it, this is as easy as it gets! Thank you for reading this tutorial, and I hope you can find this useful in future builds! I will be trying to make a script able to do it for doorframes as well soon. If you need any help, reply to this post and I will try to get back to you ASAP.
Happy Building