local debounce = true
script.Parent.Touched:connect(function(Part)
if debounce == true then
debounce = false
		if Part.Name == "Handle" and Part.Staff.Value == false then
		if Part.CardNumber.Value == script.Parent.RoomNumber.Value then
		script.Parent.Parent.Door.CanCollide = false
		script.Parent.Parent.Door.Transparency = 0.4
		wait(2)
		script.Parent.Parent.Door.CanCollide = true
		script.Parent.Parent.Door.Transparency = 0
		
		elseif Part.Name == "Handle" and Part.Staff.Value == true then
			script.Parent.Parent.Door.CanCollide = false
		script.Parent.Parent.Door.Transparency = 0.4
		wait(2)
		script.Parent.Parent.Door.CanCollide = true
		script.Parent.Parent.Door.Transparency = 0
		end
		end
		elseif debounce == false then
        debounce = true
wait(0.2)
		end
	

end)

The output is saying that "Staff" Isn't a valid Member of Part (Which Part is Handle, which is the handle of a Tool. )But the BoolValue is clearly there. How can I fix this?

1 comment

0

Use 'Part:WaitForChild("Staff").Value', this is because Staff probably does not exist when the script runs that line of code.