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

I can't get it to stop saying "B2 is not a valid member of Model", what do I do?

Asked by 6 years ago

I can't get it to stop saying "B2 is not a valid member of Model", what do I do? I have tried many things, and I can't get it to stop. What is wrong here?

local B2 = script.Parent.Parent:WaitForChild("B2")

function OnTouched(Part)
if Part.Name == 'F1' then
        local mag = Part.Velocity.Magnitude
        print('Returned Result:', mag)
    if mag > 20 and mag < 50 then
            script.Parent.Transparency = 1
            script.Parent.CanCollide = false
            script.Parent.Parent.B2.Transparency = 0
            script.Parent.Parent.B2.CanCollide = true
    end
end
end

script.Parent.Touched:Connect(OnTouched)
0
Why are you still useing script.Parent.Parent.B2 if you have already defined it as "local B2 = script.Parent.Parent:WaitForChild('B2')"? Optikk 499 — 6y
0
Not sure. I tried "B2" alone but it did not seem to work. Do you have any solutions to the main problem? TheBeaver101 28 — 6y
0
Does anything happen to "B2"? Like does it go away or is it still there? User#20279 0 — 6y
0
I is stupid man. It wasn't welded and fell out of the world. Thank you so much. TheBeaver101 28 — 6y
0
^ Rename the title as solved or resolved so that other users know about it. Or just remove the questions. You decide Zafirua 1348 — 6y

Answer this question