Problem with Motor6d with a tool

I try to make a tool in a tool which when equipped, changes Part0 I made the script which WORKS but the property of Motor6d “Active” is false so how can I make it work?

  1. dentify the Motor6D used to connect the parts.
  2. Enable the Motor6D before making any changes to the connected parts.

Here’s an example of how you could implement this:

Example Script:

local tool = script.Parent – The tool
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

tool.Activated:Connect(function()
– Find the Motor6D that connects Part0 (usually the HumanoidRootPart or Torso)
local motor = character:FindFirstChild(“HumanoidRootPart”):FindFirstChildOfClass(“Motor6D”)

if motor then
    -- Enable the Motor6D if it's disabled
    motor.Enabled = true  -- This activates the Motor6D

    -- Change Part0 (this is just an example, adjust as needed)
    local newPart = game.Workspace:FindFirstChild("NewPart")  -- Look for a new part in the workspace
    if newPart then
        -- Update the Part0 that is connected to the Motor6D (this could be the torso or any other part)
        motor.Part0 = newPart
    end
else
    print("Motor6D not found.")
end

end)

Explanation:
Find the Motor6D: We use FindFirstChildOfClass(“Motor6D”) to locate the motor that connects parts. Make sure you search in the correct part of the character, like HumanoidRootPart or Torso.

Enable the Motor6D: If the motor is disabled, we activate it by changing the Enabled property to true. (Note: The old property used to be called Active, but now it’s Enabled in Roblox.)

Change the Part: Once the motor is enabled, we change the Part0 property of the Motor6D to point to a new part, which is the part you want to attach.

Hi there, thanks for your quick answer, if I wrote my post wrongly, im trying to activate and not enable, however the script does not want to activate it because it is grayed out for some reason?
image
If you think having a solution or another way of doing it, let me know!

Ensure the Motor6D is Active:

Make sure the Motor6D is connected to parts that aren’t anchored and that the Enabled property is properly set. Here’s what you can do:

  1. Ensure Enabled is true: Set the Enabled property to true (which you’ve already done), but let’s double-check this in the code to ensure it’s being activated correctly.
  2. Check if Parts Are Anchored: Both Part0 and Part1 should be movable for the Motor6D to work properly. If either of them is anchored, the motor won’t activate.

Example Solution with Proper Activation:

Copiar código

local tool = script.Parent  -- The tool that equips the player
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

tool.Activated:Connect(function()
    -- Find the Motor6D under HumanoidRootPart (or another part if necessary)
    local motor = character:FindFirstChild("HumanoidRootPart"):FindFirstChildOfClass("Motor6D")
    
    if motor then
        -- Ensure the Motor6D's Enabled property is true (activation)
        motor.Enabled = true
        
        -- Ensure that neither Part0 nor Part1 are anchored
        local part0 = motor.Part0
        local part1 = motor.Part1
        
        if part0 and part1 then
            -- Make sure the parts are not anchored
            part0.Anchored = false
            part1.Anchored = false

            -- Optionally, you can adjust the positions if needed
            part0.CFrame = part0.CFrame  -- Refresh position
            part1.CFrame = part1.CFrame  -- Refresh position
            
            -- Print to confirm activation
            print("Motor6D is activated and parts are not anchored.")
        else
            print("Motor6D doesn't have connected parts.")
        end
    else
        print("Motor6D not found.")
    end
end)

Where are you checking it? Are you checking it in the backpack or checking it in the player while the tool is being used?

If I read the Active documentation correctly it states Active shows when a Motor6D is currently active in the world. If you’re looking in the player’s backpack then I don’t know if it’d be shown as Active. If I understand that means it should be Active if the player is using the tool.

You can test this by selecting the Motor6D in the tool that’s in the player in the workspace and enabling and disabling the tool while playing in test mode. See if Active lights up.

You said in your 2 sentence that the script works. If so you probably don’t need to worry about it.

Conclusion:

  • Make sure that the Enabled property is set to true, the parts are not anchored, and that the motor is connected to the right parts.
  • If the parts are anchored or there is any other issue preventing the parts from moving, the Motor6D will not activate properly.

Hey! I fixed it. Thanks a lot!

1 Like