Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Not detecting Part1. Why? (Unaswered)

Asked by 10 years ago

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

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

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.

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. nighttimeninja314 120 — 10y
0
There is nothing more I can do, everything else looks fine. Perci1 4988 — 10y
0
alright. Thanks for trying. This might not be an error in the code, but a Roblox error. nighttimeninja314 120 — 10y
Ad

Answer this question