Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Not detecting Part1. Why? (Unaswered)

A while ago I posted a thread with this script asking for a bit of help with an issue. Well, after someone helped me out, I ran into a new issue. I've been trying all I can but cant seem to fix it.

Anyways, the problem is in the function below. It is supposed to find the original part that has the joint that binds it by clicking on a part and scanning all of the> Motor6D's in the model. This code does work, but I i try to animate one joint that ends up moving all the rest, it no longer can find the Joint.

That kinda sounds confusing up there, but you can find out what I mean Here.

If somebody could help me find out why this is happening or how to fix it, that would be great.

Thanks in advance!

function checkfor(part1)
    -- rather than clicking the joint parts, i can click one of the parts
    -- and find its source. No problem here
if part1 then
    local m = workspace.Model:GetChildren() -- the model I am animating
    for i = 1, #m do
        if m[i]:FindFirstChild("Motor6D") then
            if m[i].Motor6D.Part1 == part1then
                return m[i]
else print("cant find")
            end
        end
  end  end
end

this function fires with this code :

mouse.Button1Down:connect(function()
    -- around here is where it gets a bit iffy
    if checkfor(mouse.Target) then

1 answer

You made a simple typo.

Instead of,

if m[i].Motor6D.Part1 == part1then

It should be,

if m[i].Motor6D.Part1 == part1 then

You really should have seen this in the output, but this is obviously your problem.

I'll assume that there's more to your connection, because the way you have it right now would cause an error. You forgot two ends.

3 comments

0

yes there are more to my connections. that was actually an error I made when testing something. But this still didn't seem to solve it.

0

There is nothing more I can do, everything else looks fine.

0

alright. Thanks for trying. This might not be an error in the code, but a Roblox error.

This discussion is preserved as it was. New answers, comments, and votes are closed.