attempt to index local "reader" (a nil value)

Started by Yixuan, Jul 14, 2023, 10:40 PM

Previous topic - Next topic

Yixuan

i know that "attempt to index local "reader" (a nil value)" means that i try to call/read a value that didnt exist but i dont know what im doing worng in my code

print("program started")

local reader = peripheral.find("ship_reader")
redstone.setOutput("top",true)

while true do
repeat

local result = reader.getWorldspacePosition()
sleep(0.1)

until (result.y == 90)

redstone.setOutput("top",false)

end

Lupus590

Reader is nil, which means that the peripheral was not found. "ship_reader might not be the correct peripheral type, your network may not be set up correctly, or you could be missing a compatibility mod.