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)

5 comments

0

Why are you still useing script.Parent.Parent.B2 if you have already defined it as "local B2 = script.Parent.Parent:WaitForChild('B2')"?

0

Not sure. I tried "B2" alone but it did not seem to work. Do you have any solutions to the main problem?

0

Does anything happen to "B2"? Like does it go away or is it still there?

0

I is stupid man. It wasn't welded and fell out of the world. Thank you so much.

0

^ Rename the title as solved or resolved so that other users know about it. Or just remove the questions. You decide