The Anchored property determines whether the part will be immovable by physics. When enabled, a part will never change position due to gravity, other parts collisions, overlapping other parts, or any other physics-related causes. A part that is not anchored is called unanchored. As a result, two anchored parts will never fire the
/BasePart/Touched event on each other. An anchored part may still be moved by changing its
/BasePart/Position, and it still may have a nonzero
/BasePart/RotVelocity. Finally, if an unanchored part is joined with an anchored part through an object like a
/Weld, it too will act anchored. If such a joint breaks the part may be affected by physics again.
It’s a good idea to anchor parts that are part of your game’s environment (and therefore shouldn’t move). In fact, if you don’t have a good reason to keep a part unanchored, you should anchor it. Unanchored parts can cause performance issues if there are many. In Roblox Studio, you can anchor/unanchor an entire model using the Anchor tool. Be sure to keep static environment models anchored, like in-world buttons, signs, and trees.
Network ownership cannot be set on anchored parts. If a part’s anchored status changes on the server, the network ownership of that part will be affected.
Part Anchored Toggle
This code sample will allow a part to be clicked to toggle its anchored property. When toggled, the visual appearance of the part is updated (red means anchored, yellow means free).
local part = script.Parent -- Create a ClickDetector so we can tell when the part is clicked local cd = Instance.new("ClickDetector", part) -- This function updates how the part looks based on its Anchored state local function updateVisuals() if part.Anchored then -- When the part is anchored... part.BrickColor = BrickColor.new("Bright red") part.Material = Enum.Material.DiamondPlate else -- When the part is unanchored... part.BrickColor = BrickColor.new("Bright yellow") part.Material = Enum.Material.Wood end end local function onToggle() -- Toggle the anchored property part.Anchored = not part.Anchored -- Update visual state of the brick updateVisuals() end -- Update, then start listening for clicks updateVisuals() cd.MouseClick:Connect(onToggle)