Is your ready function declared correctly? it should be func _ready():
func _ready():
Make sure to paste code with proper formatting.